1

Problem: My Ubuntu OS cannot handle two serial ports when the serial devices that are connected to the serial ports are powered on. how to overcome this issue and prevent my port from crashing? How do I even troubleshoot it?

Synopsis of symptoms: When the two serial to USB converters are connected to the PC (without any serial devices connected to them) all is fine; they show up as ttyUSB0 and ttyUSB1. However, as soon I connect serial devices to them, and power the serial devices on, one of the serial ports crashes (it disappears from the /dev directory). This is not a hardware issue or wiring issue. Something is going on in the OS that is adding gray hair to my head.... Could you please assist? Please read on for details.

I am running Ubuntu 14.04.3 on a Lenovo laptop.

I am at a point where I am able to re-create the error with the fewest pieces of hardware and software. The steps below recreate the problem:

  1. I start the PC.
  2. Once the PC comes up, I run dmesg and save output to a file. See https://pastebin.com/4fXxK1hV
  3. I plug in a 2.0 USB device called "Labjack U3". This is a fact that I don't believe is very relevant to this matter, but must be noted.
  4. I plug in RS422 to USB device with nothing connected to it. I run lsusb. It is the Bus 003 Device 003: ID 0856:ac11 B&B Electronics device. Output is:

    Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 004: ID 04f2:b44d Chicony Electronics Co., Ltd Bus 001 Device 003: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad] Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub 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 003: ID 0856:ac11 B&B Electronics Bus 003 Device 002: ID 0cd5:0003 LabJack Corporation U3 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  5. I ran dmesg again. The output is here: https://pastebin.com/uTGra1h7

  6. I go to /dev and run ls -l | grep USB. The serial port shows up: constructor@constructor-pc:~$ cd /dev constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0

  7. I power on the device attached to the RS422 Port. There is no change in the output of /dev or ls -l | grep USB and lsusb

  8. I connect the RS232 to USB converter. The serial device is not yet connected to the converter. I ran lsusb. It is the Bus 001 Device 018: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port device. Output is:

constructor@constructor-pc:/dev$ lsusb Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 004: ID 04f2:b44d Chicony Electronics Co., Ltd Bus 001 Device 003: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]

Bus 001 Device 018: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub 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 003: ID 0856:ac11 B&B Electronics Bus 003 Device 002: ID 0cd5:0003 LabJack Corporation U3 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  1. next I run the ls -l | grep USB command in the /dev directory. Here is the output:

constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 crw-rw---- 1 root dialout 188, 1 Nov 21 18:47 ttyUSB1

  1. Up to this point all is OK. I run the dmesg command to capture everything for troubleshooting. See: https://pastebin.com/3kZNLtr6

  2. At this point is where the problem appears. I connect a serial device to the RS232 to USB converter. Up to now all is still OK. I turn on power to the serial device (normally this is the point where the software controlling my prototype crashes). I immediately run the ls -l | grep USB command many times. Here is the output:

constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0 constructor@constructor-pc:/dev$ ls -l | grep USB crw-rw-rw- 1 root dialout 188, 0 Nov 21 16:36 ttyUSB0

You can see that I lost one of my serial ports!

  1. Now I run dmesg for a more knowledgeable person to use for diagnosis. Please see: https://pastebin.com/sCYXeKa9

Tested conclusions I have come to over the past 5 days:

  • The serial devices connected to the RS232 and RS422 work exactly as the manufacturer describes in the manuals when only one of the devices is plugged in at a time. The serial devices are not malfunctioning or broken in any way. If only one device is plugged in at a time, I can communicate with it and control it, and it behaves correctly.
  • The wiring to all the devices is good (double and triple checked using drawings and meter)
  • I have removed the USB hub I was using, and it took a long time to figure out that it was not the hub's fault.
  • I have ruled out the various software packages I am using to read the serial data (I feel that the steps outlined in this posting prove this).
  • It is interesting to comment that this issue occurs without me even sending or receiving commands to the serial devices! When I power up the device connected to the RS232 to USB converter, the serial device is not yet sending messages (or at least I don't believe that it is), but the serial port is immediately dropped by the operating system.

Additional Info: In the last week since asking this question I have procured more serial to USB ports just in case one of them is faulty, and the behavior did not change. I also have replaced the serial component that causes the port to crash when turned on with a spare unit, and the behavior did not change. I also tried a different PC, and the behavior did not change.

Can you please provide an answer with a fix to this issue? Or how to troubleshoot this problem?

As well, if I can provide any information or run any commands, please do not hesitate to let me know!

Thanks in advance...

Mike

1

This was an electrical issue, and not an O/S issue. I wired the serial port of the device to the serial side of the USB to RS485 converter as per the manufacturer's doc, in the following manner:

Tx- to Rx- Tx+ to Rx+ Rx- to Tx- Rx+ to Tx+ gnd to gnd

What ended up solving this issue was disconnecting the gnd to gnd connection. There must have been a ground loop.

  • Good thinking. Got the exact same problem with a usb-serial = serial-usb loop on mac osx 10.13 and of course the solution is spot on. – MoVod Jan 26 '18 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.