I think it is not working fine, in this case if configCONTEXT_INTERRUPT_PRIORITY is 5 and configTIMER_INTERRUPT_PRIORITY is 6 and I run the tasks below only task_blinky_1 is executed. Btw, could you please explain the relation between these 2 defines(configCONTEXT_INTERRUPT_PRIORITY / configTIMER_INTERRUPT_PRIORITY ) ? Should they always have higher priorities than usual tasks?
xTaskCreate(task_blinky_1, "APP LED1", configMINIMAL_STACK_SIZE, NULL, 1, NULL);
xTaskCreate(task_blinky_2, "APP LED2", configMINIMAL_STACK_SIZE, NULL, 0, NULL);
If I apply the following config only task_blinky_2 is executed:
xTaskCreate(task_blinky_1, "APP LED1", configMINIMAL_STACK_SIZE, NULL, 1, NULL);
xTaskCreate(task_blinky_2, "APP LED2", configMINIMAL_STACK_SIZE, NULL, 1, NULL);
In both cases above vTaskDelay is not respected, the blink function is executed almost immediately after vTaskDelay.
The only case in which the system is behaving aproximately right is with the following settings, both tasks are executed and LEDs are blinking, when using vTaskDelay() everything is messed up:
#define configCONTEXT_INTERRUPT_PRIORITY 1
#define configTIMER_INTERRUPT_PRIORITY 2 /* This value must not be bigger then context priority */
....
returnValue = xTaskCreate(task_blinky_1, "APP LED1", configMINIMAL_STACK_SIZE, NULL, 0, NULL);
returnValue = xTaskCreate(task_blinky_2, "APP LED2", configMINIMAL_STACK_SIZE, NULL, 0, NULL);
....
/* Task which runs the LED1 app */
void task_blinky_1(void *arg)
{
task_init_1();
for( ;; )
{
IfxPort_togglePin(LED_D107); /* Toggle the state of the LED */
/* Delay 1000ms */
waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, LED1_BLINKY_PERIOD_MS)); /* Wait 500 milliseconds */
//vTaskDelay(pdMS_TO_TICKS(LED1_BLINKY_PERIOD_MS));
}
}
void task_blinky_2(void *arg)
{
task_init_2();
for( ;; )
{
IfxPort_togglePin(LED_D108); /* Toggle the state of the LED */
/* Delay 1000ms */
waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, LED1_BLINKY_PERIOD_MS)); /* Wait 500 milliseconds */
//vTaskDelay(pdMS_TO_TICKS(LED1_BLINKY_PERIOD_MS));
}
}