Issues connecting USB devices to USB OTG

Dear community,

When connecting some USB devices to the X3 connector (USB-C OTG) of the Dahlia card I get the following error:

[  252.317174] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
[  252.322743] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 3
[  252.330796] xhci-hcd xhci-hcd.2.auto: hcc params 0x0220fe65 hci version 0x110 quirks 0x0000002001010010
[  252.340261] xhci-hcd xhci-hcd.2.auto: irq 78, io mem 0x38100000
[  252.346304] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
[  252.351827] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 4
[  252.359524] xhci-hcd xhci-hcd.2.auto: Host supports USB 3.0 SuperSpeed
[  252.366540] hub 3-0:1.0: USB hub found
[  252.370372] hub 3-0:1.0: 1 port detected
[  252.375508] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[  252.384162] hub 4-0:1.0: USB hub found
[  252.388010] hub 4-0:1.0: 1 port detected
[  253.356684] usb 3-1: new high-speed USB device number 2 using xhci-hcd
[  263.660765] xhci-hcd xhci-hcd.2.auto: Abort failed to stop command ring: -110
[  263.678012] xhci-hcd xhci-hcd.2.auto: xHCI host controller not responding, assume dead
[  263.685949] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
[  263.691538] xhci-hcd xhci-hcd.2.auto: Timeout while waiting for configure endpoint command
[  263.700038] usb 3-1: can't set config #1, error -62
[  263.705203] usb 3-1: USB disconnect, device number 2

I have tried with different devices and it does not fail with all, but I have repeated the same test with a Verdin iMX8M mini module and this error does not appear. What is the reason for this difference in behavior? How can it be fixed?

The SW and HW I have used for these tests is the following:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.148-6.7.0+git.bfdbfb2c85fb #1 SMP PREEMPT Thu Jun 20 15:59:41 UTC 2024
Kernel command line:      root=PARTUUID=fac5235d-02 ro rootwait console=tty1 console=ttymxc2,115200 consoleblank=0 earlycon
Distro name:              NAME="TDX Wayland with XWayland"
Distro version:           VERSION_ID=6.7.0-build.13
Distro variant:           -
Hostname:                 verdin-imx8mp-14740793
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus WB on Verdin Development Board
Toradex version:          0058 V1.1A
Serial number:            14740793
Processor arch:           aarch64
------------------------------------------------------------

Best regards,
Julián

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


:handshake:

The issue you’re encountering with the USB OTG on the Dahlia carrier board could be related to several factors, including differences in hardware configuration, USB controller behavior, or software settings between the Verdin iMX8M Plus and the Verdin iMX8M Mini modules.

Here are a few steps to help diagnose and potentially resolve the issue:

  1. Check Power Supply: Ensure that the power supply to the Dahlia board is sufficient, especially when connecting high-power USB devices. Insufficient power can cause the USB controller to behave unpredictably.

  2. USB Cable and Devices: Verify that the USB cable and devices you are using are functioning correctly. Sometimes, faulty cables or devices can cause intermittent issues.

  3. Kernel Configuration: There might be differences in the kernel configuration between the two modules. Ensure that the kernel configuration for USB support is consistent across both modules. Specifically, check the xhci-hcd driver settings.

  4. USB Controller Firmware: The USB controller firmware might differ between the two modules. Ensure that both modules are running the same firmware version for the USB controller.

  5. Device Tree Configuration: Differences in the device tree configuration can also lead to such issues. Compare the device tree files for both modules to ensure that the USB OTG settings are consistent.

  6. Kernel Logs: The error logs indicate issues with the xHCI host controller. You might want to enable more verbose logging for the USB subsystem to get additional insights. This can be done by adding usbcore.autosuspend=-1 to the kernel command line to disable USB autosuspend and see if it affects the behavior.

  7. Software Updates: Ensure that both modules are running the latest software updates. Sometimes, bugs in the USB stack can be resolved with newer software versions.

  8. USB Hub Control: If you are using a USB hub, ensure that it is properly powered and configured. You can use the uhubctl tool to manage the power to the USB ports and see if it helps in stabilizing the connection.

If the issue persists after trying these steps, it might be helpful to isolate whether the problem is hardware-specific or software-specific by testing with different combinations of hardware and software.

Best regards,
Toradex AI Assistant

Hello @jbruno,

I am able to reproduce this issue here.
It looks like the regulator that enables the power to the port while the Verdin Module is acting as a host is not being toggled with the Verdin iMX8MP.
This is likely a device tree issue, but I will continue to investigate this problem and send updates when there is a solution.

Best Regards,
Bruno

Hello @jbruno,

Investigating this further, I was actually having this issue with an older hardware revision: 0058 V1.0B.
When testing 0058 V1.1A* the devices were properly recognized via the OTG port.

Which devices are you having issues with?
Is the current limit of 1A for the port being respected?

* Edit: The version of the module which the devices worked was mistakenly mentioned as V1.0B.

Best Regards,
Bruno

Hi @bruno.tx ,
We are connecting a USB camera whose current consumption is less than 500 mA.
Best regards,
Julián

Hi @bruno.tx ,
To rule out a bug related to the fact that your default images are configured for the DEV card and not for the Dahlia card, I have reconfigured the system as follows:

fw_setenv board 'dahlia-imx8mp'
fw_setenv board_name 'dahlia-imx8mp'
fw_setenv fdt_board 'dahlia'
fw_setenv fdtfile 'imx8mp-verdin-wifi-dahlia.dtb'
reboot

I have repeated the tests and the failure persists.

Best regards,
Julián

Hello @jbruno,

First, I need to make a correction, on my previous post I forgot to correctly state the hardware version in which the USB DRP worked for me: it was 0058 V1.1A, the same version you have. The post has been updated accordingly.

Thanks for the additional details and tests.
I believe the issue is not directly related to the OTG port, as in your other post you had the same problem in a standard USB A port.
This may be related to the driver being used for the USB port, as the i.MX8M Plus has a USB 3.0 controller (XHCI) and the i.MX8M Mini has a USB 2.0 controller (EHCI).
The XHCI driver is used even when in USB 2.0 mode, and seems to be correctly identifying the camera as a USB 2.0 device:


Which exact camera are you experiencing this problem?
Is any other USB device not working in a similar way with the Verdin iMX8M Plus?
If you prefer, this information can be sent with a message to the moderators here on the community or via support.eu@toradex.com.

Can you also test this on one of the USB-A ports in the Dahlia Carrier Board?
These ports go through a USB hub, but it would be good to understand if the problem is also present there.

Best Regards,
Bruno