Uno R3 VS Uno R4 Stepper motor problem


So I’m having some problems witch I seem to have pin pointed to my new Arduino UNO minima R4

I have the simple code below that runs perfectly on an Arduino UNO R3

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

Any ideas from people would be fantastic



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.

Hey thanks for the reply

Yeah in my head and the way the motor sounds and studders feels like it’s something to do with timing

Will have a go at bypassing the CNC sheild as that sets out the pins the the R4 must use to drive the STEP and Direction inputs on the TMC2208

And work my way along using different pins on a bread bord to see if the results are the same

It’s a shame as the CNC sheild makes it a very neat solution for my application

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.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.