tinchogleria wrote on Wednesday, July 19, 2017:
Hi again! I’m trying to run freeRTOS demo application in the Explorer16/32 demo board with PIC24FJ1024GB610 MCU.
In other topic I comment a problem related with the task (or set of tasks) named #4 in FreeRTOS demo application. It is failing. But another question came up observing the behavior of it.
In this example, there is one task wich only role is to “talk” with the LCD (like a ‘gatekeeper task’ according to the official comments).
This task is initialized from main.c file:
/* Start the task that will control the LCD. This returns the handle
to the queue used to write text out to the task. */
xLCDQueue = xStartLCDTask();
xStartLCDTask() code is:
QueueHandle_t xStartLCDTask( void )
{
/* Create the queue used by the LCD task. Messages for display on the LCD
are received via this queue. */
xLCDQueue = xQueueCreate( lcdQUEUE_SIZE, sizeof( xLCDMessage ) );
/* Start the task that will write to the LCD. The LCD hardware is
initialised from within the task itself so delays can be used. */
xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );
return xLCDQueue;
}
And the task code is next:
static void vLCDTask( void *pvParameters )
{
xLCDMessage xMessage;
unsigned short usRow = 0;
/* Remove compiler warnigns. */
( void ) pvParameters;
/* Initialise the hardware. This uses delays so must not be called prior
to the scheduler being started. */
prvSetupLCD();
/* Welcome message. */
prvLCDPutString( "www.FreeRTOS.org" );
for( ;; )
{
/* Wait for a message to arrive that requires displaying. */
while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS );
/* Clear the current display value. */
prvLCDClear();
/* Switch rows each time so we can see that the display is still being
updated. */
prvLCDGotoRow( usRow & 0x01 );
usRow++;
prvLCDPutString( xMessage.pcMessage );
/* Delay the requested amount of time to ensure the text just written
to the LCD is not overwritten. */
vTaskDelay( xMessage.xMinDisplayTime );
}
}
If I’m not wrong, the code** prvLCDPutString( “www.FreeRTOS.org” );** should run just once, when the vLCDTask is initialized. Instead, I’m watching the message** “www.FreeRTOS.org”** in my LCD display frecuently. So, is the demo application resetting itself?
On the other hand, like I mentioned at the beggining, Task #4 is failing and I don’t know the cause.
Are this two issues related?
I apreciate a lot your help.