mmr42 wrote on Wednesday, June 15, 2016:
Hi,
the code I use is based on the example code reduced to the minimum:
2 tasks that make 2 LEDs blink. The task using vTaskDelay(100) works as expected
but the task using vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms) shows
an unpredictable behaviour with 16bit ticks. With 32bit ticks also vTaskDelayUntil
works on my system.
The last time I used FreeRTOS on a similar uC before was with FreeRTOS7.x
and i believe that it worked that days. But FreeRTOS tasks.c changed a lot in between.
Did anyone else try the 16bit ticks with FreeRTOS9 on a 16bit uC?
Hardware:
Microchip dsPIC33EV128GM104
Software:
MPLAB X IDE v3.30
XC16 (v1.26) compiler
FreeRTOS 9.0
FreeRTOSConfig.h
#define configUSE_16_BIT_TICKS 1
Bug description:
vTaskDelay(100); // works as expected
vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms); // unpredictable behaviour
FreeRTOSConfig.h
#define configUSE_16_BIT_TICKS 0
-> Everything is ok.
Task:
static void ledTask( void *pvParameters )
{
TickType_t xLastWakeTime;
const TickType_t xDelayMyTaskms = pdMS_TO_TICKS(100);
int ledStatus = 0;
/* Remove compiler warnings. */
( void ) pvParameters;
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
works correctly. */
xLastWakeTime = xTaskGetTickCount();
for( ;; ) {
vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms);
//vTaskDelay(pdMS_TO_TICKS(500) );
if (ledStatus) {
LED1 = 0;
ledStatus = 0;
}
else {
LED1 = 1;
ledStatus = 1;
}
}
}
Regards
Michael