USB On-The-Go (OTG) is a specification that allows portable USB devices to be cabled together without a computer. When using the standard USB protocol, one device, most commonly a computer, will always be the host, and the other device will always be the peripheral. With a USB OTG cable, both devices can act as either a host or peripheral, allowing for interaction between two traditionally peripheral devices. Three new communication protocols have been introduced to the USB 2.0 specification with the advent of USB OTG: Attach Detection Protocol (ADP), Session Request Protocol (SRP), and Host Negotiation Protocol (HNP). Role Swap Protocol (RSP) has been introduced to the USB 3.0 specification.
USB OTG enables devices to act as both a host device and a peripheral device. When two devices are cabled together with an OTG cable, a communication link is formed. Through this, a negotiation takes place to assign one device as the host and the other a peripheral. With Attach Detection Protocol (ADP), USB OTG devices are able to detect if another device has been connected to the port, even when the bus isn’t powered, by measuring capacitance. Once attachment is recognized as a result of change in capacitance, the A-device, or the initial host, will provide power to the bus and establish a device connection. Meanwhile, the B-device, or the initial peripheral, will generate Session Request Protocol (SRP) and wait for the device to become powered. This allows both devices in the communication link to control when the power session is active. Traditionally when using USB, only the host device can do this. SRP is integral in extending battery runtime because the communication link can remain unpowered until the peripheral device requires power.
Traditional USB OTG devices use micro-AB receptacles that are designed to accommodate both micro-A and micro-B plugs. A USB OTG cable typically features a Standard-A plug on one end and a micro-B plug on the other, however a cable can include a Standard-B plug and micro-A plug as well.
Both plugs include an ID pin, which is essential for determining the roles of the connected devices, including which will act as the host and which will function as the peripheral. The Standard-A plug has a grounded ID pin. The device it is attached to will be designated as an OTG A-device, which will act as a USB host to supply power and manage the data transfers. The micro-B plug has a floating ID pin. The device attached to this plug will be designated as an OTG B-device, where it will become a USB peripheral and consume power and respond to the host’s commands.
With the introduction of USB Type-C, OTG technology has evolved to become more integrated, as the reversible USB-C connector and USB Power Delivery protocol enable devices to negotiate roles as host or peripheral without relying on dedicated OTG cables or adapters. Unlike prior standards that required a micro-AB receptacle for dual role functionality, USB-C to USB-C cables inherently enable this functionality to seamlessly switch between host and peripheral roles. USB-C cables do not have an ID pin; instead, they use the Configuration Channel (CC) pins to determine the roles of the connected devices as host or peripheral. This negotiation process replaces the traditional Host Negotiation Protocol (HNP) designed for micro-USB devices and is managed through the USB Type-C specification and USB Power Delivery protocols. For those needing to connect USB-C devices to devices using legacy USB ports for OTG functionality, adapters or cables with OTG support are required.
The role of “host” and “peripheral” can be switched between each USB OTG device using Host Negotiation Protocol (HNP) for USB 2.0 specification, and Role Swap Protocol (RSP) for USB 3.0 specification. With HNP in USB OTG, either device can gain control and start a data transfer, even if it is traditionally a peripheral device. With HNP polling, the host device will periodically check if the peripheral wants to become the host. This streamlines communication, because a fluid exchange of information can happen between both devices, rather than communication only taking place in one direction as it would in standard USB. Role Swap Protocol (RSP) achieves the same purpose as HNP using the USB 3.0 specification, and maintains backward compatibility for USB 2.0 specifications. SuperSpeed, or USB 3.0 OTG devices, are required to support RSP. More information on USB specifications and their signaling rates can be found in this blog: “About the USB Protocol, Common USB Bus Errors, and How to Troubleshoot Them”.
Connecting peripheral devices to a smartphone: as smartphones have advanced, they are increasingly taking the place of computers in many instances and have become a fundamental part of our daily lives. There are many scenarios where you might want to use your smartphone for things previously done with a computer, especially because this can be done anywhere, or “on-the-go”. With a USB OTG cable, smooth data transfers are possible between a smartphone and other peripherals, including connecting:
Charging devices: with a USB OTG cable, one device can be charged from the battery of another device. It’s important to note that this will deplete the battery of the host device at a normal speed, while the charging of the peripheral device will be slower than usual. However, in a pinch, this functionality is very useful when on the go and without access to a charger and/or outlet. Most commonly, you would use a phone to charge another peripheral device, including charging:
Debugging and optimizing performance of USB devices is crucial for seamless OTG use. Total Phase offers a variety of USB protocol analyzers that support different speed and debugging requirements. The Beagle protocol analyzers are fully compatible with USB OTG, and the Data Center Software will properly display HNP and SRP events.
The Beagle USB 12 Protocol Analyzer non-intrusively monitors Full-/Low-Speed USB traffic at up to 12 Mbps, and includes real-time USB descriptor parsing. Developers can monitor what is happening on the bus as it happens with 21 ns resolution.
The Beagle USB 480 Protocol Analyzer non-intrusively monitors High-/Full-/Low-Speed USB 2.0 traffic at up to 480 Mbps. This analyzer captures and interactively displays High-speed USB bus states and traffic in real time with 16.7 ns resolution, with real-time USB class-level decoding.
The Beagle USB 480 Power Protocol Analyzer – Ultimate Edition non-intrusively monitors High-/Full-/Low-Speed USB 2.0 traffic at up to 480 Mbps. This analyzer enables VBUS current and voltage measurement within the Data Center Software, and includes enhanced USB 2.0 advanced triggering, an extra-large hardware buffer, and real-time USB class-level decoding.
The Beagle USB 5000 v2 SuperSpeed Protocol Analyzer – Ultimate Edition is a world-class USB 3.0 bus monitor that provides real-time interactive capture and analysis of USB 3.0 and USB 2.0 traffic. This analyzer non-intrusively monitors SuperSpeed/High-/Full-/Low-Speed traffic at up to 5 Gbps. It offers real-time USB class-level decoding, LFPS polling, and detection of USB 3.0 link training and LTSSM.
Need further help determining the right USB analyzer for your requirements? Take a look at our USB Analyzer Guide.
If you have any additional questions about which USB protocol analyzer is right for you, or are interested in our products that support I2C, SPI, eSPI, and CAN protocols, email us at sales@totalphase.com or request a demo.