USB RS 485 disconnects when spindle stops

More
09 Dec 2023 15:08 #287667 by mBender
Hi all,

not quite sure if this is the right sub forum, but I couldn't find a better place. I have some weird trouble with a USB RS 485 adapter and disconnections when the spindle stops. I am working with my two examples github.com/xsnoopy/LinuxCNC-Yalang-yl620...s485-Modbus---VFDmod  and github.com/xsnoopy/LinuxCNC-Yalang-yl620...Modbus-ClassicLadder

The disconnection happens in both cases VFD Mod or Classic Ladder. Sometimes when the spindle stopps, the USB adapter get thrown out and reconnects to ttyUSB0 or ttyUSB1 ( it jumps from USB0 to USB1 and back). I created a udev rule which always creates a symlink from ttyUSB0 and ttyUSB1 to ttyRS485 when the usb to serial adapter is plugged in. Using ttyRS485 in LinuxCNC.

Anyway, everytime I get a disconnect I have to restart LinuxCNC, rehome,...

Anyone an idea how to fix it?





Syslog gives me the following error:

Dec  9 10:21:01 LinuxCNC kernel: [ 5415.333356] usb usb3-port2: disabled by hub (EMI?), re-enabling...

This is the output before and after:

Dec  9 10:20:18 LinuxCNC kernel: [ 5371.900647] usb 3-2: USB disconnect, device number 33
Dec  9 10:20:18 LinuxCNC kernel: [ 5371.901069] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
Dec  9 10:20:18 LinuxCNC kernel: [ 5371.901121] ftdi_sio 3-2:1.0: device disconnected
Dec  9 10:20:21 LinuxCNC kernel: [ 5374.748280] usb 3-2: new full-speed USB device number 34 using ohci-pci
Dec  9 10:20:21 LinuxCNC kernel: [ 5374.983390] usb 3-2: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
Dec  9 10:20:21 LinuxCNC kernel: [ 5374.983405] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec  9 10:20:21 LinuxCNC kernel: [ 5374.983414] usb 3-2: Product: FT232R USB UART
Dec  9 10:20:21 LinuxCNC kernel: [ 5374.983421] usb 3-2: Manufacturer: FTDI
Dec  9 10:20:21 LinuxCNC kernel: [ 5374.983427] usb 3-2: SerialNumber: B000P5Q2
Dec  9 10:20:21 LinuxCNC kernel: [ 5374.996442] ftdi_sio 3-2:1.0: FTDI USB Serial Device converter detected
Dec  9 10:20:21 LinuxCNC kernel: [ 5374.996521] usb 3-2: Detected FT232RL
Dec  9 10:20:21 LinuxCNC kernel: [ 5375.007224] usb 3-2: FTDI USB Serial Device converter now attached to ttyUSB0
Dec  9 10:20:23 LinuxCNC ModemManager[418]: <info>  Couldn't check support for device '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2': not supported by any plugin
Dec  9 10:21:01 LinuxCNC kernel: [ 5415.333356] usb usb3-port2: disabled by hub (EMI?), re-enabling...
Dec  9 10:21:01 LinuxCNC kernel: [ 5415.333364] usb 3-2: USB disconnect, device number 34
Dec  9 10:21:01 LinuxCNC kernel: [ 5415.334438] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
Dec  9 10:21:01 LinuxCNC kernel: [ 5415.334455] ftdi_sio 3-2:1.0: device disconnected
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.632251] usb 3-2: new full-speed USB device number 35 using ohci-pci
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.871361] usb 3-2: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.871376] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.871385] usb 3-2: Product: FT232R USB UART
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.871392] usb 3-2: Manufacturer: FTDI
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.871398] usb 3-2: SerialNumber: B000P5Q2
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.877445] ftdi_sio 3-2:1.0: FTDI USB Serial Device converter detected
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.877541] usb 3-2: Detected FT232RL
Dec  9 10:21:02 LinuxCNC kernel: [ 5415.881359] usb 3-2: FTDI USB Serial Device converter now attached to ttyUSB1

 

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

More
09 Dec 2023 15:20 #287672 by PCW
Sounds like a severe EMI issue.

I would try:

1. Make sure RS-485 wiring is not in physically near power wiring
(especially motor wiring)
2. Line filter on VFD input
3. Common mode choke on RS-485 wiring
4. Common mode choke on motor wiring (near VFD)

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

More
09 Dec 2023 16:03 - 09 Dec 2023 16:04 #287682 by mBender
1. It is as far as possible away, the motor and power wiring comes from the bottom, the RS485 wiring is currently pulled directly to the front and away from the VFD. No parallel routing to any other cable.
2. Line filter on VFD input is installed. Did not made a difference.
3. and 4. Just googled common mode chocke. Which one do I need to buy?

I have shielded motor cable, shield connected only at the VFD.
Shielded RS485 cable, shield only connected at the USB Adapter. Ferrit Cores in the data line of the RS 485 signal wires.
LinuxCNC pc, breakout board powered by 5v power adapter OR 5v from the PC. No difference.

I the stepper driver, VFD and LinuxCNC PC all at the same outlet. IS it worth putting the VFD to a different outlet?
Last edit: 09 Dec 2023 16:04 by mBender.

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

More
09 Dec 2023 16:13 - 09 Dec 2023 16:20 #287683 by mBender
I just tried putting the VFD on a different outlet, which is on a different power line (L1 vs L2 ). Did not help.

Also tried putting the PC on a separate power line, did not help either.
Last edit: 09 Dec 2023 16:20 by mBender. Reason: Added the PC power line sentence.

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

More
09 Dec 2023 20:24 #287714 by zz912
I use this dongle

CZK19.63 23%OFF | USB to RS485 485 Converter Adapter Support Win7 XP Vista Linux Mac OS WinCE5.0https://a.aliexpress.com/_mNLBw0Y

You can try it. I have to make GND. But it works me in several aplication.

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

More
10 Dec 2023 09:40 #287746 by TheRoslyak
Possibly, the developers neglected the reconnect feature for device connections. When I was working on the OPC UA client, I spent most of the time implementing the reconnect capability. As for the issue of USB essentially disconnecting, this problem arises when you connect not directly to a port on the motherboard, but through a bunch of adapters or a front USB port.

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

More
10 Dec 2023 23:02 #287804 by mBender
I tried something new. I used a RS 232 to RS 485 adapter and connected the VFD directly to the com port. Now, I get a modbus error as soon as the spindle starts. But it seems that still some packages get delivered and I am able to stop the spindle as well. Once completely stopped, the error goes away. This is all so weird...

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

More
11 Dec 2023 00:06 #287806 by tommylight
All those symptoms point to interference/EMI or power issues.
First thing i would check is grounding/shielding everywhere.

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

More
11 Dec 2023 03:14 #287809 by mBender
I agree. That was in fact the first thing I checked! Changed even the cables,...

Rumors told me I will receive an Oscilloscope not to far in the future. :D That will hopefully help.
The following user(s) said Thank You: tommylight

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

More
11 Dec 2023 16:21 #287862 by tommylight
Having bought hundreds of USB cables, those are the first thing i change when having issues, their quality differs wildly, given the possibility to control the baud rate most can still be used, but when using higher bit rates with no possibility of controlling, most fail. This is painfully true for USB3 type cables, just get a fast external drive and try to copy something, watch how the copy rate plummets to way under USB2.0 speeds as most of the traffic becomes retries due to errors.
-
For slow stuff, buy Anker, BaseUS, Ugreen, charging cables, high quality and always sold as USB2.0 so you know what you are getting. And properly shielded!
Got over 40 of these lately, checked the internal resistance, from 0.1 Ohm for 1.5 meter long to 0.22 Ohm for 3 meter long ones.
Still, you will have to add some ferrite "doughnuts" to motor wires at the VFD output, if they are not already there.

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

Time to create page: 0.081 seconds
Powered by Kunena Forum