Cannot open port USBtoUART driver ch341-uart Xavier-AGX

Please provide the following info (check/uncheck the boxes after creating this topic):
Software Version
DRIVE OS Linux 5.2.6
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version
other

Target Operating System
Linux
QNX
other

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)
other

SDK Manager Version
1.6.0.8170
other

Host Machine Version
native Ubuntu 18.04
other

Hi Nvidia,
I tried to open port USBtoUART, driver ch341-uart but it’s not working.
I checked lsusb, it appears USB ch341. But when I open port by gtkterm, ser2net or minicom,
it’s still not working.
I alreay check dmesg and see log:

[ 277.741744] usb 1-4.3: failed to receive control message: -32
[ 277.741926] ch341-uart ttyUSB0: ch341_break_ctl - USB control read error (-32)
nvidia@nvidia-desktop:~$ lsusb
Bus 002 Device 003: ID 2109:0813 VIA Labs, Inc.
Bus 002 Device 002: ID 2109:0813 VIA Labs, Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 005: ID 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet
Bus 001 Device 003: ID 2109:2813 VIA Labs, Inc.
Bus 001 Device 002: ID 2109:2813 VIA Labs, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Each time I tried to open USB port, it always shows this log in dmesg:
[ 1182.070439] usb 1-4.3: failed to receive control message: -32
[ 1182.070615] ch341-uart ttyUSB0: ch341_break_ctl - USB control read error (-32)

I’m sure HL-340 USB-Serial adapter is working normally in my laptop.
Please let me know how to fix it?
Thank you
hungtn

Dear @tnhung1896,
May I know why you want to connect USB to UART connector on target?
Please see Which tty is Xavier-A UART port assigned on Xaveir-A Linux if it helps if you want to use UART connection on Xavier

Hi tnhung1896,

Here is the forum for DRIVE AGX Xavier platform, may I know what’s the platofrm issue you’re asking?
If it’s for Jetson, please open you issue at Latest Autonomous Machines/Jetson & Embedded Systems topics - NVIDIA Developer Forums
If it’s for DRIVE platform, please change to use your company or research institute email account first.

Thanks

Hi @SivaRamaKrishnaNV
I want Xavier can open port USB in device HL-340 USB-Serial adapter.
I pluged&unpluged HL-340 USB-Serial adapter to determined exactly device in ttyUSB0.
But I cannot open ttyUSB0, the error log I wrote above.

Thank you
hungtn

Hi @kayccc
I’m using Jetson AGX Xavier.
Thank you, I’ll change to Jetson topic.

hungtn

hello tnhung1896,

Jetson AGX Xavier brings five UARTs for usage, may I know what’s your pin connections,
please access Jetson AGX Xavier Series OEM Product Design Guide and check [13.3 UART] chapter.
you may also see [Figure 13-7. Jetson AGX Xavier UART Connections] for reference,
thanks

Hi @JerryChang ,
Sorry for my unclear post,
the “USBtoUART”, I mean it’s “HL-340 USB-Serial adapter” device to convert Rs232 and USB.
It’s pluged to Xavier via USB(not connect UART in Xavier).
And I cannot open this USB port in Jetson Xavier.

Thank you
hungtn9

Since the USB side is on the Jetson, if you monitor “dmesg --follow”, and then connect the USB, what log lines show up?

Hi @linuxdev
When I connect USB to Xavier, it shows:
[42129.779554] tegra-xusb 3610000.xhci: exiting ELPG done
[42130.051010] usb 1-4.3: new full-speed USB device number 6 using tegra-xusb
[42130.072078] usb 1-4.3: New USB device found, idVendor=1a86, idProduct=7523
[42130.072089] usb 1-4.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[42130.072095] usb 1-4.3: Product: USB2.0-Ser!
[42130.073068] ch341 1-4.3:1.0: ch341-uart converter detected
[42130.074462] usb 1-4.3: ch341-uart converter now attached to ttyUSB0

Xavier can attach USB but cannot open this USB port.
When I try to open ttyUSB0, the log:
[42130.073068] ch341 1-4.3:1.0: ch341-uart converter detected
[42130.074462] usb 1-4.3: ch341-uart converter now attached to ttyUSB0
[42311.957620] usb 1-4.3: failed to receive control message: -32
[42311.957791] ch341-uart ttyUSB0: ch341_break_ctl - USB control read error (-32)

I have 2 Jetson Xavier boards and this error is the same in both.
Is this an error in kernel?

hello tnhung1896,

it’s error reported from the usb kernel driver,
you may enable the debug logs as following,

# echo file ch341.c +p > /sys/kernel/debug/dynamic_debug/control

please also refer to kernel sources for details,
i.e. $L4T_Sources/r32.6.1/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/usb/serial/ch341.c

Hi @JerryChang
I see the error occurred because “usb_control_msg” function in line 118 file ch341.c
As I see, the error code -32 is defined in file errno-base.h

#define EPIPE 32 /* Broken pipe */

I don’t have much experience about kernel programming.
Can you let me know how to fix it?

The log dmesg after I enabled debug log as your instruction:

[ 471.345726] usb 1-4.3: new full-speed USB device number 5 using tegra-xusb
[ 471.366831] usb 1-4.3: New USB device found, idVendor=1a86, idProduct=7523
[ 471.367024] usb 1-4.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 471.367165] usb 1-4.3: Product: USB2.0-Ser!
[ 471.368287] ch341 1-4.3:1.0: ch341-uart converter detected
[ 471.368539] usb 1-4.3: ch341_control_in(c0,5f,0000,0000,ffffffc7d44e4580,2)
[ 471.368795] usb 1-4.3: ch341_control_out(40,a1,0000,0000)
[ 471.369006] usb 1-4.3: ch341_control_out(40,9a,1312,b202)
[ 471.369213] usb 1-4.3: ch341_control_out(40,9a,0f2c,000c)
[ 471.369443] usb 1-4.3: ch341_control_in(c0,95,2518,0000,ffffffc7d44e4580,2)
[ 471.370825] usb 1-4.3: ch341_control_out(40,9a,2518,0050)
[ 471.371115] usb 1-4.3: ch341_control_in(c0,95,0706,0000,ffffffc7d44e4680,2)
[ 471.371437] usb 1-4.3: ch341_control_out(40,a1,501f,d90a)
[ 471.371636] usb 1-4.3: ch341_control_out(40,9a,1312,b202)
[ 471.371852] usb 1-4.3: ch341_control_out(40,9a,0f2c,000c)
[ 471.372043] usb 1-4.3: ch341_control_out(40,a4,ffff,0000)
[ 471.372415] usb 1-4.3: ch341_control_in(c0,95,0706,0000,ffffffc7d44e4680,2)
[ 471.372908] usb 1-4.3: ch341-uart converter now attached to ttyUSB0
[ 476.891346] usb 1-4.3: ch341_control_in(c0,5f,0000,0000,ffffffc7cc640c00,2)
[ 476.891751] usb 1-4.3: ch341_control_out(40,a1,0000,0000)
[ 476.891969] usb 1-4.3: ch341_control_out(40,9a,1312,b202)
[ 476.892169] usb 1-4.3: ch341_control_out(40,9a,0f2c,000c)
[ 476.892410] usb 1-4.3: ch341_control_in(c0,95,2518,0000,ffffffc7cc640c00,2)
[ 476.892646] usb 1-4.3: ch341_control_out(40,9a,2518,0050)
[ 476.892832] usb 1-4.3: ch341_control_in(c0,95,0706,0000,ffffffc7c3d26fc0,2)
[ 476.893059] usb 1-4.3: ch341_control_out(40,a1,501f,d90a)
[ 476.893242] usb 1-4.3: ch341_control_out(40,9a,1312,b202)
[ 476.893436] usb 1-4.3: ch341_control_out(40,9a,0f2c,000c)
[ 476.893678] usb 1-4.3: ch341_control_out(40,a4,ffff,0000)
[ 476.893866] usb 1-4.3: ch341_control_in(c0,95,0706,0000,ffffffc7c3d26fc0,2)
[ 476.894138] usb 1-4.3: ch341_control_out(40,9a,1312,cc03)
[ 476.894407] usb 1-4.3: ch341_control_out(40,9a,0f2c,0008)
[ 476.894630] usb 1-4.3: ch341_control_out(40,a4,ffff,0000)
[ 476.894840] ch341-uart ttyUSB0: ch341_open - submitting interrupt urb
[ 476.895008] usb 1-4.3: ch341_control_out(40,a4,ff9f,0000)
[ 476.900084] usb 1-4.3: ch341_control_out(40,9a,1312,cc03)
[ 476.905624] usb 1-4.3: ch341_control_out(40,9a,0f2c,0008)
[ 476.911026] usb 1-4.3: ch341_control_out(40,a4,ff9f,0000)
[ 476.916449] usb 1-4.3: ch341_control_in(c0,95,1805,0000,ffffffc7c3d26200,2)
[ 476.923581] usb 1-4.3: failed to receive control message: -32
[ 476.929716] ch341-uart ttyUSB0: ch341_break_ctl - USB control read error (-32)

hungtn

Such an error tends to be a signal quality error and not something you can program. Do you have a different model of USB-to-UART cable you can try? Or, if this is on a HUB, can you try it directly? If it is already directly connected, can you try with a HUB?

The HUB itself might change signals at the physical layer, and thus a HUB can either hurt or help devices which are marginal with signal quality. In other cases, e.g., quirks of devices, there might be a need to enable the “quirk” code for the particular device, but in almost every case where it might be a quirk the logs will actually suggest a possibility of the device needing the quirk code.

Hi @linuxdev
Thank for your information.
I have 2 Jetson AGX Xaviers, 2 different type USB-to-UARTs (but same ch341 driver), 1 USB hub.
I already switched between these devices, include plug USB directly and via USB hub (also plug external power for USB hub). I also checked USB-hub, it’s working normally with mouse or keyboard device plug to Xavier.
But all cases same error in dmesg log.

Other than the HUB or port change I’m not sure that there is more which can be done since this is a USB side error. I had hoped some combination of HUB and port would result in a working signal. Is it possible you could exchange the ch341 chipset device for an FTDI-based USB serial UART?

Hi @linuxdev
Thank for your support,
I don’t have any another USB2UART devices but ch341 and also cannot go out or order ship because of very strict lockdown to prevent Covid in my country. So I’ll try this after then. Hope it can work.
Thank you again.

hungtn