Cannot control the spindle speed.

More
3 years 2 weeks ago #282881 by star-traveler
Hi All!
I'm writing this topic after exhausting all other options and I'm growing a bit desperate.
It would be easier for me to explain may problem if I go in chronological fashion.
So after installing the standard linuxcnc image (2.8.4) I started researching how to make linuxcnc control the spindle: Speeds, On/Off, CW/CCW - the usual stuff. The best way for me, as it turned out, was to control it through a RS485 interface. After doing all the research and setup (electrical, configurations etc.) I got to the point where I could turn the spindle on or off from the linuxcnc software, spin it clockwise/counterclockwise, but at a minimal speed. I couldn't control the spindle speed. (even the +/- buttons in linuxcnc GUI were missing). At the time my custom.hal file looked like this:

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-cw spindle.0.forward => vfd.spindle-forward
net spindle-ccw spindle.0.reverse => vfd.spindle-reverse
net on          spindle.0.on      => vfd.spindle-on

My troubleshooting/research turned nothing. I absolutely could not find any information as to why I'm able to turn the spindle on or off but not control it's speed.
Then I decided just for shits and giggles to change the net spindle-cw/ccw to net spindle-fwd/rev making the custom.hal look like this:
 
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

And Oh Miracle! It worked! I could control the speed of the spindle no problem.
So far so good. I worked with my machine like that for years.

However it was crashing. The linuxcnc software was crashing randomly with the stated cause 'Out of Memory'. That's what the crash report was stating. It was annoying since I had to recalibrate the machine all over again every time, but for a time I was putting up with this.

However my workload increased recently and I started experiencing crashes virtually in every job. Due to the nature of my work process the linuxcnc machine that controls my router had to be running for 12, 20, 30 hours at a time. With the linuxcnc software not being shut down the entire time. And I noticed that sometimes the software would crash even though it wasn't doing anything. Just idle, waiting for me to secure the next piece into the machine.

So recently I decided enough is enough and since 2.8.4 clearly crashes in my case I decided to go up in version. So I installed a standard Debian 12, built kernel from source, patching it with the preempt-rt patch before that, built the latest linuxcnc (2.10.0) form source, installed it - and started my test run. Without an actual machine working I ran some of my longest g-code programs. For 72 hours straight. It DID NOT CRASH! It worked like a charm. The latency is a bit worse but it still works for me.

Except, since I had the actual router detached form my linuxcnc computer I ran a linuxcnc configuration that doesn't spindle control. When I hooked the computer back to my router, I realized I don't have speed control again. Turns on or off. CW/CCW control is there - but at a minimal speed. Except my configuration didn't change. my custom.hal was still with spindle-fwd/rev and not spindle-cw/ccw. But now even that wasn't working anymore. I tried to return it back to spindle-cw/ccw but there was no change in behavior. the [+/-] buttons are not present again.

When I try to execute the cusotn.hal script comand by command in the halrun this is the result:
ivan@router-control:~$ halrun 
halcmd: loadusr -Wn vfd hy_vfd -n vfd -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p none -r 9600
halcmd: net spindle-cmd-rpm-abs           => vfd.speed-command
halcmd: net spindle-fwd spindle.0.forward => vfd.spindle-forward
<stdin>:3: Pin 'spindle.0.forward' does not exist
halcmd: net spindle-rev spindle.0.reverse => vfd.spindle-reverse
<stdin>:4: Pin 'spindle.0.reverse' does not exist
halcmd: net on          spindle.0.on      => vfd.spindle-on
<stdin>:5: Pin 'spindle.0.on' does not exist
halcmd:

The problem with this is that if I run linuxcnc using this same custom.hal file, it launches up seemingly normally. If linuxcnc wasn't able to see spindle.0.forward it would've crashed with the same message: "<stdin>:3: Pin 'spindle.0.forward' does not exist" in the crash report. I know this because I tried editing custom.hal by replacing spindle.0.forward with: spindle.forward, motion.spindle.forward, spindle.1.forward and more. And every time linuxcnc would crash saying any of those "does not exist". but with spindle.0.forward in the custom.hal it launches normally .

Any help would be greatly appreciated. I like LinuxCNC but I'm beginning to get fed up with it's buggyness.
Best regards
Ivan

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago #282891 by PCW
Not sure about the spindle control issue but this would not be
expected to work as the hal spindle pins (like spindle.0.forward)
are created by the motion module (motmod) which you have not
loaded:

ivan@router-control:~$ halrun 
halcmd: loadusr -Wn vfd hy_vfd -n vfd -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p none -r 9600
halcmd: net spindle-cmd-rpm-abs           => vfd.speed-command
halcmd: net spindle-fwd spindle.0.forward => vfd.spindle-forward
<stdin>:3: Pin 'spindle.0.forward' does not exist
halcmd: net spindle-rev spindle.0.reverse => vfd.spindle-reverse
<stdin>:4: Pin 'spindle.0.reverse' does not exist
halcmd: net on          spindle.0.on      => vfd.spindle-on
<stdin>:5: Pin 'spindle.0.on' does not exist
halcmd:

The following user(s) said Thank You: star-traveler

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago #282895 by star-traveler
Thank you very very much! Your comment helped me continue my troubleshooting. So you mentioned that I haven't loaded motmod and this is why those identifiers are not found. so I decided to load it and see what happens. And this is what happened:

ivan@router-control:~$ halrun 
halcmd: loadrt motmod
Note: Using POSIX realtime
motmod: dlopen: /usr/lib/linuxcnc/modules/motmod.so: undefined symbol: update_joint_homing_params
<stdin>:1: waitpid failed /usr/bin/rtapi_app motmod
<stdin>:1: /usr/bin/rtapi_app exited without becoming ready
<stdin>:1: insmod for motmod failed, returned -1
halcmd: 

To be honest when I posted this topic, I fully expected the community to blast me for installing a bleeding edge linuxcnc, since I basically took the master and built it. If I do something like that I shouldn't be surprised by problems. In fact if that's the only problem I should be happy.

So as I see it now, I don't have control over my spindle speed because the motmod module fails to load. but then again when linuxcnc loads it doesn't throw any such error messages which means it manages to load it, but it's probably not fully functional.

I'd greatly appreciate it if you have any more ideas as to how can I fix my issue given the new information I provided :)
Thanks again!
Ivan

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago #282901 by tommylight

To be honest when I posted this topic, I fully expected the community to blast me for installing a bleeding edge linuxcnc, since I basically took the master and built it. If I do something like that I shouldn't be surprised by problems. In fact if that's the only problem I should be happy.
Here you get respect for that, going all in into the unknown and testing new stuff, and finding any issues with it.
:)
Oh yeah, and reporting back if/when you do find issues!
The following user(s) said Thank You: star-traveler

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago #282912 by PCW
Yeah, I think motion requires kins to be loaded
but, if just testing the modbus interface, you don't
need any motion pins as you should be able to load the
modbus driver and directly manipulate the vfd.xxxx pins
The following user(s) said Thank You: star-traveler

Please Log in or Create an account to join the conversation.

More
3 years 2 weeks ago - 3 years 2 weeks ago #282964 by star-traveler
So I was hoping if I get all modules loaded in halrun I could manually execute the custom.hal script and see if it gives some error messages that would point me at what needs fixing. But to no avail. I loaded all the modules, executed every line in the hal script and it gave me no indication. everything went smoothly:

halcmd: loadrt tpmod 
Note: Using POSIX realtime
halcmd: loadrt homemod 
halcmd: loadrt maxkins 
halcmd: loadrt motmod
halcmd: loadusr -Wn vfd hy_vfd -n vfd -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p none -r 9600
halcmd: net spindle-cmd-rpm-abs           => vfd.speed-command
halcmd: net spindle-fwd spindle.0.forward => vfd.spindle-forward
halcmd: net spindle-rev spindle.0.reverse => vfd.spindle-reverse
halcmd: net on          spindle.0.on      => vfd.spindle-on

As you can see no error messages, not failures, everything seems to work fine.
maybe I'm not loading the right kins module?
I'm starting to suspect that once more the names spindle-fwd and spindle-rev are the culprits. Maybe they were changed again.

Now I'm going to turn my research towards learing how to send commands to the VFD through halrun.
 
Last edit: 3 years 2 weeks ago by star-traveler.

Please Log in or Create an account to join the conversation.

Time to create page: 0.252 seconds
Powered by Kunena Forum