Hi,
Can I suggest what I proposed in my last message.
Cut your code back and simulate the limits with buttons, to see if the IMU could be the problem.
Being in troubleshooting mode you have to be prepared to do these things.
Do you have code that does what I suggest, if you wrote your code in stages, you should have a stage where you tested the stepper on its own, then test if it works with limits, before adding the IMU?
Ok! I finally got a moment to come back to this. I have it rotating perfectly and then changing direction by simulating the limits with two buttons. Thus, I definitely have two defective IMU boards which would explain why it was working great and then failed randomly as I troubleshooted the program further. Can anyone recommend a quality version other than these amazon specials?