I'm using an arduino uno r3 and did a comparison between a DRV8833 and the DM320T stepper driver with a stepper motor and am a bit confused...
when I run my motor (200 steps/rev) on the DRV8833 and drive it 200 steps, it does a full rev as expected
when i use the DM320T with microstepping=2 and drive it for 400 steps, it does a quarter rev, which was unexpected
in the DM320T manual, i see a spec that indicates that the minimum pulse width is 7.5 microseconds. when i look in the source code for Stepper.cpp, it looks to me like a pulse is sent by sequential calls of digitalWrite() while in some other places online, I see code that inserts a call of delayMicroseconds(pulseWidthMicros) between the digitalWrite() calls.
if the Stepper library is not doing a pause for the pulse width, is there a way to determine what it is? I'm trying to figure out if my DM320T is confused about pulse width, or if the microstepping is not working correctly by a factor of 4...
If Stepper.h is used with a step+dir driver with the one of the quadrature output schemes, you need to send 4x the number of steps and the pulsewidths are two steps wide.
Stepper.h in 2-wire mode sends these signals:
... so it takes 4 steps to cycle a "Pulse" line once.
Determine it from what? The 7.5us minimum pulse rate? If that is the length of two segments of the Stepper.h quadrature cycle, then Stepper.h would need to step twice as fast, or 3.75us/step, or 1/3.75e-6=266666.7steps/sec. I'm not sure how fast stepper.h can go, but 267kSteps/sec or 266666.7/1600*60=10000 RPM seems pretty high. I'd bet the overhead of Stepper.h limits it quite a bit.
I actually don't need it to spin very fast, but I observed some behaviors in the 2 stepper motors i tried that made me wonder if I was reaching a limit with higher levels of microstepping when trying to smooth/quiet my motor.
and thanks for the other library suggestions--I'll check them out!
All three of those libraries do acceleration, which is important if you are trying to reach high speed. Sending high-speed pulses without acceleration is asking for skipped steps.
just for giggles, i did some timing tests for single digitalWrite() and single steps with speed set to 2147483647 (step_delay is very small at that speed) in 2, 4, and 5 wire mode on my uno r3 and got the following avg timings in microseconds:
single digitalWrite(): 3.4
fast digital write (direct port manipulation): .25
2-wire single-step: 33.53 (29.8k steps/sec)
4-wire single-step: 42.85
5-wire single-step: 46.81
i have no particular question about this, just found it interesting