No worries. Found the solution. I have spindle.0.speed-out-rps connected to spindle-cmd which ends up being a signed float.
net spindle-cmd <= spindle.0.speed-out-rps And that's connected to the stepgen net spindle-cmd => hm2_7i92.0.stepgen.05.velocity-cmd Results in my P1.19_DB25.2 showing a square wave on the scope when I toggle the axis CW and click on the speed. Change to CCW and click speed again I get the square wave on the scope and the P1.23_DB25.3 changes to a logic high for a change in direction. More when I test it with a motor. John > -----Original Message----- > From: John Dammeyer [mailto:jo...@autoartisans.com] > Sent: June-12-21 11:22 PM > To: Enhanced Machine Controller (EMC) > Subject: [Emc-users] Spindle control > > I'm having a problem understanding how to control a spindle with step/dir > rather than PWM. > > From what I've read on > http://linuxcnc.org/docs/html/examples/spindle.html > > essentially the spindle speed is a positive number and the M3 and M4 commands > are connected to whatever pin(s) controls the > direction of the spindle, if it can even change direction. > > OTOH, from what I can see about the different axis like XY & Z is that the > velocity request is signed. And the stepgen takes the > absolute value of that to set the step rate and the sign to set the direction. > > What I can't figure out is how to translate that so that a stepgen running > the spindle can control the direction. > > Where the PWM direction is controlled by > > # PWM dir pin config > setp hm2_7i92.0.gpio.005.is_output true > net spindle-ccw => hm2_7i92.0.gpio.005.out > > and the initial direction of a stepgen is handled with a positive or negative > stepscale > > This thread > https://forum.linuxcnc.org/24-hal-components/30638-how-to-change-motor-spin-directions > > in a way addresses the problem but not with stepgen. > > In my HAL file I have: > net spindle-ccw <= motion.spindle-reverse > > How would I use spindle-ccw to control the value of a stepgen direction? > > Or would I somehow change the requested velocity to be +/- so the stepgen > properly controls the direction output. > > Is there an easy way? > Thanks > John Dammeyer > > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users