USB (Universal Serial Bus) is an industry-standard used to specify cables, connectors, and protocols that are used for communication between electronic devices.
- Self-configuring interface, no need for user configuration of speed, data protocol, etc.
- Capable of supplying power to small auxiliary devices
- Various communication speeds are supported
- Standard connectors
- Error checking increases the communication reliability
- Limited cable length
- The communication is always between the host and the device, no device-to-device communication
The USB specification has been consistently updated through the years. The need for faster communication is usually the driving force, as a higher data rate expands the applications of the USB bus.
|Mode||Abbrev||Gross data rate/ Speed||Version|
|Low speed||LS||1.5 Mbit/s (187KB/s)||USB 1.0|
|Full speed||FS||12 Mbits/s (1.5 MB/s)||USB 1.0|
|High speed||HS||480 Mbits/s (60 MB/s)||USB 2.0|
|Super speed||SS||5 Gbits/s (625 MB/s)||USB 3.0|
|Super speed +||SS+||10 Gbits/s (1.25 GB/s)||USB 3.1|
|Super speed +||SS+||20Gbits/s (2.5 GB/s)||USB 3.2|
Cables and Signals
USB v2.x standard limits the maximum cable length to 5 meters, while USB v3.x has a recommended cable length of 3 meters. In practice, it’s better to choose a shorter cable length if you are using high-speed data transfers. For longer distances, self-powered USB hubs or active (repeater) extension cables should be used.
USB v2.x uses four wires:
- VBUS wire provides power supply (4.40 – 5.25 V) to attached devices
- GND is a ground wire
- D+ and D- wires are used as differential serial data line that functions at 3.3 V. The differential pair helps with rejecting common-mode noise. The transmitted data is encoded using NRZI.
USB v3.x adds 5 additional wires for a total of 9 wires. The additional wires are:
- SSTX- and SSTX+ used for SuperSpeed transmit operation
- SSRX- and SSRX+ used for SuperSpeed receive operation
- GND_DRAIN used an additional ground wire
USB On-The-Go (OTG) functionality requires one additional wire (signal) called ID.
USB Connector Types
There are many USB connectors with various form factors. Most of them were introduced as the USB standard progressed and new functionality and higher speeds were required. As an example, we can see in the figure below, that connectors for USB 3.x have more pins compared with USB 1.x/2.x.
Physical Bus Topology
The USB physical bus has a tiered star topology. There is a single host controller (master) and up to 127 devices (slaves). The maximum number of devices is limited by the 7-bit address field. Keep in mind that the hubs on the bus also take up address space. For example, if we have 20 hubs, then we end up with a maximum possible number of user devices 127 – 20 = 107.
Devices are attached to the host controller. As the host is the only master, the devices respond to its commands when addressed. A USB device is expected to implement some kind of functionality (e.g keyboard, mouse, etc.).
A USB hub is a “transparent” device. It lets information pass-trough using one upstream port and up to 7 downstream ports. Due to time constraints and delays introduced by hubs and cables, a maximum of five hubs can be chained one after another (daisy-chained). This results in a limitation of having only seven tiers (layers) in a USB network (as shown in Figure 2). The host is always Tier 1, hubs can be chained from tier 2 to tier 6.
Logical Bus Topology
The logical bus topology is the way the host software views and communicates with the devices connected on the physical bus. From the host’s point-of-view, all devices are directly connected to the root hub (an embedded hub part of the host controller).
All transfers on the USB bus are initiated by the host. For USB 1.x/2.x the data is exchanged only in one direction at a time (half-duplex). The host either transmits or receives. Starting from USB 3.x a full-duplex data flow is supported, meaning that data can be sent and received simultaneously.
Data is transferred using pipes that connect memory buffers in the host with endpoints in a USB device.
An endpoint is a hardware buffer in a USB device. It is uniquely identifiable and is at the end of the USB communication channel. An endpoint has a direction and it can be either IN (transfer to the host) or OUT (transfer from the host). A USB device can have up to 32 endpoints, although most devices have less than five. An endpoint can be a control or a data endpoint.
A Pipe is a communication channel that connects the host with a device’s endpoint. It is purely a logical connection (software on the host side), as the physical connection is always made using the wires (signals) we described in Cables and Signals.