Sherline CNC Driver Step Pulse Width Puzzle

Long long ago, as part of tidying up the power distribution inside the Sherline CNC controller PCB, I wrote a cleanroom reimplementation of its PIC firmware and settled on a 25 µs Step pulse width with a minimum 50 µs period:

ADDRESS = 0x378
RESET_TIME = 10000
STEPLEN = 25000
DIRSETUP = 50000
DIRHOLD = 50000

Even shorter values for the Direction signal worked with the initial pncconf setup for the Mesa 5I25 FPGA card:

DIRSETUP   = 25000
DIRHOLD    = 25000
STEPLEN    = 25000
STEPSPACE  = 25000

After thrashing through enough of the Kicad-to-HAL converter to get a HAL file sufficiently tasty to prevent LinuxCNC from spitting it out, the X and A axes moved with a gritty sound and the two other axes were pretty much inert.

After eliminating everything else, including having Tiny Scope™ confirm the pulses were exactly the right duration, I increased them by 10 µs:

DIRSETUP   = 35000
DIRHOLD    = 35000
STEPLEN    = 35000
STEPSPACE  = 35000

After which, all the axes suddenly worked perfectly.

At some point along the way, I (re)discovered that Sherline Step pulses are active-low, although in practical terms getting the pulse upside-down just delays the active edge by its width. Given that the Sherline’s top speed is 24 inch/min = 0.4 inch/s, the minimum step period is 156 µs and even a wrong-polarity step should work fine.

For the record, here’s a perfectly good Step pulse:

Mesa 5I25 35us active-low Step pulse
Mesa 5I25 35us active-low Step pulse

Gotta wipe off that screen more often …