Skip to content

Fix stepper timing#28169

Merged
thinkyhead merged 13 commits intoMarlinFirmware:bugfix-2.1.xfrom
Tsalokin:Step-Period-Correction
Nov 14, 2025
Merged

Fix stepper timing#28169
thinkyhead merged 13 commits intoMarlinFirmware:bugfix-2.1.xfrom
Tsalokin:Step-Period-Correction

Conversation

@nanctil
Copy link
Contributor

@nanctil nanctil commented Nov 12, 2025

Description

Potential solution for #28167
Removed the time spent in the ISR from the calculated period to the next Stepper ISR.

Requirements

Fix should work on all boards AFAIK. Tested on Teensy_41.

Benefits

Fixes the inaccuracy in the stepping period due to the ISR potentially taking up a significant portion of that time. More prevalent on faster MPU's at faster step rates.

Configurations

Configs.zip

Optionally, I also included in a copy of MarlinCore.cpp with added serial output that includes the current mm/m (and other things for debugging).

Related Issues

[BUG] Incorrect feedrates on fast MPU's #28167

removed the time spent in the ISR from the calculated period to the next Stepper ISR
@thinkyhead thinkyhead changed the title Update stepper.cpp Fix stepper timing Nov 12, 2025
put the GPT timer in freerun mode and resetting count to 0 on isr trigger.
@thinkyhead thinkyhead force-pushed the Step-Period-Correction branch 2 times, most recently from 4eb9824 to 6e29987 Compare November 13, 2025 18:21
@thinkyhead thinkyhead force-pushed the Step-Period-Correction branch from 6e29987 to 8fa2204 Compare November 13, 2025 18:31
HAL_timer_set_compare now temporarily enables free run mode before setting the compare register set to prevent GPTx_CNT from resetting.
missing a break;
@thisiskeithb thisiskeithb linked an issue Nov 14, 2025 that may be closed by this pull request
1 task
@thinkyhead thinkyhead merged commit c9488b4 into MarlinFirmware:bugfix-2.1.x Nov 14, 2025
67 checks passed
thinkyhead added a commit that referenced this pull request Nov 20, 2025
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Nov 20, 2025
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Nov 20, 2025
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Nov 20, 2025
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Nov 20, 2025
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Nov 20, 2025
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Jan 16, 2026
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Jan 16, 2026
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Jan 22, 2026
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
thinkyhead added a commit that referenced this pull request Jan 22, 2026
🧑‍💻 Timer general cleanup
🩹 Teensy 4.x timer mods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Incorrect feedrates on fast MPU's

3 participants