Fix stepper timing#28169
Merged
thinkyhead merged 13 commits intoMarlinFirmware:bugfix-2.1.xfrom Nov 14, 2025
Merged
Conversation
removed the time spent in the ISR from the calculated period to the next Stepper ISR
1 task
thinkyhead
reviewed
Nov 12, 2025
put the GPT timer in freerun mode and resetting count to 0 on isr trigger.
4eb9824 to
6e29987
Compare
6e29987 to
8fa2204
Compare
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;
1 task
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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