There are two roles for the Host device and Peripheral devices when using the traditional design of USB: one is a host and the other is the Peripheral device. Conventional USB devices, such as PCs and printers, are often referred to as hosts and peripherals, respectively. Peripheral capabilities, which allow data transfer between PCs and cell phones, are present in many smartphones. Due to their dual role as peripherals, printers were unable to connect easily to such phones. USB OTG immediately addresses this problem.
Using USB OTG, a USB OTG device can simultaneously serve as a host and a peripheral. This provides additional versatility. The link is controlled by the Host device, whereas the Peripheral devices are those that are controlled by the Host device, according to this definition.
Depending on which side of the link provides power and serves as the first host, USB OTG assigns one of two roles: OTG A-device or OTG B-device. A device that provides electricity, and a device that consumes it, are two separate OTG devices. The A-device serves as a USB host, while the B-device acts as a USB peripheral in the normal link configuration. At a later date, it is possible to switch between host and peripheral modes through the Host Negotiation Protocol (HNP).
Protocols
Three additional communication protocols were introduced with the USB OTG and Embedded Host Supplement to the USB 2.0 specification:
- Attach Detection Protocol (ADP): It is necessary for an OTG device, embedded host, or a USB product to be powered up on the USB bus in order to enable both insertion-based behavior and the ability to indicate attachment status with an ADP-capable device. The USB port’s capacitance is constantly checked to see if another device is plugged in, if a cable is dangling, or if none is present at all. An A-device powers the USB bus when a significant change in capacitance is detected, indicating the presence of an attached device. Waiting B-devices generate the SRP when the USB bus is not yet powered on (see image below)
- SRP (Session Request Protocol): An SRP (Session Request Protocol) is a protocol used to request a session. With this protocol, the link’s active power session can be managed by both of the communicating devices instead of just one. Accurate regulation of power usage is critical for battery-operated equipment, such as cameras and mobile phones. OTG or embedded hosts can keep the USB unpowered for as long as the peripheral (either an OTG or a standard USB device) requires it to function properly. These devices’ batteries can last longer because of the lower power consumption of USB-powered OTG and embedded hosts
- The Host Negotiation Protocol allows two OTG dual-role devices to transition between host and peripheral functions (HNP). By flipping the roles of the host and peripheral, the USB OTG device can take over control of data transfer scheduling using the HNP protocol. The USB OTG bus allows data transmission from any OTG device connected to it. New features have been added to the newest version of HNP polling, which lets host devices regularly ask peripherals whether they want to become hosts
Human Networking Protocol (HNP): The primary purpose of this feature is to assist users who connect the A and B devices in the wrong direction. In order to use a printer attached as the A-device (host) to serve as the host for a specific camera, the printer cannot grasp the camera’s representation of print jobs. Using HNP, the printer may be set up as a slave and the camera as the host, allowing you to print photos directly from the camera without having to reconnect the printer’s wires. When used with the current generation of OTG protocols, a conventional USB hub will not work because of the electrical signalling required by the OTG protocols
Device roles
Depending on which side of the link provides power and serves as the first host, USB OTG assigns one of two roles: OTG A-device or OTG B-device. A device that provides electricity, and a device that consumes it, are two separate OTG devices. The A-device serves as a USB host, while the B-device acts as a USB peripheral in the normal link configuration. At a later time, you can use the HNP or RSP instructions to swap between host and peripheral modes. In contrast to the plethora of “OTG controllers,” which can each perform both functions, there is a slew of “Dual-Role” controllers available.
The USB OTG feature is greatly sought after by IC designers because it enables them to include more USB capabilities while using fewer gate counts on their designs.
In the “standard” technique, four controllers are employed; as a result, there are more gates to test and debug:
- USB high-speed host controller based on the EHCI standard (a register interface)
- Full/low-speed host controller based on the OHCI protocol (another register interface)
- USB device controller with the high-speed and full-speed operation
- A fourth controller is required for the purpose of switching the OTG root port between the host and device controllers, respectively
However, the majority of gadgets are either hosts or devices. A dual-role device controller, which is more advanced than a single controller, must be created by combining all the controllers.
Conclusion
When other USB devices, such as tablets and smartphones, function as hosts and connect through a USB cable to USB On-The-Go (sometimes referred to as USB OTG or just OTG). When it was initially released in 2001, it has remained in use ever since. To start a session, the Session Request Protocol (SRP) is invoked. For as long as the peripheral needs USB to function, the OTG or embedded host can leave it unpowered. The longer battery life is made possible via USB-powered OTG and embedded hosts’ reduced power usage.