when this code runs on the R3 its perfect nice smooth stepper control with accle and deccle
when this code runs on the R4 the motor is awful very juddery not smooth at all
The boards are driving a CNC shield with tmc2208 drivers plugged into it and micro stepping is being used
Have swapped out all parts to double double checked as well as trying 2 brand new R4s same results R4s don’t work well and R3s flawless
It sounds like a similar problem I had with servo control on a project. XOD was trying to use a timer for 2 different things at the same time. In my case, I could resolve the issue by switching to a different PWM pin so the other timer was available for servo control. I don’t see an obvious fix like that in your project since you are not using PWM…
There might also be some timing going on that works well on R3, but R4 CPU is probably running faster and could be causing timing issues.
Unfortunately, your digital pins are not using timers, so switching pins isn’t likely to help in this case. I’m not sure how to get XOD to re-arrange timers in your code if that is the problem. You could try replacing ‘clock’ with a button to switch directions. That would free up one timer just to test this theory… Changing PWM pin for LED (or dropping LED for testing) might also make a difference.