Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard time_spent_in/out_isr with MULTISTEPPING_LIMIT > 1 #27147

Open
wants to merge 1 commit into
base: bugfix-2.1.x
Choose a base branch
from

Conversation

mh-dm
Copy link
Contributor

@mh-dm mh-dm commented Jun 3, 2024

Description

Guard time_spent_in_isr and time_spent_out_isr with MULTISTEPPING_LIMIT > 1 since the values are not actually used/useful in this case. The compiler doesn't do it for us especially since it won't optimize away even reads on any volatile variables.

Benefits

Small speedup in max theoretically achievable stepping speed since there's less computation in the ISR. Example from LPC1769 with 80steps/mm: ~5400mm/s to ~6100mm/s (though note it was pre-optimized locally with -flto build option - for better inlining - and a spattering of [[gnu::section(".ramcode")]] to make sure the stepper ISR code was contained in microcontroller RAM).

Before, looking at the step/dir pins with a logic analyzer (at 16Mhz capture rate):
guard-isr-ticks-before
After:
guard-isr-ticks-after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant