USB Protocol : Architecture, Working, Synchronisation, DataFormat & Its Applications

The USB protocol or universal serial bus was first developed and launched by Ajay V.Bhatt from Intel in the year 1996. This USB is replaced different kinds of serial & parallel ports for transferring data in between a computer as well as different peripheral devices like scanners, printers, keyboards, gamepads, digital cameras, joysticks, etc. This article discusses an overview of what is a USB protocol – working with applications.


What is USB Protocol?

A common interface that is used to allow communication between different peripheral devices like mice, digital cameras, printers, keyboards, media devices, scanners, flash drives & external hard drives as well as a host controller like a smartphone or PC is known as USB protocol.

A universal serial bus is intended to allow hot swapping & enhance plug-N- play. The plug-and-play allows the OS to configure and discover a new peripheral device spontaneously without starting the computer whereas hot swapping removes and replaces a new peripheral device without rebooting.
There are different types of USB connectors available in the market where Type A and Type B are the most frequently used ones. At present, older connectors are replaced by Mini-USB, Micro-USB & USB-C cables.

Pin Configuration

The typical Type-A USB connector is used in various applications. These USBs include 4 pins that are given below. This type of USB is observed mostly in connecting various devices to PC because it is the typical four-pin USB connector. This connector is taller and narrower including 4-pins arranged within a box.

Type-A USB Connector Pin Configuration
Type-A USB Connector Pin Configuration

The pins of Type A USB are indicated with color wires to perform a particular function.

  • Pin1 (VBUS): It is a red color wire, used for providing power supply.
  • Pin2 (D-): It is a differential pair pin available in white color, used for connectivity of USB.
  • Pin3 (D+): It is a differential pair pin available in green color, used for connectivity of USB.
  • Pin4 (GND): It is a Ground pin, available in black color.

In the above pins, both the D+ & D- pins indicate the transfer of data. When a ‘1’ is sent across the wires, then the D+ line will have positive flow, and if ‘0’ is sent then the reverse happens.

USB Protocol Architecture

The architecture of the USB protocol is shown below. Once various I/O devices are connected through USB to the computer then they all are structured like a tree. In this USB structure, every I/O device will make a point-to-point connection to transmit data through the serial transmission format.

In this architecture, I/O devices are connected to the computer through USB which is called as a hub. The Hub within the architecture is the connecting point between both the I/O devices as well as the computer. The root hub in this architecture is used to connect the whole structure to the hosting computer. The I/O devices in this architecture are a keyboard, mouse, speaker, camera, etc.

USB Protocol Architecture
USB Protocol Architecture

How Does The USB Protocol Work?

The USB protocol simply works on the polling principle because, in polling, the processor continuously checks whether the input/output device is prepared for transmitting data or not. Thus, the I/O devices do not have to update the processor regarding their conditions because it is the main responsibility of the processor to check continuously. So this will make the USB low-cost & simple.

Whenever a new device is allied to the hub then it is addressed like ‘0’. During a normal period, the host computer will poll the hubs to obtain their condition which allows the host to know the I/O devices from the system are attached or detached from the system.

Once the host becomes responsive to the new device then it knows the device capacities by reading the available data within the particular memory of the USB interface of the device. So that the host uses a suitable driver to communicate with devices. After that, the host allocates an address to the new device which is written to the device register. With this device, USB provides plug-and-play features.

This feature simply allows the host to identify the new available I/O device automatically once the device is connected. The I/O capacities of the devices will be determined by host software.

Another feature of the USB protocol is “hot-pluggable” which means, the I/O device is connected or removed from the host system without doing any shutdown or restart. So your system runs continuously when the I/O device is connected or detached.

USB protocol can also support the isochronous traffic wherever the data is transmitted at a preset interval of time. The transmission of isochronous data is very faster as compared to synchronous & asynchronous data transfer.

To hold the traffic isochronous, the root hub transmits a series of bits over the USB that specifies the start of isochronous data & the actual data can be transmitted after this series of bits.

USB Protocol Features

The features of USB include the following.

  • The maximum speed of USB 2.0 is up to 480 Mbps.
  • An individual USB length can reach up to 40 meters including a hub and up to five meters without a hub
  • USB is a plug & play device.
  • It can draw power from a computer or through its own supply.
  • By using a single USB host controller, above 100 peripherals can be connected.
  • The power used by a USB device is up to 5 V & delivers up to 500 mA.
  • Once a computer changes into power-saving mode then some types of USBs convert automatically into sleep mode.
  • A USB includes two wires; one wire is used for power & another is used for carrying the data.
  • At 5V, the computer can provide power up to 500mA on the power wires.
  • Low-power-based devices can draw their power from the USB directly.
  • Two-way communication is possible by using a USB in between the computer & peripheral devices.

USB Standards and Specifications

The specifications of USB will change based on USB standards that include the following.

USB supports three types of speed low speed -1.5 Mbps, Full speed -12 Mbps & High speed – 480 Mbps.

USB 2.0 Standard

  • It is a high-speed USB with 480Mbps of maximum data transfer speed. This USB supports all connectors.
  • The maximum length of the cable is 5 meters.
  • Its max charging power is up to 15w.

USB 3.2 Standard

  • USB 3.2 (Generation1) is a super speed USB with 5Gbps of maximum data transfer speed.
  • It supports different connectors like USB 3 USB-A, USB 3 USB-B & USB-C.
  • The maximum length of cable for this USB is 3 meters.
  • Its max charging power is up to 15w.

USB 3.2 (Generation2)

  • USB 3.2 (Generation2) is also a super speed USB with 10Gbps of maximum data transfer speed.
  • The maximum length of cable for this USB is 1meter.
  • It also supports different connectors like USB 3 USB-A, USB 3 USB-B & USB-C.
  • Its max charging power is up to 100w.

USB 3.2 Generation 2×2

  • USB 3.2 Generation 2×2 is a super speed USB with 20Gbps of maximum data transfer speed.
  • The maximum length of cable for this USB is 1meter.
  • It also supports USB Connector.
  • Its max charging power is up to 100w.

Thunderbolt 3 Standard

  • This USB is also called thunderbolt including up to 40Gbps of maximum data transfer speed.
  • The maximum length of cable for this USB is 2 meters for active and 0.8meters for passive cables.
  • It supports USB Connector.
  • Its max charging power is up to 100w.

USB 4 Standard

  • This USB is also known as Thunderbolt 4 with up to 40Gbps of maximum data transfer speed.
  • The maximum length of cable for this USB is 2m for active & 0.8m for passive cables.
  • It supports USB Connector.
  • Its max charging power is up to 100w.

USB Protocol Timing Diagram

The timing diagram of the USB protocol is shown below which is mainly used in the engineering field to explain the ON/OFF values of USB wires along a timeline.

A ‘1’ specifies no charge and a ‘0’ specifies active. As time grows you can observe the on/off progression. The below system shows Non-Return to Zero Invert (NRZI) encoding which is a more efficient method to transmit data.

USB Timing Diagram
USB Timing Diagram

In the above diagram, bit stuffing is happening which means that logic 1s are added for allowing synchronization. If the data includes several 1s, then the USB cannot synchronize the data. So in this manner, the hardware notices an additional bit & ignores it. It includes overhead to the USB although ensures consistent transfer also.

USB Data Format

In USB protocol, master devices are known as USB hosts which start all the communication that happens above the USB bus. Here, a computer otherwise other controller is usually considered as the master device, so if they request any information they only respond to other devices. The slave device or peripheral is connected simply to the host device which is programmed to provide the host device with the information it requires to operate. In general, slave or peripheral devices mainly include keyboards, mouse of computers, USB flash drives, cameras, etc.

It is very essential for host devices to communicate effectively with each other. Once the peripheral device is connected to the computer through USB, then the computer will notice what type of device it is & load a driver automatically that permits the device to function.

The small amount of data transmitted between the two devices is called as ‘packets’ where a unit of digital information is transferred with every packet. The data transfer that can be occurred within the USB protocol is discussed below.

Message Format

The data of the USB protocol is transmitted within packets LSB first. There are mainly four types of USB packets Token, Data, Handshake & Start of the Frame. Every packet is designed from various field types which are shown in the following message format diagram.

Message Format Diagram of USB
Message Format Diagram of USB

SYNC

In USB protocol, every USB packet will begin with a SYNC field which is normally utilized to synchronize the transmitter & the receiver to transmit the data precisely. In a slow or high-speed USB system, the field like SYNC includes 3 KJ pairs which are followed through 2 K’s to frame 8-bits of data.

In a Hi-Speed USB system, the synchronization needs 15 KJ pairs followed through 2 K’s to frame 32-bits of data. This field is long with 8 bits at high &low speed otherwise 32-bits long for maximum speed & it is utilized to synchronize the CLK of the transmitter & receiver. The final 2-bits will indicate wherever the PID field begins.

Packet Identifier Field or PID

The packer identifier field within the USB protocol is mainly used to recognize the packet type that is being transmitted and thus the packet data format. The length of this field is 8 bits long where the upper 4- bits recognize the kind of packet & lower 4- bits are the bit-wise complement of the upper 4- bits.

Address Field

The address field of the USB protocol indicates which packet device is mainly designated for. The 7-bits length simply allows support of 127 devices. The address zero is invalid because any device which is not yet allocated an address should be reacted to transmitted packets to the zero address.

Endpoint Field

The endpoint field within the USB protocol is 4-bits long & allows for extra flexibility within addressing. Usually, these are divided for the data moving IN/OUT. Endpoint ‘0’ is a special case called as the CONTROL endpoint & each device includes an endpoint 0.

Data Field

The length of the data field is not fixed, so it ranges from 0 to 8192 bits long & always an integral the number of bytes.

CRC Field

The Cyclic Redundancy Checks (CRC) are executed on the data in the packet payload where all the token packets include 5-bit CRC & the data packets include a 16-bit CRC. The CRC-5 is five bits long & used by the token packet as well as the start of the frame packet.

EOP Field

Every packet is terminated by an EOP (End of the Packet) field which includes an SE0 or single-ended zero for 2-bit times followed through the J for 1-bit time.

Synchronized Issues

The commonly faced synchronized issues within USB protocol include the following. Whenever USB devices are developing then USB developer’s experiences commonly face many synchronized issues which are also called communication errors of USB. Some of these errors will cause failures of the system. The following examples are some of the issues with USB bus that can happen:

  • Improper Packet Data & Data Sequencing of USB.
  • Transmissions or Retransmissions of USB.
  • Power or VBUS-based Issues.
  • Troubles through Enumeration.
  • High-speed negotiation Problems.

Advantages

The advantages of USB include the following.

  • Easy to use.
  • For multiple devices, a single interface is used.
  • Its size is compact.
  • Its connector system is robust.
  • These are not expensive.
  • These are available in different sizes with different connectors.
  • Auto configuration.
  • Its expanding is easy.
  • High speed.
  • Reliable and low cost.
  • Power consumption is low.
  • Compatible and durable.

Disadvantages

The disadvantages of USB include the following.

  • Some manufacturers design low-quality USBs with less cost.
  • Its capacity is limited.
  • As compared to other systems, its data transfer is not fast.
  • USB does not give the broadcasting feature, so individual messages are only communicated between the host & peripheral.

Applications

The applications of USB protocol include the following.

  • At present, most of the peripheral devices are connected through a USB to the system like Mouse, Printers, Scanners, Joysticks, Modems, Webcams, Keyboards, Digital cameras, Storage devices, Storage devices, Flight yokes, Network adapters, and data acquisition devices in the scientific field.
  • USB is mainly used in computers on hubs & host controllers
  • UBB Type-B is mostly used to connect compact devices such as mobile phones and USB peripheral devices like printers.
  • It is used most frequently on PCs, video game consoles & smartphones.

Thus, this is an overview of a USB protocol – it’s working with applications. At present, USB simply supports 4-types of transfer modes which are designed for different purposes. The transfer modes are; control, bulk, Isochronous, and interrupt. Here is a question for you, what is the full form of USB?

Add Comment