embedded
runtime_error
ai_generated
true
FreeRTOS: Timer service task overrun, daemon task missed deadline
ID: embedded/freertos-timer-service-task-overrun
88%Fix Rate
83%Confidence
1Evidence
2024-06-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| FreeRTOS 10.5.1 | active | — | — | — |
| ESP-IDF 5.1.2 | active | — | — | — |
Root Cause
Timer service task (daemon) is overloaded with too many active software timers or long callback execution, causing it to miss its scheduling deadline.
generic中文
定时器服务任务(守护任务)因过多活动软件定时器或回调执行时间过长而过载,导致错过调度截止时间。
Official Documentation
https://www.freertos.org/FreeRTOS-Timer-Service-Task.htmlWorkarounds
-
85% success Reduce number of active timers or move long callbacks to separate tasks. Example: if (xTimerIsTimerActive(xTimer)) { xTimerStop(xTimer, 0); }
Reduce number of active timers or move long callbacks to separate tasks. Example: if (xTimerIsTimerActive(xTimer)) { xTimerStop(xTimer, 0); } -
90% success Increase configTIMER_TASK_STACK_DEPTH in FreeRTOSConfig.h to 512 or more to prevent stack overflow, and set configTIMER_QUEUE_LENGTH to 20.
Increase configTIMER_TASK_STACK_DEPTH in FreeRTOSConfig.h to 512 or more to prevent stack overflow, and set configTIMER_QUEUE_LENGTH to 20.
中文步骤
Reduce number of active timers or move long callbacks to separate tasks. Example: if (xTimerIsTimerActive(xTimer)) { xTimerStop(xTimer, 0); }Increase configTIMER_TASK_STACK_DEPTH in FreeRTOSConfig.h to 512 or more to prevent stack overflow, and set configTIMER_QUEUE_LENGTH to 20.
Dead Ends
Common approaches that don't work:
-
88% fail
Increasing timer service task priority does not fix overrun; the issue is CPU time exhaustion, not priority inversion.
-
92% fail
Adding more timer service tasks creates contention and worsens overrun due to scheduler overhead.