vApplicationIdleHook and xQueueReceive

karsten_klein wrote on Monday, January 12, 2009:

Hi,
I have the following code:

void vApplicationIdleHook( void )
{
   
unsigned short temp;
unsigned short  queuemessage;
   
if (xQueueReceive(xQueueExtEepromApl2Idle,  &queuemessage, 1))
{
    temp = 2;    /* for test */   
}
else
{
    temp = 1;        /* for test */
}

The call of the function "xQueueReceive" causes an "Bus Error Data Fetch" - exception.

If i use the same in any other Task, everything seams to be fine.

Is it not possible to use the queues inside the vApplicationIdleHook() ?

Very you very much in advance
Regards
Karsten

   
}

davedoors wrote on Monday, January 12, 2009:

You cannot make a blocking function call in the idle hook. If you change the last parameter to 0 it will work. 0 means don’t block to wait for data.

richard_damon wrote on Monday, January 12, 2009:

The Idle task is not allowed to block.
The Idle hook runs as part of the Idle task

xQueueReceive, unless given a 0 timeout parameter might block, violating the above rule.

If Idle blocks, suddenly there is no task to run and schedule dies.

karsten_klein wrote on Monday, January 12, 2009:

Ok, I see.
But does it work reliable if the xTicksToWait will be changed to 0 ?