HAL Edits for RS485 / VFD Spindle Control

More
9 months 6 days ago #341891 by Mr1576
Bear with me:
I feel like I have read every article known to man on this subject and watched all the videos on YouTube that I can find but after several weeks cannot start my spindle via software.I am using Linuxcnc v 2.9.8, with QtDragon_hd as my GUI.

I have a 2.2kw water cooled spindle hooked up to a Huanyang HY02D223B inverter. I have a Waveshare RS485 USB connector, wired D+ to RS+ , and D- to RS- on the VFD. The shielded ground is connected to ground on the PC and COM on the VFD. The adapter shows up as ACM0.

VFD jumper has been switched to VI, and programmed as follows:-
PD001: Set to 2 (Source of run command = RS-485 communication port).
PD002: Set to 2 (Source of operating frequency = RS-485 communication port).
PD163: Set to 1 (Communication address of the VFD).
PD164: Set to 1 for 9600 baud 
PD165: Set to 3 (Communication method: 8 data bits, no parity, 1 stop bit - 8N1 RTU). 

While linuxcnc loads, if, after homing, I select MDI and type M3 S1000 (or any other value), nothing happens.
For a while I was questioning the wiring to the spindle/mains and had the awful thought that either the spindle or VFD were duff.
Last night I found this thread  forum.linuxcnc.org/24-hal-components/310...anyang-speed-control and when I followed these steps in Terminal, voila! my spindle runs.

I have attached my HAL file and a screenshot of my procedure in Terminal in the hope that someone can explain why I can't operate the spindle from within my GUI. 

Thanks in advance.

Attachment not found

Attachment not found

Please Log in to join the conversation.

More
9 months 5 days ago #341904 by andypugh
If this is your whole HAL file then the problem is that you have connected the HAL "net" to the VFD but not to the motion contoller.
Code:
# Connect HAL pins to motion controller net spindle-vel-cmd-rpm-abs hy_vfd.speed-command net spindle-cw hy_vfd.spindle-forward net spindle-enable hy_vfd.spindle-on net spindle-ccw hy_vfd.spindle-reverse net spindle-at-speed hy_vfd.spindle-at-speed

This creates "nets" with names like "spindle" enable but there is nothing at the other "end"

Try:
Code:
# Connect HAL pins to motion controller net spindle-vel-cmd-rpm-abs spindle.0.speed-out => hy_vfd.speed-command net spindle-cw spindle.0.forward => hy_vfd.spindle-forward net spindle-enable spindle.0.on => hy_vfd.spindle-on net spindle-ccw hy_vfd.spindle-reverse net spindle-at-speed spindle.0.at-speed <= hy_vfd.spindle-at-speed

The => are optional and ignored by the computer.

linuxcnc.org/docs/stable/html/man/man9/m....html#SPINDLE%20PINS

Please Log in to join the conversation.

More
9 months 5 days ago #341913 by Mr1576
Thanks for your reply @andypugh

I copied and pasted your suggestion into my HAL file, replacing the original erroneous text.

Unfortunately when launching Linuxcnc, an error is shown up as attached in the .png file.

Revised HAL file also attached.

Regards

Phil

Attachment not found

Attachment not found

Please Log in to join the conversation.

More
9 months 5 days ago #341926 by meister
what linuxcnc version do you have ?

in older versions you need to use: motion.spindle-speed-out

Please Log in to join the conversation.

More
9 months 5 days ago #341933 by Mr1576
I’m on the latest version 2.8.9

oops 2.9.8, thanks 

Please Log in to join the conversation.

More
9 months 5 days ago #341935 by meister
i think you mean: 2.9.8

you can try this with running linuxcnc:

halcmd show | grep spindle

and see if there are some spindle pins

Please Log in to join the conversation.

More
9 months 4 days ago #341952 by Mr1576
@meister, thanks.
I can only get linuxcnc top load if I revert to my original HAL, and with your suggestion the results of the grep spindle command are as in the screenshot 

Attachment not found

Please Log in to join the conversation.

More
9 months 4 days ago #341953 by tommylight
No spindle there, attach the hal and ini files here so we can have a look.

Please Log in to join the conversation.

More
9 months 4 days ago #341956 by Mr1576
HAL file (with @andypugh suggestion) attached, as well as current ini file

Attachment not found

Attachment not found

Please Log in to join the conversation.

More
8 months 3 weeks ago #342570 by andypugh
spindle.0.speed-out is clearly there in the screenshot.

Two possibilities spring to mind, one of them rather wierd.

1) You have the net commands for the spindle too early in the HAL file, ie before the motmod module has been loaded.

2) The - in speed-out is the wrong sort of dash. Though it looks right in this case. Maybe try re-typing it using the minus key. I think I typed out the example text on my Mac on a train, and it likes to be clever with typography.

Please Log in to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum