Hello
I read in the FreeRTOS documentation that there are 4 States of the tasks : Running, Ready, Blocked and Suspended. But in the IAR (freertos plugin that show running tasks) I see tasks in Running, Ready, Blocked and Delaying states.
I thought that maybe Suspended Delaying states are the same, but the only way to set task to Suspend state is explicitly commanded to do so. And I didn’t set any task to Suspend state explicitly.
maybe delayed is a task that is blocked because it called vTaskDelay or vTaskDelayUntil, and blocked is a task that is blocked on a queue or semaphore. Experiment with it to see.
Yes, you are right - Delaying state appears when I call to vTaskDelay(), also I saw now that Suspended appears after vTaskSuspend.
But now I don’t understand what is Blocked state. I don’t see queues.
What you meen “blocked on a queue” ?
To see the status of Queues - that needs to be enabled in the FreeRTOS Config file(s) - as an example; a queue can block waiting on information to be sent to it - this is a pretty popular way to handle serial ISR RX routines.
Once that is enabled you will see it in the IAR debugger - of course you need to be using a queue in a task.
All the FreeRTOS objects (queues, event groups, etc.) use the same
Blocking mechanism, so the plug-in will not be able to tell how a
Blocked task got into the Blocked state, and just report the task as
being Blocked. The plug-in can tell the difference between a task that
is blocked on an object and a task not is blocked just to delay for a
fixed period though.
Finding the answer to your questions by experimentation is quite easy -
just call the xEventQueueWaitBits() function, then view the task in the
plug-in to see what state is reported.