vTaskDelay in timer callback

Can I use vTaskDelay in timer callback? If my timer has period 3 ticks than vTaskDelay(2) do pause for a 2 ticks or 6 ticks or …?

You can use vTaskDelay() in a timer callback but we advise not to as all software timers run in the context of the same task, so if you block that task no other timers will run.

If you have a periodic timer that executes every 3 ticks, and you block the timer task for 4 ticks, then naturally you will miss the timers deadline as you are blocking the timer task for 1 tick past the time at which it should execute again.

1 Like