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

Further help porting this to other boards #5

Open
ee-boi opened this issue Apr 30, 2023 · 1 comment
Open

Further help porting this to other boards #5

ee-boi opened this issue Apr 30, 2023 · 1 comment

Comments

@ee-boi
Copy link

ee-boi commented Apr 30, 2023

Hi - I stumbled across this library while trying to find a solution to move the Accelstepper run() method out of the main polling loop. I believe your adaptation of the Accelstepper library is the exact solution for this, and one many people would benefit from if it could be adapted to other boards (arduino, ARM cortex M).

I saw the other comment on adapting this for arduino, and while I vaguely understand the concept, I do not currently have the technical ability/knowledge to port this to another board.

If possible, can you help with further support for this effort? I am happy to learn more and attempt per your suggestions/advice as I imagine you are busy.

I really think this library could be very, very useful to many other folks with other popular boards like arduino, & ARM. I particularly am interested in adapting this code base to the SAMD21 or SAMD51 ARM cortex M series. Any and all help is appreciated. Thank you and great work here, would love to connect further on this topic if possible.

@sq7bti
Copy link
Owner

sq7bti commented Jul 9, 2023

The actual code was very simply adopted from the AccelStepper code, by substituting the code that needs to be run in loop() by an ISR routine, namely by the timer handler. If you have another MCU where the timer ISR can be reprogrammed to do a custom task, it should be straight forward to do the same. Check which timers are still free to use (most of the Arduino ports for other MCU's makes use of the timer for time keeping, etc.) and make use of it. Depending on the resolution and size of these timers, the main routine (the one that recalculates how long should it wait for another step) needs certain adaptation, but that should be fairly easy, once you know the time-base of the timer and expected acceleration speeds, maximum rotation speed etc.
I see there are even some code examples how to make use of the timer interrupts on github:
https://www.arduino.cc/reference/en/libraries/samd_timerinterrupt/
https://github.com/khoih-prog/SAMD_TimerInterrupt/blob/main/examples/ISR_16_Timers_Array/ISR_16_Timers_Array.ino

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

No branches or pull requests

2 participants