The Universal Serial Bus (USB), with its infamous rectangular one-way plug, is indeed the nearly “universal” method for connecting external devices to our desktops and laptops today. In this article, we take a look at the USB: How does it work, why is it better than what we had before, how has it evolved over time, and what can we expect for the future.
As long as computers have existed there has been a need to connect them to input, output, and storage devices. A few such devices may be built into the computer itself, such as hard disks and a video display. All others (printers, camera, network devices, laboratory sensors, etc.) are physically separate and must be connected. Today some of these connections are wireless, but in the past, and still today in most cases, devices are connected to computers by some type of cable.
These cables carry information to and from the device, including data, control signals, and often power. Since we rarely want external devices to be permanently wired to the computer, they are attached by a connector. To avoid the chaos of a separate connector type for each type of device (and each type of computer), standard types have evolved over the years. However, there have been a number of different types, each with their own advantages and drawbacks.
The overall goal of these connection systems is to transfer a stream of data, usually made up of a sequence of 8-bit bytes, from a computer to a device or vice versa. There are two main strategies for doing this:
- Serial connectors use a single data wire to transfer one bit at a time (or possibly one in each direction). Special markers indicate the start of each byte. To avoid data loss bits are sent at a precise rate that is agreed to by both sender and receiver.
- Parallel connectors use multiple data wires to transfer one or more complete bytes all at the same time. They do not adhere to a precise rate but must ensure that each set of data bits is complete before moving on to the next.
Within these categories, a number of specific types of connectors became widely used. Here are a few examples:
- RS-232, a standard serial connector used especially to attach terminal devices to minicomputers in the 1970s and 1980s. These connectors usually operated at speeds from 300 to 2400 bits per second.
- Centronics, a widely used parallel connector used to attach printers to minicomputers. Named for a major printer manufacturer of the era.
- (IBM) serial port, used on IBM PCs and the many clones that followed running Microsoft operating systems. Similar in function to RS-232 but physically different.
- (IBM) parallel port, also used on IBM PCs. A parallel connector similar but not identical to the Centronics port.
- SCSI, the Small Computer Serial Interface, designed to connect a wide range of higher-speed devices including disks to the variety of microcomputers seen in the 1980s and 1990s.
All of these connector types were once quite common, but they are rarely found on newer computers today.
Enter the Universal Serial Bus
In the mid-1990s, a group of prominent computer companies came together to work on developing a common connection system for data transfer. This was a rare alliance, bringing together Microsoft, Apple, Intel, and several others. Their effort resulted in the formation of the USB Implementers Forum (USB-IF) and the development of the Universal Serial Bus (USB) 1.0.
A major goal of USB was to develop a common data transfer system to replace many of the existing systems for a wide range of applications. Additional goals included:
- Allow computers to provide power to devices, both for operation and for battery charging
- Support multiple devices on a single port
- Allow devices to be added and removed while the computer is running (“hot swapping”)
- Provide faster transfer speeds
The first iteration of USB showed promise in these areas. Connectors at the computer were mostly standardized to the “Type A” connector shown at the beginning of this article, although connectors at the device still varied. Some low-power devices could be powered entirely through the USB cable. Special hubs could be connected to USB ports to support many devices in a multilevel tree. Hot swapping was largely supported. And transfer speeds could range as high as 12 Megabits per second.
Soon Apple and the manufacturers of Microsoft PCs began phasing out old style connectors. Some specialized data transfer systems would continue to be used for high-performance applications (e.g. FireWire, HDMI), but USB became almost the exclusive data transfer system for mainstream devices.
How does USB work?
This section describes principles of USB operation common to all versions since USB 1.1, the first version widely used. Unlike previous systems, USB relies on a specific software framework along with prescribed hardware configurations.
Cables and Connectors
The physical form of a USB system starts with a cable with special connectors on each end. The cable is composed of two or more twisted pairs. Unlike early connectors that sometimes had as many as 25 wires, USB cables typically have only 4 or 5.
The end of the cable that normally attaches to a host computer has the familiar Type A male connector, or plug, shown at the beginning of this article (in most cases). The host has a matching female connector, or receptacle, that holds the plug firmly by friction.
Although intended to be universal, a USB connection is actually adapted for the specific type of device connected. The cable may have one of several different types of plugs at the device end, each designed for specific device types. These include
- Type B, often used for printers
- Mini-B, used for cameras and older or larger smartphones
- Micro-B, used for newer, smaller smartphones and other devices
The mini-B and micro-B pugs and receptacles were not officially defined until USB 2.0. For some special uses, Mini-A connectors were defined as well. Some manufacturers have added their own special cases, in particular, Apple’s Lightning connector.
At the software level, the USB specifications define a number of device classes and specify communication protocols, descriptors, and other device driver requirements for each class. Classes are defined for device types such as a keyboard, printer, webcam, flash drive, and many others.
When connected, each device sends its class code, triggering the loading of appropriate drivers. The host then uses the appropriate protocols to obtain additional information about the device, such as transfer rate and power requirements.
Each device in a USB system is composed of one or more logical endpoints. Data is transmitted between endpoints the host in packets, labeled with the address of the device and endpoint it is directed from or to along with the transfer direction. A communication path between the host and a specific endpoint is called a pipe. This model resembles the way data is handled by the Internet Protocol at a higher level.
In the USB model, all data transfers are initiated by the host. Thus the host is the master and all devices are slaves. No device can send or receive data autonomously.
USB 1.1 defines three mechanisms for the transfer of data:
- Isochronous transfers proceed at a specific fixed data rate but may be subject to some data loss. This is suitable for audio and video data
- Interrupt transfers provide high priority and low latency for small data transfers such as keyboard codes
- Bulk transfers support large data sets such as file transfers. They are lossless but provide no guaranteed timing.
An important feature of a USB data transfer system is the ability to connect multiple devices to a single USB port. Whereas most earlier systems provided a single connection from a connector to a device, USB allows up to 127 devices to be connected to a single host. This is accomplished with special expansion devices called hubs, which provide a single USB plug and multiple USB sockets. Additional devices or hubs may be plugged into the sockets resulting in a tree structure. Of course, the host has a limited performance and power capacity that must be distributed among all the devices.
Hubs are much more than simple circuit splitters; they act as network routers, providing important aspects of device management and packet analysis and delivery. The host itself is viewed as a special hub called the root hub at the base of the tree.
USB has also made possible a new class of storage devices, USB drives, also known by other names such as flash drives and jump drives. These devices are miniature solid state storage devices with a built in Type A USB connector. Today’s USB drives may provide up to hundreds of Gigabytes of storage.
USB drives may be plugged into a computer’s USB port “on the fly”. They are detected by software and mounted as regular disk drives. They may be used to store data, run applications, or boot the operating system. In some cases operating systems may even be run directly from the USB drive, bypassing the normal operating system stored on a different disk. Separate specifications are provided for USB drives as well.
An important feature of USB is the ability to provide power to connected devices. Many devices connected to a USB host, including most mobile devices, have no other source of power. Often the current provided is in the range of 100 milliamperes or so (usually at 5 volts), but newer systems may provide for the delivery of 1.5 amperes or more in special cases.
If the devices have built-in batteries, the USB host can deliver power to charge the batteries. Because of this, USB devices with no immediate need for data transfer are often plugged directly into a power source instead of a host computer. What’s more, special charging cables may be used which are designed only to deliver power and which have no data transfer capabilities. The USB documents include a separate Battery Charging Specification spelling out the details of this system.
USB cables can transfer data in either direction, but to guard against short circuits or current overloads, they allow current to flow only from the host to the device.
Evolution of USB
USB 1.1, released in 1998, was the first widely used version. Most of the discussion above is based on USB 1.1.
Official versions of the USB specification and related documents are released by the USB-IF. At present, the official release versions since USB 1.1 have been USB 2.0, USB 3.0, and USB 3.1. However, Engineering Change Notices (ECNs) have often been used to add new features and documents in between releases.
USB 2.0 was released in 2000. This version added some important new features while retaining full support for USB 1.1 devices. Among the new features:
- Mini and micro connectors are formally defined
- Peak data transfer speed increased to 480 Megabits per second
- A battery charging specification providing better support for using USB ports to charge devices
- An on-the-go specification to allow USB devices to communicate directly without a host
USB 2.0 is fully backward compatible with USB 1.1. The host detects the requirements of each device, so a USB 2.0 host can work with USB 1.1 devices. Today the great majority of hosts support USB 2.0.
USB 3.0 was released in 2008. This was followed by USB 3.1 in 2013. The main improvement in USB 3.1 is a different encoding method resulting in increased speed. Most of the following discussion applies to both USB 3.0 and USB 3.1, which we collectively call USB 3.x.
USB 3.0 introduced a dramatic increase in potential peak performance, called SuperSpeed. The nominal maximum speed for USB 3.0 SuperSpeed data transfer was 5 Gigabits per second. USB 3.1 doubled this maximum to 10 Gigabits per second, called SuperSpeed+.
USB 2.0 connectors and cables include a single data bus ( a pair of wires) with a maximum speed of 480 Gigabits per second. Communication is basically half-duplex, meaning data can only be flowing in one direction at any moment. USB 2.0 negotiate with each device to determine if they can run at full speed or if they need to drop back to USB 1.1 speeds.
By contrast, USB 3.x connectors and cables include two SuperSpeed data buses to support full duplex communication (data flowing both ways at the same time) plus a separate USB 2.0 data bus. This “dual bus” arrangement guarantees backward compatibility while allowing the host to fully support USB 3.x devices.
When multiple devices are present, USB 2.0 hosts use a polling scheme to determine when devices are ready to send or receive data. The status of each device is continually checked in “round robin” fashion. USB 3.x hosts, on the other hand, receive signals asynchronously on any pipe that is ready to transfer data.
Many newer computers now support USB 3.1, and some devices require this version. However, many systems designed for USB 2.0 continue to be used. USB 3.0 and 3.1 connectors are required to show a blue color to distinguish them from earlier generations.
At the same time that USB 3.1 was being developed, a separate effort sought to redefine the USB connectors to move closer to one of the important original goals of USB: consistent and uniform connectors in all cases. The USB-C specification, released in 2014, defines a 24-pin connector that is intended to replace most Type A and Type B connectors.
Recent computers are appearing with USB-C connectors replacing the older types. These computers may support USB 3.x or may be designed for USB 2.0. Adapters must be used to connect an old style plug to a USB-C receptacle.
The Future of USB
The increasing adoption of USB 3.1 (and probably USB-C as well) show that USB is here to stay. While other connection systems may continue to be used for special purposes, such as extremely high-performance supercomputers, USB will continue to be the workhorse data transfer system for mainstream computing for some years to come.
Limited development is continuing. USB 3.2, to be released in late 2017, will introduce SuperSpeed++, doubling the maximum speed of USB 3.1 to 20 Gigabits per second. This version will only work with USB-C hardware, so it may hasten the adoption of the USB-C uniform connectors as well. These are good steps, but they are evolutionary, not revolutionary. The basic structure of USB is now well established, and we can expect to see this model in use for a long time.