USB On-The-Go

USB On-The-Go logo

USB On-The-Go, often abbreviated to USB OTG or just OTG, is a specification first used in late 2001, that allows USB devices such as digital audio players or mobile phones to act as a host, allowing other USB devices like a USB flash drive, digital camera, mouse, or keyboard to be attached to them. Use of USB OTG allows these devices to switch back and forth between the roles of host and client devices. For instance, a mobile phone may read from removable media as the host device, but present itself as a USB Mass Storage Device when connected to a host computer.

In other words, USB On-The-Go introduces the concept that a device can perform both the master and slave roles  whenever two USB devices are connected and one of them is a USB On-The-Go device, they establish a communications link. Whichever device controls that link is called the master or host, while the other is called the slave or peripheral.

Overview

Standard USB uses a master/slave architecture; a host acts as the master device for the entire bus, and a USB device acts as the slave. Devices are designed from the start to act in one role or the other  computers are generally set up to be hosts, while printers (for instance) are normally slaves.

When a device is plugged into the USB bus, the master device, or host, sets up communications with the device and handles service provisioning (the host's software enables or does the needed data handling such as file managing or other desired kind of data communication or function). The host is responsible for all data transfers over the bus, with the devices only able to signal, when polled, that they require attention. To transfer data between two devices, from a phone to a printer for instance, the host first reads the data from one device then writes it to the other. This allows the devices to be greatly simplified compared to the host; a mouse, for instance, contains very little logic and relies on the host to do almost all of the work.

While the master/slave arrangement works for some devices, there are many devices that might want to act as a master or a slave depending on who else shares the bus. For instance, a computer printer is normally a slave device, but when a USB flash drive of images is plugged into the USB port of the printer with no computer present (or at least turned off) it would be useful for the printer to take on the role of host, allowing it to communicate with the flash drive directly and print images from it.

USB On-The-Go introduces the concept that a device can perform both the master and slave roles, and so subtly changes the terminology. With OTG, a device can be either a host when acting as the link master, or a peripheral when acting as the link slave. The choice of whether to be host or peripheral is handled entirely by which end of the cable the device is plugged into. The device connected to the "A" end of the cable at start-up, known as the "A-device", acts as the default host, while the "B" end acts as the default peripheral, known as the "B-device".

After initial startup, setup for the bus operates as it does with the normal USB standard, with the A-device setting up the B-device and managing all communications. However, when that same A-device is plugged into another USB system, or a dedicated host becomes available, it may become a slave.

USB On-The-Go does not preclude using a USB hub, but it describes host/peripheral role swapping only for the case of a one-to-one connection where two OTG devices are directly connected. Role swapping does not work through a standard hub, as one device will act as the host and the other as the peripheral until they are disconnected.

Specifications

USB OTG is a part of a supplement[1] to the Universal Serial Bus (USB) 2.0 specification originally agreed upon in late 2001 and later revised.[2] The latest version of this supplement also defines behavior for an Embedded Host which has targeted abilities and the same USB Standard-A port used by PCs.

SuperSpeed OTG devices, Embedded Hosts and peripherals are supported through the USB On-The-Go and Embedded Host Supplement[3] to the USB 3.0 specification.

Protocols

The USB On-The-Go and Embedded Host Supplement to the USB 2.0 specification introduced three new communication protocols:

The main purpose of HNP is to accommodate users who have connected the A and B devices (see below) in the wrong direction for the task they want to perform. For example, a printer is connected as the A-device (host), but cannot function as a host for a particular camera, since it doesn't understand the camera's representation of print jobs. When that camera knows how to talk to the printer, the printer will use HNP to switch to the slave role, making the camera the host to the printer so that the user's pictures will get printed without juggling cables. These new OTG protocols cannot pass through a standard USB hub since they are based on physical electrical-signaling.

The USB On-The-Go and Embedded Host Supplement to the USB 3.0 specification introduces an additional protocol, Role Swap Protocol (RSP). This achieves the same purpose as HNP (i.e. role swapping) by extending standard mechanisms provided by the USB 3.0 specification. Products following the USB On-The-Go and Embedded Host Supplement to the USB 3.0 specification are also required to follow the USB 2.0 supplement in order to maintain backwards compatibility. SuperSpeed OTG devices (SS-OTG) are required to support RSP. SuperSpeed Peripheral Capable OTG devices (SSPC-OTG) are not required to support RSP since they can only operate at SuperSpeed as a peripheral; they have no SuperSpeed host and so can only role swap using HNP at USB 2.0 data rates.

Device roles

USB OTG defines two roles of devices: OTG A-device and OTG B-device. This terminology defines which side supplies power to the link, and which is initially the host. The OTG A-device is a power supplier, and an OTG B-device is a power consumer. The default link configuration is that the A-device acts as USB Host and the B-device is a USB peripheral. The host and peripheral modes may be exchanged later by using HNP. Because every OTG controller supports both roles, they are often called "Dual-Role" controllers rather than "OTG controllers".

For integrated circuit (IC) designers, an attraction of USB OTG is the ability to get more USB capabilities with fewer gates. A "traditional" approach includes four controllers:

This means many gates to test and debug. Also, most gadgets must be a host only, or a device only. OTG hardware design merges all of these controllers into one dual-role controller that is somewhat more complex than an individual device controller.

Targeted peripheral list

The targeted peripheral list or TPL applies to all targeted hosts which includes both OTG devices acting in a host role and embedded hosts. The aim of the TPL is for a manufacturer to list products supported by the targeted host in order to define what it needs to support in terms of output power, speeds, protocols and device classes. The TPL is intended such that hosts can be "targeted" at a particular product or application rather than being forced to be general purpose hosts like a PC.

Plug

Standard, mini, and micro USB plugs (not to scale). The white areas in these drawings represent hollow spaces. As the plugs are shown here, the USB logo (with optional letter A or B) is on the top of the overmold in all cases. Pin numbering looking into receptacles is mirrored from plugs, such that pin 1 on plug connects to pin 1 on the receptacle.

OTG mini plugs

The original USB On-The-Go standard introduced a plug receptacle called mini-AB that was replaced by micro-AB in later revisions (Revision 1.4 onwards). It could accept either a mini-A plug or a mini-B plug, while mini-A adapters allowed connection to standard-A USB cables coming from peripherals. The standard OTG cable had a mini-A plug on one end and a mini-B plug on the other end (it could not have two plugs of the same type).

The device with a mini-A plug inserted became an OTG A-device, and the device with a mini-B plug inserted became a B-device (see above). The type of plug inserted was detected by the state of the ID pin (the mini-A plug had the ID pin grounded while the ID pin in the mini-B plug was floating).

Pure mini-A plugs also existed, used where a compact host port was needed but OTG was not supported.

OTG micro plugs

With the introduction of the USB micro plug, a new plug receptacle called Micro-AB was also introduced. It can accept either a Micro-A plug or a Micro-B plug. Micro-A Adapters allow for connection to Standard-A plug type USB cables, as used on standard USB 2.0 Devices. An OTG product must have a single Micro-AB receptacle and no other USB receptacles.[4][5]

An OTG cable has a micro-A plug on one end, and a micro-B plug on the other end (it cannot have two plugs of the same type). OTG adds a fifth pin to the standard USB connector, called the ID-pin; the micro-A plug has the ID pin grounded, while the ID in the micro-B plug is floating. A device with a micro-A plug inserted becomes an OTG A-device, and a device with a micro-B plug inserted becomes a B-device. The type of plug inserted is detected by the state of the pin ID .

Three additional ID pin states are defined[4] at the nominal resistance values of 124 kΩ, 68 kΩ, and 36.5 kΩ, with respect to the ground pin. These permit the device to work with USB Accessory Charger Adapters that allows the OTG device to be attached to both a charger and another device simultaneously.[6] These three states are used in the cases of:

USB 3.0 introduced a backwards compatible SuperSpeed extension of the Micro-AB receptacle and Micro-A and Micro-B plugs. These contain all pins of the USB 2.0 Micro and use the ID pin to identify the A-device and B-device roles. They also add the SuperSpeed pins.

Smartphone and tablet implementation

BlackBerry 10.2 implements Host Mode (like in the BlackBerry Z30 handset).[7] Nokia has implemented USB OTG in many of their Symbian cellphones such as Nokia N8, C6-01, C7, Oro, E6, E7, X7, 603, 701 and 808 Pureview. Some high-end Android phones produced by HTC,[8] Samsung[9] & Sony under Xperia series[10] also have it.

Android version 3.1 or newer supports USB On-The-Go, but not on all devices.[11][12]

In many of the above implementations, the host device has only a micro-B receptacle rather than a micro-AB receptacle. Although nonstandard, micro-B to micro-A receptacle adapters are widely available and used in place of the mandated micro-A receptacle on these devices.

OTG micro cables

A micro USB OTG adapter

When attached to a PC, an OTG device requires a cable which has a USB Standard-A plug on one end and a Micro-B plug on the other end. In order to attach a peripheral to an OTG device, the peripheral either needs to have a cable ending in a Micro-A plug, which is inserted into the OTG device's Micro-AB receptacle, or the OTG device itself needs an adapter cable which has a Micro-A plug on one end and a Standard-A receptacle on the other. The adapter cable enables any standard USB peripheral to be attached to an OTG device. In order to attach two OTG devices together requires either a cable with a Micro-B plug at one end and a Micro-A plug at the other or can be achieved using a combination of the PC cable and adapter cable.

Backward compatibility

USB OTG devices are backward-compatible with USB 2.0 (USB 3.0 for SuperSpeed OTG devices) and will behave as standard USB hosts or devices when connected to standard (non-OTG) USB devices. The main exception is that OTG hosts are only required to provide enough power for the products listed on the TPL, which may or may not be enough to connect to a peripheral which is not listed. A powered USB hub may sidestep the issue, if supported, since this will then provide its own power according to either the USB 2.0 or USB 3.0 specifications.

Some incompatibilities in both HNP and SRP were introduced between the 1.3 and 2.0 versions of the On-The-Go supplement which may lead to interoperability issues when using these protocols.

Charger compatibility

Some devices can charge their battery via their USB port, while others can even detect a dedicated charger and draw more than 500 mA, which allows them to charge faster. OTG devices are not excluded from either of these options.[6]

See also

References

  1. On-The-Go and Embedded Host Supplement to the USB 2.0 Specification Revision 2.0 plus ECN and errata, July 14, 2011
  2. USB-On-the-Go-Specification Settled. Heise.de, Heinz Heise.
  3. On-The-Go and Embedded Host Supplement to the USB 3.0 Specification Revision 1.0, July 1, 2011
  4. 4.0 4.1 "Universal Serial Bus Revision 2.0 specification". On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification, Revision 2.0 version 1.1a. USB Implementers Forum, Inc. July 27, 2012. Retrieved 21 April 2013.
  5. "Universal Serial Bus Revision 2.0 specification". Universal Serial Bus Micro-USB Cables and Connectors Specification, Revision 1.01. USB Implementers Forum, Inc. 4 April 2007. Retrieved 21 April 2013.
  6. 6.0 6.1 6.2 6.3 6.4 "Battery Charging Specification". USB Implementers Forum, Inc. 15 April 2009. Retrieved 23 September 2009.
  7. KB34983-Support for USB Embedded Host mode on BlackBerry 10 OS version 10.2
  8. USB On the Go | HTC Blog
  9. Samsung Galaxy S II Able To Use Standard USB OTG Cable For USB On-The-Go Access | TalkAndroid.com
  10. Xperia S USB OTG demonstrated Video | Xperia Blog
  11. "Android Issue 738: I hope Android will implement and support the USB host feature". Google.com. 2008-05-30. Retrieved 2013-05-30.
  12. "USB Host – Android Developers". developer.android.com. 2013-05-30. Retrieved 2013-05-30.

External links