Suspending a higher priority Task
Dear All,
We are trying a code on Atmel SAM D21 for FreeRTOS. We have defined 2 tasks, one is a UART task that writes a string on the terminal and other one toggles a LED.
The UART task has a higher priority than the LED task.
When the UART task is suspended using vTaskSuspend(uarttaskhandle), the LED task which has a lower priority doesnt execute.
Is this expected ?
Thanks
Suspending a higher priority Task
If the two tasks are independent then, no, that is not expected.
Does the LED task run when the UART task is not suspended?
Regards.
Suspending a higher priority Task
Hi All,
I also found similar issue on SAMD21 Evaluation Board with FreeRtos.
case 1: UartTaskpriority ==> 1 & LEDTaskPriority ==> 2
Handler is Declared but not assigned to any task.
both the task didn’t execute with suspending the handler
case 2: UartTaskpriority ==> 2 & LEDTaskPriority ==> 1
Handler is Declared but not assigned to any task.
LEDTask is executed. But, UartTask is not executed.
with suspending the handler.
case 3: UartTaskpriority ==> 2 & LEDTaskPriority ==> 1
Handler is Declared but not assigned to any task.
both the task didn’t execute.
without suspending the handler
case 4: USRTASKPRIORITY ===> 3 UartTaskpriority ==> 2 & LEDTaskPriority ==> 1
handler is assigned to USRTask
LEDTask & Uart_Task executed.
with suspending the handler.
case 5: USRTASKPRIORITY ===> 1 UartTaskpriority ==> 2 & LEDTaskPriority ==> 3
handler is assigned to USRTask
UartTask is executed. But, LED_Task is not executed.
with suspending the handler.
case 6: USRTASKPRIORITY ===> 1 UartTaskpriority ==> 3 & LEDTaskPriority ==> 2
handler is assigned to USRTask
LEDTask is executed. But, Uart_Task is not executed.
with suspending the handler.
case 7: USRTASKPRIORITY ===> 1 UartTaskpriority ==> 3 & LEDTaskPriority ==> 2
handler is assigned to USRTask
LEDTask is executed. But, Uart_Task is not executed.
without suspending the handler.
case 8: USRTASKPRIORITY ===> 1 UartTaskpriority ==> 2 & LEDTaskPriority ==> 3
handler is assigned to USRTask
UartTask is executed. But, LED_Task is not executed.
without suspending the handler.
please helpme out in fixing these issue.
Thank you
Suspending a higher priority Task
What do you mean “Handler is Declared but not assigned to any task” and “handler is assigned to USR_Task”, etc? What handler? Could you have a buggy UART driver? Did you try with a simple polling driver in place of whatever you are using now?
Suspending a higher priority Task
static xTaskHandle terminaltaskhandle; // Declaration of task handler
xTaskCreate(taskUSR,(const char *) “USR”,configMINIMALSTACKSIZE,NULL,USRTASKPRIORITY,terminaltask_handle);
xTaskCreate(taskuart,(const char *) “Uart”,configMINIMALSTACKSIZE,NULL,UARTTASK_PRIORITY,NULL);
xTaskCreate(ledtask,(const char *) “LED”,configMINIMALSTACKSIZE,NULL,LEDTASK_PRIORITY,NULL);
Initially, taskuart & ledtask was created to which the handler was not assigned. To further understand we created one more task i.e. taskUSR to which we assigned handler. so that we can suspend or resume the task. But, presently we are only suspending the taskUSR not resuming it back ever.