My stepper changes direction randomly on A4988 driver

i am using an a4988 driver to control my stepper. I used your wiring diagram and set it to the right current for my stepper, 1.5A. My stepper changes direction quite randomly every time it stops and then starts. There is no load on the motor. It spins in whatever direction I help it spin in. Could this be because the enclosure vibrates? Or is it that there is no load on it? The micro controller keeps the DIR pin High.


We generally do not expect that driver to run reliably at 1.5A. Does the same behavior occur with the current limit set below 1A?


Even at 0.8A it sometimes spins the wrong way! I attached the datasheet for the motor. Thanks for your assistance.

datasheet.jpe (38.8 KB)


How are you signaling the driver? Can you post pictures that show your connections? If you are using a microcontroller, can you post the code you are using as well?