hy_vfd ttyUSB0 disconnects & reconnects as ttyUSB1

More
30 Jun 2021 18:51 #213356 by NB70
I'm trying to use the hy_vfd component to control my Huanyang  VFD using a waveshare usb-to-RS485  device.

I can connect to the VFD, start it and set it to the right speed (e.g. using halcmd & in AXIS GUI)  but then ttyUSB0 disconnects and I lose control over it. When I check the /dev/ folder ttyUSB0 is gone and now the usb-to-RS485 device is at ttyUSB1.

I've tried making a udev rule so that "ttyUSB_RS485" always links to the usb-to-RS485 device
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="AB0JO0HA",  SYMLINK+="ttyUSB_RS485"
It connects correctly at program start up but it does not solve the problem as the ttyUSB still disconnects mid-program.
I've tried a different USB-to-RS485 a dapter but had the same problem.

 

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

More
30 Jun 2021 19:44 #213360 by NB70
Some more information.
This is the sequence of halrun commands I used:
halrun
loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB_RS485 -p none -r 9600
setp vfd.enable 1
setp vfd.speed-command 6000
setp vfd.spindle-forward 1
setp vfd.spindle-on 1
The spindle then starts and accelerates to 6000 - but then I get the following error message
ERROR Write port/socket failure (-1)
 

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

  • BeagleBrainz
  • BeagleBrainz's Avatar
  • Visitor
  • Visitor
30 Jun 2021 21:32 #213379 by BeagleBrainz
Replied by BeagleBrainz on topic hy_vfd ttyUSB0 disconnects & reconnects as ttyUSB1
Have you checked dmesg to see what is causing the disconnects ?
Have you tried other USB ports on your machine ?
Does this happen outside of the Linuxcnc environment?
Eg if you tried to do a loop back test using a serial terminal program ?
It does sound like a frustrating issue.

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

More
30 Jun 2021 21:49 #213384 by PCW
It sounds like it may be a EMI issue
I would try adding a common mode choke (giant ferrite bead)
around the RS-485 cable near the USB converter to avoid
stray HF ground currents in the USB cable.

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

More
01 Jul 2021 08:50 #213420 by NB70
Thanks both - I've ordered a ferrite bead & I'll also try the troubleshooting suggested by BeagleBrainz .

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

More
06 Jul 2021 18:15 #213878 by NB70
This problem is now fixed - it was an EMI issue as PCW suggested.

I checked dmesg - a couple of lines pointed to the EMI issue:
[  395.170184] ftdi_sio ttyUSB0: usb_serial_generic_write_bulk_callback - nonzero urb status: -71
[  395.232153] usb usb5-port1: disabled by hub (EMI?), re-enabling...
Also the fact that the connection dropped when the VFD (& its electrical noise) starts up is another clue

I tried adding a clip-on ferrite bead - but this did not solve the problem.
The main culprit I'm sure was the cable - I was using an unshielded twisted pair cat5 cable. I changed this for a shielded cat7 (plus the ferrite bead) and connected the shield to the ground terminal on the waveshare USB-RS485 convertor.

Thanks again for the help!

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

Time to create page: 0.055 seconds
Powered by Kunena Forum