4

I have Kubuntu 14.10 development workstation and recently I have bought a QinHeng Electronics HL-340 USB-Serial adapter. HL-340 is USB<---->Serial adapter and it is recognised by my kernel:

user@comp001:~$ lsusb
    Bus 007 Device 010: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
[..]

I am trying to initiate communication via this adapter with Raspberry Pi B+ board, but I am constantly failing.

Whatever text I send to the Raspberry Pi B+ via minicom, the traffic on the line is dead, I've checked with scope. I've double checked the Raspberry Pi B+ setup, the wirings (triple checked with multimeter), the scope wirings and the serial communication is dead. The port on Raspberry Pi B+ is working, because I've hooked up scope on transmit pin of serial port (on Raspberry Pi B+ side) and if I send text from Raspberry Pi B+ (via minicom under ssh tunnel), I get activity on the scope.

I cannot get data from PC via USB serial dongle. How do I test if the dongle works?

  • 2
    How are using minicom? What port / baudrate? Are the Raspberry Pi serial levels real RS232 levels (-5/+5V) or are they TTL levels (0/5V)? And is the device really recognized by your kernel (check dmesg output after plugging)? lsusb simply shows whatever is connected, even if the device is not supported. – wurtel Mar 13 '15 at 8:54
  • I have one of these too, the output is not at rs232 signal levels (instead 0V and 5V) and the UART seems to only return the low 5 bits of the input. It doesn't work correctly on raspberry pi or on amd64, probably a counterfeit chip. – Jasen Mar 10 '16 at 20:17
  • I compared operation against a known-good PL2303 based serial port, – Jasen Mar 10 '16 at 20:23
1

Is the adapter loading the right kernel module? I've heard that your device may be CH341 compatible:

sudo modprobe ch341
  • should really do lsmod first to confirm that that the module has not loaded automatically. – Jasen Mar 10 '16 at 20:20
  • true, but unless there's already a kernel rule to load the module, it's not going to guess that these two devices are compatible – scruss Mar 12 '16 at 13:16
3

lsusb lists the device here as

Bus 003 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

It is often shipped together with the sds011 sensor. The required kernel module is called ch341 and built with the following .config entry:

CONFIG_USB_SERIAL_CH341=m

If you use make nconfig or make menuconfig you will find this module in

-> Device Drivers
   -> USB support (USB_SUPPORT [=y]) 
      -> USB Serial Converter support

I had to set the communication parameters manually to 9600 baud, 8N1 before I could use the device properly:

$ stty -F /dev/ttyUSB0 9600 raw

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.