8

OS: Linux Mint 19 Tara (also tested on Ubuntu 18.04 LTS and Ubuntu 14.04 LTS)

Kernel: 4.15.0-20-generic

I have a USB-Serial adapter with the PL2303X chip to connect hardware to a Linux host. The device appears connected via lsusb, however I cannot send and receive data. I've tried sending/receiving data using moserial and putty; when attempting to send commands, no response data is returned and I notice no changes in dmesg or /var/log/syslog.

The same USB-Serial adapter connects and works on the same Dell laptop model with Windows 10; on Windows it can receive commands and return data configured with the port settings below.

I'd like to use the following port settings, though I've tried variations of the following to no avail using moserial and putty (i.e. no parity, different baud rates, hardware/software handshaking, etc.):

Device: /dev/ttyUSB0 (permissions 666, $USER added to `dialout` group) Baud rate: 9600 Data bits: 8 Stop bits: 1 Parity: Even Handshake: none Access mode: read and write 

Windows also works with changing the above settings (i.e. no parity, 7 data bits, lower/higher baud rate, etc.).

I need to be able to send commands and receive data similar to how the device works using Windows, preferably with the above port settings.

Any ideas on how to fix or debug this? I appreciate it.


More info:

lsusb output identifies the device as Bus 001 Device 016: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

Based on

$ lsusb -v -d 067b:2303 bMaxPacketSize0 64 

I believe the adapter has the PL2303X chip instead of PL2303 (source: PL2303 & Pl2303x usb serial device).

I notice messages "not an MTP device" and "unhandled action 'bind'" in /var/log/syslog:

kernel: [ 7436.378438] usb 1-2: new full-speed USB device number 18 using xhci_hcd kernel: [ 7436.528244] usb 1-2: New USB device found, idVendor=067b, idProduct=2303 kernel: [ 7436.528250] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 kernel: [ 7436.528253] usb 1-2: Product: USB-Serial Controller kernel: [ 7436.528256] usb 1-2: Manufacturer: Prolific Technology Inc. kernel: [ 7436.529219] pl2303 1-2:1.0: pl2303 converter detected kernel: [ 7436.530024] usb 1-2: pl2303 converter now attached to ttyUSB0 mtp-probe: checking bus 1, device 18: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2" mtp-probe: bus: 1, device: 18 was not an MTP device upowerd[1238]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0 upowerd[1238]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 

I found an old patch in Linux kernel module patch for Prolific PL-2303X USB-serial adapter, though it mentions the main kernel tree includes PL-2303X support starting from 2.6.8.

$ lsusb -v -d 067b:2303 Bus 001 Device 018: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x067b Prolific Technology, Inc. idProduct 0x2303 PL2303 Serial Port bcdDevice 3.00 iManufacturer 1 iProduct 2 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 39 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x000a 1x 10 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 

dmesg after plugging in device:

[ 7436.378438] usb 1-2: new full-speed USB device number 18 using xhci_hcd [ 7436.528244] usb 1-2: New USB device found, idVendor=067b, idProduct=2303 [ 7436.528250] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 7436.528253] usb 1-2: Product: USB-Serial Controller [ 7436.528256] usb 1-2: Manufacturer: Prolific Technology Inc. [ 7436.529219] pl2303 1-2:1.0: pl2303 converter detected [ 7436.530024] usb 1-2: pl2303 converter now attached to ttyUSB0 

Also have seen the error sending break = -19 message below, but am having trouble reproducing it:

[ 1382.828306] usb 1-2: new full-speed USB device number 6 using xhci_hcd [ 1382.977353] usb 1-2: New USB device found, idVendor=067b, idProduct=2303 [ 1382.977357] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 1382.977360] usb 1-2: Product: USB-Serial Controller [ 1382.977363] usb 1-2: Manufacturer: Prolific Technology Inc. [ 1382.978125] pl2303 1-2:1.0: pl2303 converter detected [ 1382.978753] usb 1-2: pl2303 converter now attached to ttyUSB0 [ 1481.678435] usb 1-2: USB disconnect, device number 6 [ 1481.678645] pl2303 ttyUSB0: error sending break = -19 [ 1481.678821] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0 [ 1481.678859] pl2303 1-2:1.0: device disconnected 
2
  • How did you try to send and receive data? Any error messages during that? Anything in dmesg/system logs after that? Did you set baud rate etc.? Commented Jul 31, 2018 at 4:32
  • Next thing I'd do is to debug the transfers with usbmon/wireshark on the host side, and a scope on the RS232 side, to narrow down what goes wrong, but I don't know if you are comfortable with that. The 'error sending break' follows a disconnect, so it's not that surprising. The disconnect itself is, though. I couldn't find a datasheet with the USB protocol for the PL2303X, so in first approximation one needs to believe the kernel driver source. BTW, you can just do echo foobar > /dev/ttyUSB0 etc. Commented Jul 31, 2018 at 20:59

1 Answer 1

4

(Edit: updated based on @dirkt's comment. thank you)

I found an old manual for the device which explained "commonly communication cables use only 3 pins (RXD, TXD, and GND). This device has a hardware reset pin that is controlled by DTR signal from host."

I confirmed DTR = 1 by running sudo statserial /dev/ttyUSB0:

 Device: /dev/ttyUSB0 Signal Pin Pin Direction Status Full Name (25) (9) (computer) Name ----- --- --- --------- ------ ----- FG 1 - - - Frame Ground TxD 2 3 out - Transmit Data RxD 3 2 in - Receive Data RTS 4 7 out 1 Request To Send CTS 5 8 in 0 Clear To Send DSR 6 6 in 0 Data Set Ready GND 7 5 - - Signal Ground DCD 8 1 in 0 Data Carrier Detect DTR 20 4 out 1 Data Terminal Ready RI 22 9 in 0 Ring Indicator 

I then modified my C code to set DTR = 0 by adding the following:

#include <sys/ioctl.h> ... // then on connect, added the following: int DTR_flag = TIOCM_DTR; // modem constant for DTR pin. ioctl(fd, TIOCMBIC, &DTR_flag); // sets DTR = 0 

[Thank you @dirkt for your help, and everyone for viewing.]

1
  • 11
    To clarify for someone else reading this: The problem was not in the PL2303, the problem was in the device connected to it (which wasn't described in the question). The "old manual" applies to the connected device, not to the PL2303 itself. Commented Aug 1, 2018 at 4:51

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.