6

I have a PL-2303 USB-to-serial cable plugged into my Raspberry Pi via the USB port, which is then connected to a serial device.

However, the Raspberry Pi is unable to read any data coming from the serial device, even with baudrates set properly.

I've confirmed that the cable and the serial device still work - both work just fine on my Ubuntu laptop, it's just the Pi that is misbehaving.

I'm running a Pi B+ with the latest version of Raspbian Lite. I am providing the Pi with a solid tested power supply, so I'm not sure what to do.

dmesg output:

[  793.860807] usb 1-1.2: new full-speed USB device number 5 using dwc_otg
[  793.993394] usb 1-1.2: New USB device found, idVendor=067b, idProduct=2303
[  793.993421] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  793.993432] usb 1-1.2: Product: USB-Serial Controller
[  793.993441] usb 1-1.2: Manufacturer: Prolific Technology Inc.
[  794.009235] pl2303 1-1.2:1.0: pl2303 converter detected
[  794.015475] usb 1-1.2: pl2303 converter now attached to ttyUSB0

Output of stty -F /dev/ttyUSB0:

speed 9600 baud; line = 0;
kill = ^H; min = 1; time = 5;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

If possible, I'd like to avoid using my Pi's builtin serial port. Therefore, I'd like to get this working. Is there anything I can try?

1
  • You could use lsof to see if anything has the port open: lsof | grep USB0
    – tc0nn
    Commented Oct 6, 2023 at 16:17

2 Answers 2

4

I suggest you start with a clean reboot and a loopback test: that will eliminate any glitches or a mismatch in settings you may have. If that doesn't work, there's a problem with your hardware. Perhaps the power supply is not as good as you think it is, or the USB socket is not working reliably.

Once you get the loopback working, run stty -F /dev/ttyUSB0 on your laptop and reproduce those exact settings on your RPi. By all means, that should work.

For the record, when I plug a PL2303, the default setting I get are:

stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
-brkint -imaxbel
1
  • 4
    Of course, this was a power supply issue. It's amazing what the Pi does when the power supply is anything close to subpar...
    – Kaz Wolfe
    Commented Jul 27, 2017 at 0:52
0

For anyone interested, I had a similar problem, with an PL2303 usbtemp.com digital 1-wire thermometer probe.

Unexpectedly, as a user utmp-cli gave the error Error, failed to open serial port device!; even with the correct permissions applied.

But even as root, I got Error, sensor not found!

I finally found out it was because gpsd was running (and gpsd.socket) and hooked to the same serial device /dev/ttyUSB0.

To get the probe working, I have to shut down gpsd.

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