Klipper is a 3d-printer firmware
Find a file
Kevin O'Connor 3a700a5f62 timer_irq: Remove TIMER_IDLE_REPEAT_TICKS special case
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>
2025-12-03 17:47:50 -05:00
.github workflows: Update github build-test.yaml to ubuntu-22.04 2025-04-16 13:19:54 -04:00
config generic_cartesian: Added option 'axis' for primary carriages 2025-11-25 18:12:43 -05:00
docs docs: Update AHT family sensors documentation 2025-11-30 16:50:11 -05:00
klippy ads1x1x: Interface for "QUERY_ADC" (#7132) 2025-11-30 16:52:22 -05:00
lib spi_flash: FATFS fix missing long filenames support needed by flash-sdcard.sh (#6981) 2025-07-27 12:09:11 -04:00
scripts shaper_calibrate: Reworked multi-file shaper autocalibration 2025-11-21 17:48:56 -05:00
src timer_irq: Remove TIMER_IDLE_REPEAT_TICKS special case 2025-12-03 17:47:50 -05:00
test generic_cartesian: Added option 'axis' for primary carriages 2025-11-25 18:12:43 -05:00
.gitignore util: Fix versioning when gitdir is absent (#809) 2018-10-27 10:44:38 -04:00
COPYING COPYING: Update GPLv3 license to latest text (uses https instead of http) 2022-06-03 11:28:44 -04:00
Makefile Revert "Makefile: Don't disable gcc's use-linker-plugin option" 2025-04-16 15:24:05 -04:00
README.md docs: Improve wording of main Klipper page 2025-01-21 18:54:00 -05:00

Welcome to the Klipper project!

Klipper

https://www.klipper3d.org/

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.