VTaskDelay does not wait what I espect
Hello,
STM32L476.
FreeRTOS 10.3
This call:
while(1){
vTaskDelay(pdMS_TO_TICKS(1000));
HAL_GPIO_Toggle......
}should wait 1 second, toggle a pin again and again. With a single task, it looks ok:
On this graph the bottom pin toggles every second.
The blue bar is in fact a toggle on a pin in the IdleHook function which means that the MCU does nothing nearly all the time.
Now, if I add a second task that does some interesting job, with the same priority (1), here's the result:
The delay function result is 1.6s instead of 1s. The 0.6 difference is equal to the sum of
the duration of all the moments the mcu is not idle.
My understanding is that:
- as systick is the lowest priority, it is always counted, whatever what's going on other interrupts.
- When the requested delay is elapsed, the os should switch to the delayed task at least when it is idle.
On this case, the MCU is idle most of the time but the delayed task is not executed after 1 second.
Why?
Thanks
Julien
