When to Use USB OTG
by Yingbo Hu, R&D Embedded Software Engineer
The USB On-The-Go (OTG) Supplement addresses the need for mobile interconnectivity between portable devices when a PC is not available. Many people think that they need OTG when they need both USB host and device functionality on the same device. That is not correct.
OTG provides the capability to switch the roles of a USB controller between USB host and USB device ( aka “peripheral”). These two roles cannot work simultaneously. If your system needs one port to work as a USB host and, at the same time, another port to work as a USB device, then OTG will not help because OTG is only for one port. For this case, you need to find a processor which has both USB a host and a device controller that can work simultaneously. For example, Atmel AT91SAM9260/61/63/XE or NXP LPC2468/2478/3180 do this. Some external USB controller chips also provide both host and device controllers, such as NXP ISP1161/1362/1761. You also need a USB host stack and a USB device stack that can work together, such as smxUSBH and smxUSBD. In this case, you need two USB ports on your device. One is dedicated for USB host and the other is dedicated for USB device.
OTG requires both ends of a USB cable to be OTG-compatible. Otherwise your device cannot switch roles. For example, if you need your device to read some files from a USB flash disk and then connect to PC to work as a USB modem, then OTG will not help because normal flash disks and PCs do not support OTG. (PCs provide only USB host connectors.) For that case, because you do not need USB host functions and device functions, at the same time, you can use the USB host stack when you need USB host functions and the USB device stack when you need USB device functions. You can use one USB port to achieve this. For example, on NXP 1362/1761, you can use Port 1 to work as both USB host and device, but not at the same time. The ID pin of the mini-AB receptacle will automatically route the desired port to the correct controller. The only thing you need to do is to use different USB cables, which is reasonable since you cannot use the same cable to connect your device to both a flash disk and to a PC USB host port.
The only case where you really need OTG is when you need to connect two USB devices together with one USB cable and switch the USB roles of these two devices while connected. For example, connecting two MP3 players together to exchange songs between them requires OTG.
For More Information
- smxUSBD Datasheet
- smxUSBH Datasheet
- smxUSBO Datasheet
Please contact me with any comments or questions about this article.
Yingbo Hu
yingbohu @ smxrtos.com
R&D Embedded Software Engineer
Micro Digital Inc
(714) 437-7333
Copyright © 2008 by Micro Digital, Inc. All rights reserved.
smx is a registered trademark of Micro Digital Inc. smx product names are trademarks of Micro Digital Inc.
10/24/08
back to White Papers page
|