- Posts: 5
- Thank you received: 0
Reversing Spindle Direction for Machine Tapping
- waynegramlich
- Topic Author
- Offline
- New Member
-
As a winter solstice gift to myself, I decided to buy a tension/compression tapping collet for my mill so I could do machine tapping. While I verified that my machine could reverse spindle direction from the manual control panel, I never verified that I could do it from inside LinuxCNC. Needless, to say, M4 causes the spindle to stop rather than reverse. I thought "no sweat", I'll dig out `stepconf` and fire it up and fix the problem.
Now I'm scratching my head, because I can't figure out what all of the spindle options are for the parallel port configuration do. The 5 options are Spindle_ON, Spindle_CW, Spindle_CCW, Spindle_PWM, and Spindle_Brake. Nowhere in the on-line step-conf documentation did I find a description of what each of these pin options do. I'm pretty sure my machine electronics when a PWM pulse and a pin that specifies the spindle direction (either CW or CCW.)
Any help would be greatly appreciated...
Regards,
-Wayne
Please Log in to join the conversation.
You shoudt use at least 12.04 and with 2.7.14 you get so much benefit in order to intersect your needed behaver
Please Log in to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
- Posts: 4739
- Thank you received: 2
waynegramlich wrote: I installed LinuxCNC 2.6.4 on a Ubuntu 10.4.4LTS distro running on a 16MB Intel Box back in March of 2011. It has worked flawlessly almost 8 years. I'm still running the old hardware under the theory of "If it ain't broke, don't fix it!"
As a winter solstice gift to myself, I decided to buy a tension/compression tapping collet for my mill so I could do machine tapping. While I verified that my machine could reverse spindle direction from the manual control panel, I never verified that I could do it from inside LinuxCNC. Needless, to say, M4 causes the spindle to stop rather than reverse. I thought "no sweat", I'll dig out `stepconf` and fire it up and fix the problem.
Now I'm scratching my head, because I can't figure out what all of the spindle options are for the parallel port configuration do. The 5 options are Spindle_ON, Spindle_CW, Spindle_CCW, Spindle_PWM, and Spindle_Brake. Nowhere in the on-line step-conf documentation did I find a description of what each of these pin options do. I'm pretty sure my machine electronics when a PWM pulse and a pin that specifies the spindle direction (either CW or CCW.)
Any help would be greatly appreciated...
Regards,
-Wayne
Spindle_ON - will set up a signal on that parallel port pint that is true when the spindle is on and false when off.
Spindle_CW - will set up a signal on that parallel port pint that is true when the spindle is to turn clockwise.
Spindle_CCW - will set up a signal on that parallel port pint that is true when the spindle is to turn counter clockwise.
Spindle_PWM - will set up a pwm signal on that parallel port pint that can be used to set the spindle speed (with the appropriate hardware.)
Spindle_Brake - will set up a signal on that parallel port pint that is intended to control a spindle brake.
Please Log in to join the conversation.
- waynegramlich
- Topic Author
- Offline
- New Member
-
- Posts: 5
- Thank you received: 0
Parallel ports are largely extinct on newer machines, so that means I'm looking at buying a Mesa board, but which one? Every time I go to the Mesa web site I struggle to figure out what to get. I'm currently leaning towards the 7i92, but have not decided yet.
Then I have to find a PC. There are tons of them out there. At this point in time I'd like to get one without a fan.
The bottom line is that I'm looking into a machine upgrade.
Please Log in to join the conversation.
- waynegramlich
- Topic Author
- Offline
- New Member
-
- Posts: 5
- Thank you received: 0
I've done some digging around with halscope, and it looks like the problem is that my version of LinuxCNC probably has a bug when it come to the M4 command. When I run "M4 S500", the Axis GUI says the spindle is spinning at 500, but halscope shows no PWM signal on the Spindle_PWM signal. For `M3 S500` the PWM signal is present. I'm leaning towards a machine hardware/software upgrade so that I am not chasing around problems in an unsupported version of LinuxCNC.
Please Log in to join the conversation.
Here an example of parameters i used in hal 0-10v example :
spindle for parport in hal :
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= motion.spindle-on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 18000
setp pwmgen.0.offset 0.114285714286
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed => motion.spindle-at-speed
net spindle-cw motion.spindle-forward
net spindle-ccw motion.spindle-reverse
postgui.hal in my case :
net spindle-cw grotius_gui.led_spindle_1_on parport.0.pin-17-out
net spindle-ccw grotius_gui.led_spindle_2_on parport.1.pin-17-out
net spindle-pwm parport.0.pin-01-out
You can put this in one file, postgui.hal if you want.
In your ini at hal section load custom.hal file.
Good luck !!
Please Log in to join the conversation.
waynegramlich wrote: I've done some digging around with halscope, and it looks like the problem is that my version of LinuxCNC probably has a bug when it come to the M4 command. When I run "M4 S500", the Axis GUI says the spindle is spinning at 500, but halscope shows no PWM signal on the Spindle_PWM signal. For `M3 S500` the PWM signal is present.
Using "halmeter" from the "machine" menu have a look at the input to the spindle PWM generator.
Also check what type of PWM generator is being used (look in the HAL file with a text editor to find this)
It might be that negative spindle speed values are not getting to the PWM generator, or it could be that you are using a "type 2" PWM where reverse direction PWM is on a separate HAL pin. You probably need "type 1"
linuxcnc.org/docs/2.7/html/man/man9/pwmgen.9.html
Also, the spindle control docs are here:
linuxcnc.org/docs/2.7/html/man/man9/motion.9.html
Please Log in to join the conversation.
- waynegramlich
- Topic Author
- Offline
- New Member
-
- Posts: 5
- Thank you received: 0
There are two basic solutions:
1. In LinuxCNC 2.7 there is motion.spindle-speed-out-abs which outputs the absolute value of the spindle speed. If that is fed into pwmgen.value, everything would work. Alas, I am running LinuxCNC 2.4 does not have motion.spindle-speed-out-abs. I can work around this by using the abs module to take +/- spindle speed value and make it positive. That works.
2. The other strategy is to switch from type 0 on the `pwmgen` module to type 1. For type 1, it outputs a pwm signal that is based on the absolute value of the input value and a direction signal. The direction signal can be fed to signal-cw. The signal-cw needs to be derived from signal-ccw through a `not` module.
Of the two solutions, the 2nd one is probably better because the `abs` module needs to run in a floating point enabled thread (i.e. server-thread) whereas the `not` module can be run in a non-floating point thread (i.e. base-thread.)
The bottom line is that I've got it working and I really, really appreciate the helpful comments I got on this forum that pointed me in the correct direction.
Please Log in to join the conversation.
