Task States (in IAR plugin)

valeriv wrote on Monday, July 25, 2016:

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.

So the question what is the Delaying task is ?

Thanks in advance
Valerie

edwards3 wrote on Monday, July 25, 2016:

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.

valeriv wrote on Tuesday, July 26, 2016:

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” ?

westmorelandeng wrote on Tuesday, July 26, 2016:

Hello Valerie,

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.

HTH,
John W.

valeriv wrote on Tuesday, July 26, 2016:

Hi John W.

I use Queues for IPC ( to trransfer messages from task to task ).
But I don’t really understand, if I have task, that it’s main loop include

for(;:wink:
{
if(mIpcQ->Receive(&message, mblockTime))
{
DoSomething();
}
}

if It mentioned blocked on Queue, and in IAR I see BLOCKED ?

Thanks a lot.
Valerie

westmorelandeng wrote on Tuesday, July 26, 2016:

Hello Valerie,

What do you see if you put a breakpoint on DoSomething();?

Regards,
John W.

valeriv wrote on Tuesday, July 26, 2016:

If breakpoint on DoSomething() and I stoped there, so this Task on RUNNING state

valeriv wrote on Wednesday, July 27, 2016:

One more question about task states:
I use xEventGroupSetBits(), If it set the task to BLOCKED state ?

rtel wrote on Wednesday, July 27, 2016:

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.

valeriv wrote on Thursday, July 28, 2016:

Tank you very much.