[SILABS-CP2105] Usb serial crash when close second comport

  • Device : Nano/Xavier
  • L4T : 32.5.1
  • Test Application : minicom
  • Step : There are two ttyUSB port, open one of them and close it. Next time, open another port and close it. repeating this step.
  • Reference : usb serial crash when close second comport
  • Issue : The UART port will get ETIMEOUT(-110) during close.
    Description : There is a CP2105 USB to UART module in our customed carrier board. When it do open / close many times, it will get hang during close the minicom.
static void cp210x_close(struct usb_serial_port *port)
{
	usb_serial_generic_close(port);
	/* Clear both queues; cp2108 needs this to avoid an occasional hang */
	cp210x_write_u16_reg(port, CP210X_PURGE, PURGE_ALL);

	cp210x_write_u16_reg(port, CP210X_IFC_ENABLE, UART_DISABLE);

}

The error will occur in the function cp210x_write_u16_reg()

/*
 * Writes any 16-bit CP210X_ register (req) whose value is passed
 * entirely in the wValue field of the USB request.
 */
static int cp210x_write_u16_reg(struct usb_serial_port *port, u8 req, u16 val)
{
	struct usb_serial *serial = port->serial;
	struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
	int result;

	result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
			req, REQTYPE_HOST_TO_INTERFACE, val,
			port_priv->bInterfaceNumber, NULL, 0,
			USB_CTRL_SET_TIMEOUT);
	if (result < 0) {
		dev_err(&port->dev, "failed set request 0x%x status: %d\n",
				req, result);
	}

	return result;
}

I lack the ability to help much with this, but knowing the following will help whoever does answer:

  • Is this code in user space or kernel space?
  • If you run “dmesg --follow”, what shows up when it crashes?
  • If this is in user space, did you compile this yourself? If so, can you compile with debug symbols and get a stack frame/backtrace running in gdb?

Also, I almost forgot to ask: The Xavier and Nano are quite different. Is this a Nano, and if so, is it eMMC model? Or is this Xavier? Or are you saying you have used both with your carrier board?

#1, This code is in kernel
#2, Both the Xavier and Nano got the same error on same carrier board.

If you monitor “dmesg --follow”, and then plug in the USB connector, what shows up? When you get an actual crash, what shows up for that in dmesg?

Hi,
For Jetson Nano, please check this:
Jetson Nano - Disable Serial Console to use all 3 UARTS - #6 by Bibek

If you don’t use debug console, please modify the device tree per suggestion.

The usb port embedded on board. it cannot be unplug out the CP2105 module.
We tried to re-authorized (/sys/bus/usb/devices/*/authorized) it or ioctl USBDEVFS_RESET, both could recover error status. However, those does not solve the root cause.

The CP2105 is a USB to UART module, it seems to nothing to do with the UART port from CPU side.

When the uart port get hang, it throw the log.

[   79.974342] cp210x ttyUSB1: failed set request 0x12 status: -110
[   85.086840] cp210x ttyUSB1: failed set request 0x0 status: -110

Plug- in something to USB1 / USB2, it get the following errors

[   99.914696] usb 1-3.1: USB disconnect, device number 6
[  105.256592] usb 1-3.1: new low-speed USB device number 9 using tegra-xusb
[  106.256930] usb 1-3.1: Device not responding to setup address.
[  107.468585] usb 1-3.1: Device not responding to setup address.
[  107.679842] usb 1-3.1: device not accepting address 9, error -71
[  107.763824] usb 1-3.1: new low-speed USB device number 10 using tegra-xusb
[  108.764157] usb 1-3.1: Device not responding to setup addres
[  109.975814] usb 1-3.1: Device not responding to setup address.
[  110.187128] usb 1-3.1: device not accepting address 10, error -71
[  110.193546] usb 1-3-port1: attempt power cycle
[  110.794993] usb 1-3.1: new low-speed USB device number 11 using tegra-xusb
[  126.364878] usb 1-3.1: device descriptor read/64, error -110

We found that usb devices under CPU side USB2 port are all hang. The USB1 port on CPU is still work. The USB1 on Gensys is work for pen drive, but mouse / keyboard get failed.

Hi,
If you see this error:

[  110.193546] usb 1-3-port1: attempt power cycle

It means power supply is not sufficient. On Jetson Nano developer kit, we would suggest connect to a USB hub with external power supply, and then connect to the devices. Are you able to do this on your custom board?

Hi,
We detected the USB hub of power level with hardware engineer, there is no any changed from OS boot to error get occur. We provide a external power supply to our custom board, the USB hub power is coming from this.

Is this a custom carrier board?

Yes, it’s our custom carrier board.

It’s hard to say if this is a hardware routing issue or a device tree issue, though I’d tend to lean towards device tree. I’d sprinkle some printk statements in everything associated with close and find the last line of the last function which runs normally without hanging. The next code line would then have to be the part which stops responding, and this might offer a clue as to what change might be needed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.