Search by Tags

USB On-The-Go

 

Article updated at 20 Jul 2018
Compare with Revision




All Colibri modules have one port which can work either in USB host or in USB function mode (also known as Client mode). This is not a full support of all USB On-The-Go (OTG) features, but it is possible to switch between host and function mode at runtime, without reboot.

Colibri PXA Modules

The Colibri PXA modules automatically select between host and function mode, depending on the USB cable detect pin. For details, refer to the following article:

USB client driver registry settings

Colibri Tegra Modules

Switch manually

The port is working in function mode by default. To activate the host mode, add the following registry settings:

[HKLM\Drivers\BuiltIn\USBEHCI1]
Dll="libnvusbh.dll"                         ;activate USBEHCI1 driver
[HKLM\Drivers\BuiltIn\USBFN]
Dll="_libnvusbfn.dll"                       ;deactivate USBFN driver

Don't forget to save the registry before rebooting the module.

Enable Automatic Switching between USB Host and USB Function

Automatic switching between USB host and function is supported in image V1.2 and later for Colibri Tegra T20 modules. On Colibri and Apalis T30 you need to manually switch as described above.

To enable the automatic switching, disable USBFN and USBEHCI1, enable USBOTG instead. This can be achieved by a few registry settings:

[HKLM\Drivers\BuiltIn\USBEHCI1]
Dll="_libnvusbh.dll"                       ;deactivate USBEHCI1 driver
[HKLM\Drivers\BuiltIn\USBFN]
Dll="_libnvusbfn.dll"                      ;deactivate USBFN driver
[HKLM\Drivers\BuiltIn\USBOTG]
Dll="libnvusbotg.dll"                      ;activate USBOTG driver

Depending on the hardware layout some additional settings are needed in order to make the OTG switch working stable:

[HKLM\Drivers\BuiltIn\USBOTG]
DebounceDelay=dword:50                   ;Delay to OTG driver waits for settling the CableDetectPin
                                         ;before switching between Host <-> Client in ms. Default: 50ms 
USBFNUnloadDelay=dword:10                ;Delay before unloading USBFn after level change is detected 
                                         ;on CableDetectPin in ms. Default: 10ms

Don't forget to save the registry before rebooting the module.

Colibri and Apalis IMX6 modules

It is possible to force the usb on-the-go port to behave only as host or as client by changing some registry entries.

First of all, USB on-the-go must be disabled. Change the following entry:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\UsbOtg]
“Dll” = “_fsl_usbotg.dll”

To enable host change those entries:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\HCD_HSH2]
"Dll"="hcd_hsotg.dll" 

To enable client:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\UFN]
"Prefix"="UFN"
"Dll"="usbfn.dll"

It's obviously not possible to enable host and client at the same time. You will need to save registry and reboot to apply those changes.

There are basically two hardware configurations for the USB OTG, which should be handled differently.

In both configurations the 5V USB power is controlled by a Power Enable (PE) pin:

  1. Micro-USB connector with ID pin When idle, the 5V must be off! Otherwise we generate a short circuit as soon as we connect a PC to the Micro-USB. This means that while idle either the client driver is active, or no driver at all. Only when the ID pin is shorted to GND, we switch to the host driver and turn 5V on.
  2. Separate USB Host(A) / USB Client(B) Connector When idle, the 5V must be on! Otherwise we cannot detect when someone connects a USB device This means that while idle the host driver is active Only when the 5V-input of the USB Client connector is detected, we switch to the client driver. Both hardware configurations are implemented on the Colibri Evaluation Board.

There is a registry setting to switch between the behaviors:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\USBOTG] 
"CableDetectPol"=dword:0x00000001 ;default 1 

On the Module we only have one pin to detect the host/client status. Default is, that we detect the 5V connected to a USB client(B) connector (CableDetectPol=1). The alternative configuration is to detect an ID pin pulled to GND (CableDetectPol=0)

Colibri VF50/VF61 modules

It is possible to force the usb on-the-go port to behave only as host or as client by changing some registry entries.

First of all, USB on-the-go must be disabled. Change the following entry:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\USBOTG]
"Dll"="_otg_vybrid.dll"

To enable host change those entries:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\HCD_HSH2]
"Dll"="hcd_hsh1.dll"

To enable client:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\UFN]
"Dll"="usbfn.dll"

It's obviously not possible to enable host and client at the same time. You will need to save registry and reboot to apply those changes.