embedded
runtime_error
ai_generated
true
FreeRTOS:定时器服务任务超时,守护任务错过截止时间
FreeRTOS: Timer service task overrun, daemon task missed deadline
ID: embedded/freertos-timer-service-task-overrun
88%修复率
83%置信度
1证据数
2024-06-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| FreeRTOS 10.5.1 | active | — | — | — |
| ESP-IDF 5.1.2 | active | — | — | — |
根因分析
定时器服务任务(守护任务)因过多活动软件定时器或回调执行时间过长而过载,导致错过调度截止时间。
English
Timer service task (daemon) is overloaded with too many active software timers or long callback execution, causing it to miss its scheduling deadline.
官方文档
https://www.freertos.org/FreeRTOS-Timer-Service-Task.html解决方案
-
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.
无效尝试
常见但无效的做法:
-
88% 失败
Increasing timer service task priority does not fix overrun; the issue is CPU time exhaustion, not priority inversion.
-
92% 失败
Adding more timer service tasks creates contention and worsens overrun due to scheduler overhead.