mirror of
https://github.com/Klipper3d/klipper.git
synced 2026-07-05 13:59:07 +02:00
3a700a5f62f7b8b0be698de2a16490d0a8cf6c2b
The TIMER_IDLE_REPEAT_TICKS was intended to reduce the number of cases
where timers would defer to tasks when tasks are mostly idle.
However, with commit ea546c78 this became less important because
timers now only defer to tasks if tasks are consistently busy for two
consecutive calls to sched_check_set_tasks_busy().
The TIMER_IDLE_REPEAT_TICKS mechanism could result in extended task
delays if timers do become busy. Timers can become busy in normal
operation if timers are scheduled to run more than 500,000 times a
second (every 2us or faster). This can occur on stepper movement when
using high microstep settings. If timers become busy, it could take
up to 1ms for tasks to next be given an opportunity to run (two calls
to sched_check_set_tasks_busy() at 500us per call). This wouldn't
typically be an issue if tasks are also busy, but in some loads tasks
may need to run periodically in such a way that the task status
alternates between idle and busy. In this case, the
TIMER_IDLE_REPEAT_TICKS mechanism could effectively limit the number
of task wakeups to only ~1000 per second.
The "USB to canbus bridge" code uses tasks to transfer data to/from
USB and canbus. If timers become busy, the limiting of task wakeups
could lead to a situation where the effective bandwidth becomes
severely constrained. In particular, this can be an issue on USB
implementations that do not support "double buffering" (such as the
stm32 usbotg code). There are reports of "Timer too close" errors on
"USB to canbus bridge" mode as a result of this issue.
Fix by removing the TIMER_IDLE_REPEAT_TICKS check. Check for busy
tasks every TIMER_REPEAT_TICKS instead (100us).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Welcome to the Klipper project!
The Klipper firmware controls 3d-Printers. It combines the power of a general purpose computer with one or more micro-controllers. See the features document for more information on why you should use the Klipper software.
Start by installing Klipper software.
Klipper software is Free Software. See the license or read the documentation. We depend on the generous support from our sponsors.
Description
Languages
C
95%
Python
3.1%
Jupyter Notebook
1.5%
C++
0.2%
