huanyang vfd won't communicate get errors.

19 Mar 2017 16:58 #89891 by jcloase
I have been trying to get hy_vfd working with my huanyang vfd. I can program a spindle speed and direction in linuscnc ad all the hy_vfd variable look correct but nothing from the spindle. I have parameters set:
I have tried just setting the enable via HAL command: I get the error shown below. Does anyone have any idea what the error code means. I can see the communications happening on an o scope. It looks like HAL keeps trying to communicate as it never stops.

halcmd: loadusr -Wn spindle-vfd hy_vfd -n spindle-vfd -t 1 -d /dev/ttyS0 -p none -r 19200 -s 1
halcmd: show pin
Component Pins:
Owner Type Dir Value Name
5 float OUT 0 spindle-vfd.ACV
5 float OUT 0 spindle-vfd.CNST
5 bit OUT FALSE spindle-vfd.CNST-bracking
5 bit OUT FALSE spindle-vfd.CNST-command-rf
5 bit OUT FALSE spindle-vfd.CNST-jog
5 bit OUT FALSE spindle-vfd.CNST-jogging
5 bit OUT FALSE spindle-vfd.CNST-run
5 bit OUT FALSE spindle-vfd.CNST-running
5 bit OUT FALSE spindle-vfd.CNST-running-rf
5 bit OUT FALSE spindle-vfd.CNST-track-start
5 float OUT 0 spindle-vfd.CNTR
5 float OUT 0 spindle-vfd.Cont
5 float OUT 0 spindle-vfd.DCV
5 float OUT 0 spindle-vfd.OutA
5 float OUT 0 spindle-vfd.OutF
5 float OUT 0 spindle-vfd.Rott
5 float OUT 0 spindle-vfd.SetF
5 float OUT 0 spindle-vfd.Tmp
5 bit IN FALSE spindle-vfd.enable
5 float OUT 0 spindle-vfd.freq-lower-limit
5 float OUT 0 spindle-vfd.frequency-command
5 bit OUT FALSE spindle-vfd.hycomm-ok
5 float OUT 0 spindle-vfd.max-freq
5 float OUT 0 spindle-vfd.rated-motor-current
5 float OUT 0 spindle-vfd.rated-motor-rev
5 float OUT 0 spindle-vfd.rated-motor-voltage
5 float IN 0 spindle-vfd.speed-command
5 bit OUT FALSE spindle-vfd.spindle-at-speed
5 float IN 0.02 spindle-vfd.spindle-at-speed-tolerance
5 bit IN FALSE spindle-vfd.spindle-forward
5 bit IN FALSE spindle-vfd.spindle-on
5 bit IN FALSE spindle-vfd.spindle-reverse
5 float OUT 0 spindle-vfd.spindle-speed-fb

halcmd: setp spindle-vfd.enable 1
halcmd: WAIT_DATA(): comms time out

ERROR Communication time out (-12)
error reading setup from VFD, retrying
WAIT_DATA(): comms time out

Thanks in advance
21 Mar 2017 12:40 #89997 by andypugh

jcloase wrote: It looks like HAL keeps trying to communicate as it never stops.

I think that is expected behaviour.

However, there seems to be no data coming back from the VFD.

What model of VFD is it? There was a mention on the mailing list back in february:

"2. The LinuxCNC Huanyang driver only works with the older style of
Huanyang VFDs. It does not work with the newer GT-series models. I'm
working on a new driver for Huanyang GT VFDs, but it's not ready yet."
The following user(s) said Thank You: jcloase
21 Mar 2017 14:25 #90005 by jcloase
I'v had this 1.5KW VFD for 6 or 7 years (can't read the label where the VFD is in the panel). I was using it with an external pot till now and allowing Linuxcnc to start it from the M3.
I have tried 2 different (third on order) rs485 converters. The cheap USB model has the cleanest signals. With the RS232 version I have seen data I believe is from the vfd but if it is it is not the data hy_vfd wants. When I start linuxcnc I can see the data on the Oscope linuxcnc keeps sending some packet. With the RS232 converter I see what looks like more data and the receive led on my serial monitor flashes. (might be noise). I tried a serial sniffer program and it looked like the VFD was returning FF F7 each time linuxcnc sent whatever it was sending.
21 Mar 2017 17:49 #90020 by cncnoob1979

halcmd: loadusr -Wn spindle-vfd hy_vfd -n spindle-vfd -t 1 -d /dev/ttyS0 -p none -r 19200 -s 1

When I got my huanyang vfd going I could not use the stop bit's or parity in the connection string.

Also make sure you have the + going to the + from the adapter to the vfd. As I'm sure you know; you have to use usb instead of ttyS0 if using a USB-serial adapter.

Try different baud rates with different parity settings. When you keep getting the time out you know its not communicating.

when issuing the command in a terminal


I get the output of:

bridgeport@bridgeport-H81M-S2PH ~ $ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 006: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 003 Device 005: ID 222a:0045
Bus 003 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 003 Device 003: ID 10ce:eb70 Silicon Labs
Bus 003 Device 002: ID 1c4f:0034 SiGma Micro
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This is my dongle.

Bus 003 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

What do you get? You may need to install usbtools I believe it is called for the lsusb to work. Let me know if you run into a snag.

# Load the Huanyang VFD user component

loadusr -Wn spindle-vfd hy_vfd -d /dev/ttyUSB0 -n spindle-vfd 

#String With all the different options## loadusr -Wn spindle-vfd hy_vfd -n spindle-vfd -n -r 19200 -b 8 -p none -s 1 -t 1

# connect the spindle direction pins to the VFD
net hy-fwd <= motion.spindle-forward => spindle-vfd.spindle-forward
net hy-rev <= motion.spindle-reverse => spindle-vfd.spindle-reverse

# connect the spindle on pin to the VFD
net hy-on <= motion.spindle-on => spindle-vfd.spindle-on

# connect the spindle RPM to the VFD
# Note: spindle-cmd created by stepconf wizard
net spindle-vel-cmd-rpm =>  spindle-vfd.speed-command

21 Mar 2017 18:41 - 21 Mar 2017 18:53 #90021 by andypugh
FWIW my loadrt line is just:
loadusr -W hy_vfd -d /dev/ttyUSB0

Why not try that?

(Addendum) I tried your loadusr line and it worked, _Except_ I had to set -d to ttyUSB0 not ttyS0.
Last Edit: 21 Mar 2017 18:53 by andypugh.
21 Mar 2017 19:21 #90022 by jcloase
What are your settings in the VFD for that string?
163 = 1
164 = 2
165 = 3
21 Mar 2017 19:31 #90023 by jcloase
Gold Border,
Tried getting rid of -p did not use stop bits. When parity is removed it appears that hy_vfd defaults to even parity. I tried all three combinations the same result. The data that hy_vfd is sending over and over appears to be
0x01 0x01 0x0B 0x2c 0x30 or decimal 01 01 13 44 48. Thanks
21 Mar 2017 19:32 #90024 by andypugh

jcloase wrote: What are your settings in the VFD for that string?
163 = 1
164 = 2
165 = 3

The same, I think. I just set the VFD to the hy_vfd component defaults, and then load the component without extra options.

I did add a separate gnd/shield to my USB dongle:
(looking now, I didn't show it with the extra wire + screw terminal in that post, but it now has a 3-screw terminal block)
I used Van Damme DMX 1-pair + shield for the connection. But largely only because it was available in purple :-)
21 Mar 2017 19:51 #90025 by andypugh
Maybe it is worth trying one of the $2 USB dongles rather than a serial-port one. We know those work.
21 Mar 2017 20:02 #90028 by jcloase
I have tried both. currently using the USB since the signal are much cleaner.
Time to create page: 0.810 seconds
Powered by Kunena Forum