I have several tasks running in my application. Basically I want them to run periodically in a fix order. Unfortunately the execution seems to mix up so I do not achieve the desired order.
Task 1 (priority 6) should execute every 10ms and increments a variable (time base in 10ms steps). It blocks calling vTaskDelayUntil.
Task 2 (priority 4) depends on the variable’s value and should also execute every 10ms. It also blocks calling vTaskDelayUntil.
As far as I know Task 1 should always enter the running state first due to its higher priority. After Task 1 having blocked, Task 2 should enter the running state (never missing an increment). I assume this scenario should repeat for ever periodically. How can it happen that Task 1 sometimes gets executed twice before Task 2 enters the running state? Is my approach wrong? Can a task leave the blocked state prior to the elapsing of the desired delay time (what reasons are possible)? Thanks for helping.