- Posts: 1317
- Thank you received: 454
Cannot control the spindle speed.
3 years 2 weeks ago #282966
by Hakan
Replied by Hakan on topic Cannot control the spindle speed.
Looking at what's in my hal files, you also need to enable the spindle
Code:
custom.hal:net machine-is-on => spindle-vfd.enable
custom.hal:net spindle-cw => spindle-vfd.spindle-forward
custom.hal:net spindle-ccw => spindle-vfd.spindle-reverse
custom.hal:net spindle-enable => spindle-vfd.spindle-on
custom.hal:net spindle-at-speed <= spindle-vfd.spindle-at-speed
custom.hal:net spindle-vel-cmd-rpm-abs => spindle-vfd.speed-command
The following user(s) said Thank You: star-traveler
Please Log in or Create an account to join the conversation.
3 years 2 weeks ago #282973
by andypugh
Replied by andypugh on topic Cannot control the spindle speed.
In the very latest master there have been changes that move iocontrol into task. This means that things load a bit quicker, and on some machines this can lead to a race condition between motion and task.
It is possible that this is what you are seeing, that pins don't _quite_ exist when the HAL tries to link them.
It is possible that this is what you are seeing, that pins don't _quite_ exist when the HAL tries to link them.
Please Log in or Create an account to join the conversation.
- star-traveler
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 11
- Thank you received: 1
3 years 2 weeks ago #282983
by star-traveler
Replied by star-traveler on topic Cannot control the spindle speed.
YESSSS !!! I GOT IT RUNNING !!!
I used an ancient spell, called: Looking at the documentation.
Gee, who knew the documentation might have some answers for me. 
So now that I got the self deprecating humor out of the way let me describe how I got it to work:
Firs my old custom.hal:
loadusr -Wn vfd hy_vfd -n vfd -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p none -r 9600
net spindle-cmd-rpm-abs => vfd.speed-command
net spindle-fwd spindle.0.forward => vfd.spindle-forward
net spindle-rev spindle.0.reverse => vfd.spindle-reverse
net on spindle.0.on => vfd.spindle-on
those net things are actually variables of type net. So lets take the second line: We have a variable of type net with name spindle-fwd and since net means connection the value of this variable is going to be two things: connecting what to what. In this case, the source signal spindle.0.forward to (=>) the VFD component vfd.spindle-forward. Notice however the first line does not follow this format. It seems that spindle-cmd-rpm-abs is both the name of the variable and the source signal?! I don't know how that worked before but apparently it doesn't any more. So after consulting with the documentation I tried replacing the first net with:
net spindle-speed-cmd spindle.0.speed-out => vfd.speed-command
this worked, the +/- buttons appeared and they were correctly controlling the speed. Also the spindle started responding to the MDI commands in linuxcnc. One small hick up was that the RPM panel that I've setup in linuxcnc didn't show the RPM. But I knew why. The GUI panel is an XML script that indirectly depends on the variable spindle-cmd-rpm-abs which in this case is replaced by spindle-speed-cmd so I either had to change the name of the variable in two different files or just:
loadusr -Wn vfd hy_vfd -n vfd -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p none -r 9600
#type, name val: source -> destiantion
net spindle-cmd-rpm-abs spindle.0.speed-out => vfd.speed-command
net spindle-fwd spindle.0.forward => vfd.spindle-forward
net spindle-rev spindle.0.reverse => vfd.spindle-reverse
net on spindle.0.on => vfd.spindle-on
As you can see I just plugged the spindle.0.speed-out at the appropriate place in the old line that was controlling the spindle speed.
And that fixed it!
Hope that helps!
I used an ancient spell, called: Looking at the documentation.
Gee, who knew the documentation might have some answers for me. 
So now that I got the self deprecating humor out of the way let me describe how I got it to work:
Firs my old custom.hal:
loadusr -Wn vfd hy_vfd -n vfd -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p none -r 9600
net spindle-cmd-rpm-abs => vfd.speed-command
net spindle-fwd spindle.0.forward => vfd.spindle-forward
net spindle-rev spindle.0.reverse => vfd.spindle-reverse
net on spindle.0.on => vfd.spindle-on
those net things are actually variables of type net. So lets take the second line: We have a variable of type net with name spindle-fwd and since net means connection the value of this variable is going to be two things: connecting what to what. In this case, the source signal spindle.0.forward to (=>) the VFD component vfd.spindle-forward. Notice however the first line does not follow this format. It seems that spindle-cmd-rpm-abs is both the name of the variable and the source signal?! I don't know how that worked before but apparently it doesn't any more. So after consulting with the documentation I tried replacing the first net with:
net spindle-speed-cmd spindle.0.speed-out => vfd.speed-command
this worked, the +/- buttons appeared and they were correctly controlling the speed. Also the spindle started responding to the MDI commands in linuxcnc. One small hick up was that the RPM panel that I've setup in linuxcnc didn't show the RPM. But I knew why. The GUI panel is an XML script that indirectly depends on the variable spindle-cmd-rpm-abs which in this case is replaced by spindle-speed-cmd so I either had to change the name of the variable in two different files or just:
loadusr -Wn vfd hy_vfd -n vfd -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p none -r 9600
#type, name val: source -> destiantion
net spindle-cmd-rpm-abs spindle.0.speed-out => vfd.speed-command
net spindle-fwd spindle.0.forward => vfd.spindle-forward
net spindle-rev spindle.0.reverse => vfd.spindle-reverse
net on spindle.0.on => vfd.spindle-on
As you can see I just plugged the spindle.0.speed-out at the appropriate place in the old line that was controlling the spindle speed.
And that fixed it!
Hope that helps!
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
Time to create page: 0.051 seconds