godbps wrote on Wednesday, January 24, 2018:
I have few tasks with different priorities that use the below code for task scheduling
TickType_t prevTime = xTaskGetTickCount();
while(1)
{
…
…
vTaskDelayUntil(&prevTime, period_time_milliseconds);
}
But a task is scheduled at fsater rate than the ‘period_time_milliseconds’ value.
Suspecting the update of ‘prevTime’ in vTaskDelayUntil( …) function I tried the below code which worked properly.
while(1)
{
TickType_t prevTime = xTaskGetTickCount();
…
…
vTaskDelayUntil(&prevTime, period_time_milliseconds);
}
But I am unable to give reason for this behaviour.
Can someone help me to understand what is the issue in the first piece of code and how the solution worked?
Thanks