Good morning,
I have some doubts about how to use USBC line, and how to configure Device Tree to use it correctly.
I work with:
imx6ull trdx module;
colibri evaluation v3 board;
our custom carrier board;
Linux BSP 5.6
Kernel 5.4-2.3
In our custom carrier board we need to use both USBH and USBC lines.
USBH is connected to a usb-hub, while USBC is directly connected to a usb socket because we need to read /save data on a simple usb-stick.
From datasheet I understood that USBC can be used in both USB Host and USB Client modes, but, because we connect a usb-stick, we are working with USB Host mode. Correct?
For that reason I disabled
extcon_usbc_det
node in my Device Tree, to use that pin as standard GPIO.
Problem is that, doing that, I cannot access anymore my usb-stick. I have to maintain it enabled.
extcon_usbc_det uses GPIO5.02 as id-gpio (check imx6ull-colibri-eval-v3.dtsi)
Can someone explain to me why I need to leave that pin with default function? because explanation in datasheet it is not clear to me.
Because the datasheet (page 36) reports that pin Sodimm 137 std function is: USB Client Cable
Detect. But we are using it as host.
Thank you Matthias, but it is not clear to me sorry.
I have already read Design Guide, but I canât figure it how pin 137 works.
On our carrier board we connected pin (sodimm) 137 to a led, because initiatially we wanted to use it as GPIO.
For USB port type A we are using pin 143 and 145 only. What we noticed it that I canât detect a usb key if I disable âextcon_usbc_detâ node in DeviceTree.
If I enable it again, the module is able to detect the usbkey.
How can be possibile?
Attached you can find our schematic, where VBUS is not connected to any Toradex pin. You see we are using only USBC_P and USBC_N pins. GPIO133 is for OverCurrent detection.
USB_C port can be used either as USB host or USB device. The Colibri iMX6ULL module does not support true OTG, but the interface can be configured as host or client. Due to compatibility with other Colibri modules, the current evaluation board and the other Toradex carrier board do not use the USB OTG ID pin to detect whether a Type A or Type B cable is plugged in. Instead, the VBUS is used for detecting the Host or Client mode. 2.3.2.2 USB 2.0 OTG Schematic Example
If no cable is plugged into the Micro-AB jack, the port is configured to host mode and the 5V
power output (VCC_USB2 in the schematic below) is disabled. If a Micro-B is plugged in (ID pin is
floating on such plugs), the VCC_USB2 comes from the cable since the system gets plugged into a
host. With help of the voltage divider, the USB_C_DET signal gets around 3.3V. This signalizes the
module that it has been connected to a host and need to switch to client mode.
From Colibri iMX6ULL datasheet:
137 USB Client CableDetect,SPDIF_OUT SNVS_TAMPER2 gpio5.IO[2]
Use this pin to detect if VBUS is present (5V USB supply). Please note that this pin is only
3.3V tolerant
Even though this is just a regular GPIO, it is recommended to use this one to be compatible with the Toradex BSP
So if you define extcon_usbc_det node USB_C can be used as a host or as device depending on level on GPIO pin gpio5 2 . And to make it enumerate USB stick properly gpio 5 2 (pin 137) must be LOW. When extcon_usbc_det node is not present USB_C is always configured as USB host and able enumerate your USB stick no matter what pin 137 level is.
I donât know what you mean by true OTG, perhaps dedicated real ID pin function instead of GPIO, but Colibri iMMX6ULL USB_C can be used as OTG. On Iris V1.1 it works well, the same as with other Colibries. USB role has to be set to âotgâ in device tree, which is already so by default.
Yes, on Iris 1.1 ID pin (shorted to GND) controls power flow from Iris to flash drive connected to USB micro. USB_C_DET detects connection as slave to USB host. This seems being enough to work as OTG without any additional manipulations in DT or sysfs.
We donât have a dedicated DT for the Iris board. Could you please let me know which DT you are using for the board? Iâm doubtful that USB_C will support dual role without the extcon_usbc_det node in the DT you are using.
Thank you for your feedback. What Alex posted should answer your questions.
I will check internally if we have to add something to our ref. design guide to make it more clear.
If you want we can set up a call and go over your schematic.
Thank you both.
From what I understood so, usbc port needs the ID pin (sodimm 137) to switch between client and host mode.
And because we need it as a Host, we can leave it unconnected (or shorted to ground).
Correct?