FreeRTOS ISR Handler Task

Hello Team ! I use TMS570LS0432 Hercules Launchpad with FreeRTOS generated from HALCogen. I tried the following –>Create 6 Tasks (1ms, 5ms, 10ms, 20ms, 50ms, 100ms) –>Create a high priority Interrupt Handler Task. Initially this Task is suspended using vTaskSuspend(). This task is resumed only from ISR. –>Configure HET to give interrupt for every 1ms. ISR will be executed for every ENDOFPERIOD (1ms). –>Inside the ISR, I give vTaskResume() for handling Interrupt Handler Task Now when I run the code in debug mode, I keep a breakpoint in points vTaskSuspend() inside task and vTaskResume() inside ISR. The execution stops at vTaskResume() inside ISR properly, but never enters to the Handler Task as expected. Repeatedly it enters only ISR routine. *** But when the code is debugged Step-by-step then the code enters the Handler Task. * `#include “FreeRTOS.h” #include “FreeRTOSConfig.h” #include “gio.h” #include “het.h” #include “oseventgroups.h” #include “ostask.h” //#include “ostimer.h” #include “libdelayhookhdr.h”
#include "sys_common.h"
xTaskHandle xTask1Handle; xTaskHandle xTask2Handle; xTaskHandle xTask3Handle; xTaskHandle xTask4Handle; xTaskHandle xTask5Handle; xTaskHandle xTask6Handle; xTaskHandle xISRHandle; void vTask1(void *pvParameters) { for(;;) {
    vTask_PreEmp_1ms();
}
} void vTask2(void *pvParameters) { for(;;) {
    vTask_PreEmp_5ms();
}
} void vTask3(void *pvParameters) { for(;;) {
    vTask_PreEmp_10ms();
}
} void vTask4(void *pvParameters) { for(;;) {
    vTask_PreEmp_20ms();
}
} void vTask5(void *pvParameters) { for(;;) {
    vTask_PreEmp_50ms();
}
} void vTask6(void *pvParameters) { for(;;) {
    vTask_PreEmp_100ms();
}
} void vTaskISR(void *pvParameters) { uint32_t Count1=0;
vTaskSuspend(xISRHandle);
Count1++;
} void main(void) { hetInit();
        _enable_interrupt_();

            /* Create Task 1 */
            if (xTaskCreate(vTask1,"Task1", configMINIMAL_STACK_SIZE, NULL, 6, &xTask1Handle) != pdTRUE)
            {
                /* Task could not be created */
                while(1);
            }

            if (xTaskCreate(vTask2,"Task2", configMINIMAL_STACK_SIZE, NULL, 5, &xTask2Handle) != pdTRUE)
                {
                    /* Task could not be created */
                    while(1);
                }

            if (xTaskCreate(vTask3,"Task3", configMINIMAL_STACK_SIZE, NULL, 4, &xTask3Handle) != pdTRUE)
                {
                    /* Task could not be created */
                    while(1);
                }

            if (xTaskCreate(vTask4,"Task4", configMINIMAL_STACK_SIZE, NULL, 3, &xTask4Handle) != pdTRUE)
                    {
                        /* Task could not be created */
                        while(1);
                    }

            if (xTaskCreate(vTask5,"Task5", configMINIMAL_STACK_SIZE, NULL, 2, &xTask5Handle) != pdTRUE)
                    {
                            /* Task could not be created */
                        while(1);
                    }

            if (xTaskCreate(vTask6,"Task6", configMINIMAL_STACK_SIZE, NULL, 1, &xTask6Handle) != pdTRUE)
                   {
                            /* Task could not be created */
                        while(1);
                   }

            if (xTaskCreate(vTaskISR,"ISR", configMINIMAL_STACK_SIZE, NULL, 10, &xISRHandle) != pdTRUE)
                   {
                                            /* Task could not be created */
                        while(1);
                   }

            pwmEnableNotification(hetREG1, pwm1, pwmEND_OF_PERIOD);
            pwmStart( hetRAM1, pwm1);

            /* Start Scheduler */
            vTaskStartScheduler();

            /* Run forever */
            while(1);
} void pwmNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification) {
static uint32_t ucLocalTickCount = 0;

        ucLocalTickCount++;
        vTaskResume(xISRHandle);
} void vApplicationMallocFailedHook( void ) {
        for( ;; );
     }
` Could the support team help to overcome this? Same thing happens with Event Groups and Counting Semaphores as well.

FreeRTOS ISR Handler Task

–>Create 6 Tasks (1ms, 5ms, 10ms, 20ms, 50ms, 100ms)
Is that the cycle rates of the tasks? What is the tick frequency? If it is 1KHz then remember you only have a timing granularity of 1ms – and also the 1ms task will start running after every tick (assuming it is the highest priority).
–>Create a high priority Interrupt Handler Task. Initially this Task is suspended using vTaskSuspend(). This task is resumed only from ISR.
Do NOT do this! Please read the API documentation http://www.freertos.org/taskresumefromisr.html – it is an almost guaranteed way of loosing interrupts. Consider what will happen if the interrupt tries to resume the task before it is suspended. The best method is to use a direct to task notification. http://www.freertos.org/RTOSTaskNotificationAsBinary_Semaphore.html
Repeatedly it enters only ISR routine.
Is the interrupt being cleared?

FreeRTOS ISR Handler Task

I did all this. Yes the code works fine. But why does the control not entering the point vTaskSuspend(xISRHandle); inside the handler task after reaching xTaskResumeFromISR(xISRHandle); inside the ISR ? I raise this question after changing vTaskResume(xISRHandle); to xTaskResumeFromISR(xISRHandle). –>Create 6 Tasks (1ms, 5ms, 10ms, 20ms, 50ms, 100ms) Yes these are the cycle rates and the tick frequency is 1kHZ. The control never went to tasks but executed only the HET ISR at 1ms. I didnot clear the interrupt.

FreeRTOS ISR Handler Task

Can you send me the code to for your program which works fine, as Im beginner and wanna explore more of the RTOS.. Would be grateful thankeu..