USB gadget not working (Verdin)

Hi,

As the title says: we are having some problems with our USB on a custom developed carrier board for the Verdin. While trying to figure out this behavior we have reproduced the issue on the Verdin Development Board (V1.0B) as well.

So the problem is that USB devices are not recognized when they are inserted after the Verdin has booted. To reproduce this issue on the development board we have disabled the USB hub by removing the jumpers SODIMM_185 and SODIMM_187. We have connected a USB hub to the USB OTG port of the the development board. Now we observe the following behavior:

  1. If no USB devices are connected during boot, nothing gets recognized if they are plugged in while the system is running.
  2. If a USB device is plugged in the HUB, we can add new devices while the system is running and they are recognized. Unplugging and re-plugging is OK, as long as at least 1 device remains plugged in.
  3. If at some point 0 devices are plugged in, no newly plugged in devices are recognized and the USB port seems dead (until reboot).

This issue seems similar to this question. However here there seems to be an OTG issue. I have tried setting the dr_mode to host (although this only seems to be affecting the host/peripheral behavior ).


We have a couple of questions regarding this issue:

  1. Is this the expected behavior?
  2. How come that the development board does not have this issue when SODIMM_185 and SODIMM_187 jumpers are connected. It seems that this only connects a USB hub, which is similar to our case where we connect a USB hub.
  3. Is there a software fix, or should be implement a hardware fix?

Greetings @StevenMedusa!

SODIMM_185 and SODIMM_187 are connected to the second USB port of the Verdin Development Board, which is host-only. You say that you’re using the USB_1 port, which has dual host/OTG role.

I’m going to try to reproduce your issue, but I’ve got some questions:

  1. Does this issue appears only when a USB hub is connected to USB_1? That is, does connecting a device directly - no hub - to the USB_1 port work?
  2. Is your hub always detected on that port or does it also die eventually?

Hi @gustavo.tx,

Thank you for your response. To answer your questions:

  1. This issue also appears if you directly connect something to USB_1. So if you start the device will get recognized, but once you have unplugged it the USB port becomes dead.
  2. The hub has the similar behavior as the devices: it is detected during boot, however after a point where no devices are connected to the hub it does not recognize newly connected devices. The system does not report that the hub becomes disconnected, it just doesn’t trigger when new devices are plugged in.

Does this answer your questions?

@StevenMedusa,

Yes, thank you for the answers! I’ll try to reproduce your issue here on my side and let you know.

@gustavo.tx Did you manage to reproduce the issue?

@StevenMedusa,

Sorry for the delay.

I was able to reproduce the issue. I’ll contact the hardware and the BSP teams to discuss this.

Did you try removing jumper X34? It should be closed for the port to behave as USB host, but does dmesg output anything if you remove/reinsert the jumper?

Hi Steven,

can you share you schematic of you customer board with us?
You can post it here or sent an email to support.eu@toradex.com.

Best Regards,

Matthias Gohlke

Hi,
I want to confirm that I experience the same issue on a Verdin iMx8MM 2GB WB IT on USB_2.
If a device or a hub is connected before startup it works fine but as soon as you reconnect it or connect it during runtime it is not recognised by the module. Using a custom carrier board and Torizon 5.1.0 stable build.

Greetings
Jan

HI @jan380

I was not able to reproduce this issue.

Best regards,
Jaski

I have worked with the USB quite a lot and not noticed this issue, we are currently working on this problem but I think it may be unrelated:
https://toradex.com/community/questions/63535/verdin-8mm-usb-connection-not-working.html?childToView=63604#comment-63604

Hi,

I Have the exact same issue on a custom board, (didn’t try to reproduce it on the development board, but it seems @gustavo.tx succeeded).

We use USB_1 in host mode, result of investigation :
1/ Starting with nothing plugged :
D- is low.
D+ is low.
plugin anything result in D+ going high but no communication at all

2/ Starting with something plugged (usb hub, serial converter, or usb stick in this example) :
We clearly see data on bus.
D- is low (average).
D+ is low (average).
We can browse the usb stick in /media/sdax.
Removing the usb stick and plugin it again give same result as 1/.

3/ Starting with a usb hub plugged and nothing on the hub :
We can see that the usb hub communicate for about a second and then :
D- stay low.
D+ goes high.
Plugin anything on the hub :
D- stay low.
D+ goes low and we can clearly see that the hub communicate, but the device plugged on the hub doesn’t works at all.

4/ Starting with a usb hub plugged and a device plugged on the hub give same result as 2/, but removing the device and plugging it again give result 3/ instead of 1/.

5/ Starting with a usb hub plugged and multiple devices on the hub give same result as 2/ and only if all devices are removed from the hub we fall under 3/.

Relevant device tree :

/* Verdin USB_1 */
&usbotg1 {
	status = "okay";
	dr_mode = "host";
	/delete-property/ hnp-disable;
	/delete-property/ srp-disable;
	/delete-property/ adp-disable;
};

/* Verdin USB_2 */
&usbotg2 {
	status = "disabled";
};

Each time the usb become “dead” dmesg doesn’t fire anything else about usb until reboot (not a power cycle).
Also, for all test, if I start the board and then plug the usb before the kernel completely loads, everything works like if I plugged the usb before starting the board.

Seems like a software issue for me, did you manage to solve this ?

Toradex Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT V1.1A

Linux verdin-imx8mm 5.4.91-5.2.0-devel+git.6afb048a71e3 #1 SMP PREEMPT Wed Apr 7 08:36:44 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

Edit : I found this post : USB autodetect not working - Technical Support - Toradex Community and can confirm that commands uhubctl --reset or usbhid-dump can bring back the usb to life after the boot.

Thanks