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>

: 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>

: 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