LM3S811 demo questions

apessina wrote on Tuesday, March 23, 2010:

Hello.

I’m learning to use the FreeRTOS and I’m modifying the LM3S811 demo.
I’ve added a simple led flasher task, getting good results.
Then I’ve added a very simple dummy task which increments a variable.
Also this new task works ok, but… the vCheckTask fails, returning xErrorOccurred = pdTRUE.
This strange behaviour appears when I add the dummy task to the existing ones and also when I leave it alone removing from the code the led flasher task.
In other words, the problem seems to be related to the dummy task itself.

I use the heap_1.c and I set the following defines to:

#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 7500 ) )

Here’s the small piece of code that I use:

static void vDummyTask( void *pvParameters );
xTaskCreate( vDummyTask, “Dummy”, configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
static void vDummyTask( void *pvParameters )
{
unsigned portLONG ulSpy = 0;
  for( ;; )
  {
    ulSpy++;
  }
}

Any suggestion?

Thank You

Antonio

edwards3 wrote on Tuesday, March 23, 2010:

Your task never enters the Blocked state so will starve tasks that use lower priorities. The check task looks at every task to ensure it is still running and will indicate an error if any are being starved of processing time.

Try adding vTaskDelay(10) to the loop, or creating the task at the idle priority. Either will then allow lower priority tasks to continue executing.

apessina wrote on Wednesday, March 24, 2010:

Great!!!
You’re completely right.
The little vTaskDelay (10) added to the loop is enough to fix the problem.
I’m checking in this exact moment to what happens in the vCheckTask, setting some breakpoints to get the fail reason.
I can see that the error flag is set because the following condition is met:
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
    xErrorOccurred = pdTRUE;
Thank You Very Much
Antonio (Milano-Italy)