View Full Version : At last, found the bug

Robin Hewitt
20-12-2008, 06:14 PM
Taken over a week to find that critter :rolleyes:

My new stepper driver had a gremlin in it. It would buffer commands from the PC in the command buffer, upack them as steps in the step buffer, then extract steps on the interupt and move the motor.

Sounds simple enough, but every once in a while it would go dead slow.. That was the bug :rolleyes:

I had traps and flags all over the shop but everything looked fine and dandy, UNTIL I idly started dumping out the timer delay when it wasn't actually supposed to be doing anything :beer:

An easy mistake... If you want to slam in to reverse at 10 revs/second you have to have accelerations and decellerations. I was turning on and applying the accelerations BEFORE step data actually reached the interrupt. Result, the timer delay overflowed and the delay went from very small to enormous :rolleyes:

These things are amazingly easy to fix once you know what they are :rolleyes: