All USB devices share several general characteristics. Among these are:
In theory, at least, USB peripherals can be connected to and disconnected from the bus at any time, without shutting down the computer or taking any action to inform applications or the OS that a device is being added or removed. In practice, this is not always the case, particularly with older interfaces and devices.
The USB host controller chipset installed on the PC motherboard or an add-on USB port card manages driver software and allocates bandwidth to each USB device attached to the bus. When a device is added or removed, the USB host controller automatically loads or unloads the driver for that device.
A USB host controller occupies one interrupt, which is shared among all devices attached to the bus. This small resource footprint allows multiple USB host controllers to be installed in a system without undue demands on scarce IRQs. Although each USB host controller can in theory support as many as 127 devices, it's often better to distribute multiple USB devices among host controllers to avoid conflicts.
A USB 1.1 bus provides 12 Mb/s of bandwidth and a USB 2.0 bus provides 480 Mb/s of bandwidth, which is shared among all devices attached to the bus. Many devices may communicate simultaneously on a USB, provided that adequate bandwidth is available to service all of them at the same time. Properly designed USB peripherals and drivers use bandwidth dynamically, releasing bandwidth they are not using so that it can be used by other devices. For isochronous (time-critical) tasks such as audio or video streams, USB permits dedicating bandwidth as needed to a particular peripheral, although that dedicated bandwidth then becomes permanently unavailable for use by other peripherals.
In addition to providing a data connection, USB provides electrical power to peripherals, allowing you to eliminate the tangle of power cables required by traditional peripherals. That power, however, is limited to 500 milliamps (mA), which must be shared by all unpowered devices connected to the USB port. In practice, that means that only low-power peripherals, such as keyboards and mice, can be powered directly by a USB connection. High-power peripherals, such as printers and scanners, usually (but not always) have their own power bricks and are powered directly from a standard AC receptacle. For example, the Canon Canoscan 1220U relies on the USB port for power. Despite the minimal amount of current available on the USB port, it is possible to connect multiple unpowered USB peripherals by connecting them to powered USB hubs, each port of which has its own 500 milliamp supply.
The following sections detail other important characteristics of USB interfaces and devices.
Three versions of USB exist:
USB 1.0 was the original specification. Most systems produced from 1996 through mid-1998 have USB 1.0 ports. USB 1.0 supports data rates of 1.5 Mb/s and 12 Mb/s. Relatively few USB 1.0 peripherals were produced because by the time USB peripherals began shipping in volume, USB 1.0 had been superseded by USB 1.1. USB 1.0-compliant peripherals generally operate properly when connected to a USB 1.1 or USB 2.0 interface, but USB 1.1 or USB 2.0 peripherals may not function properly when connected to a USB 1.0 interface. USB 1.0 interfaces are primitive and buggy, so if your motherboard has USB 1.0 ports, we recommend you disable those ports in BIOS Setup and install an add-on PCI USB port card. The first release of Windows 98 included USB 1.0 support.
USB 1.1 was formalized in September 1998, although many manufacturers produced USB 1.1-compliant motherboards and peripherals based on the proposed standard long before the formal standard was adopted. USB 1.1 also supports data rates of 1.5 Mb/s and 12 Mb/s, and was largely a clarification of ambiguities in the USB 1.0 specification. A few functional definitions were changed in USB 1.1, including minor changes to hub specifications, removing provision for battery-powered hubs, adding interrupt-out mode, and changes to recommended enumeration to eliminate the requirement for an 8-byte endpoint zero. Most changes, however, merely tightened up the existing requirements because experience had shown that there were enough ambiguities in the USB 1.0 specification to allow producing interfaces and devices that complied with the standard but were not interoperable. USB 1.1 interfaces and devices began shipping in mid-1998 and are still in production. Early USB 1.1 interfaces and devices suffered many incompatibilities, but current production models have relatively fewer such issues. You can download the Universal Serial Bus Revision 1.1 Specification from http://www.usb.org/developers/docs/usbspec.zip.
USB 2.0 was formalized in April 2000, with various errata and Engineering Change Notices later incorporated as supplements. USB 2.0 supports data rates of 1.5 Mb/s, 12 Mb/s, and 480 Mb/s, and provides full backward compatibility with USB 1.0 and USB 1.1 devices.
The uptake of USB 2.0 was slower than expected because USB 2.0 chipsets were slower in arriving than expected and because Microsoft initially did not provide USB 2.0 Windows drivers. Microsoft shipped native USB 2.0 drivers for Windows XP in early 2002 and for Windows 2000 in late 2002. Microsoft has no plans to provide Windows 9X USB 2.0 drivers. Using USB 2.0 under Windows 9X requires drivers supplied by the manufacturer of the motherboard (or PCI/USB card) and USB 2.0 peripherals.
With so many of the major players in the computer industry backing it, USB 2.0 saw a fast ramp-up during late 2002 and into 2003. Most motherboards introduced during fall 2002 and later have chipset-level USB 2.0 support, and by early 2003 USB 2.0 peripherals such as external hard drives and optical drives were readily available. Older systems can be upgraded to support USB 2.0 by adding an inexpensive adapter.
In addition to its much higher speed, the attraction of USB 2.0 is its standardization. Earlier USB versions had frequent compatibility problems, not the least because two different and slightly incompatible controller standards existed. USB 2.0 defines one controller interface, called the Enhanced Host Controller Interface (EHCI), which eliminates many compatibility issues. You can download the most recent complete Universal Serial Bus Revision 2.0 Specification from http://www.usb.org/developers/docs/usb_20.zip.
USB defines the following three speeds, all of which can coexist on one bus:
Low Speed USB peripherals operate at a data rate of 1.5 Mb/s, and are supported by USB 1.1 and USB 2.0 interfaces. Low Speed USB is intended for such low-bandwidth devices as mice and keyboards, and is designed to be inexpensive to implement. Low Speed USB devices use a captive cable that can be no longer than 3 meters. Actual throughput on Low Speed USB is typically limited by overhead and other factors to about 1.2 Mb/s, or 150 KB/s.
Full Speed USB peripherals operate at a data rate of 12.0 Mb/s, and are supported by USB 1.1 and USB 2.0 interfaces. Full Speed is the fastest speed supported by USB 1.0 and USB 1.1, and is intended for such moderate-bandwidth devices as printers and scanners. Full Speed USB devices use active components, which are more expensive to implement than the passive components used by Low Speed USB. Full Speed USB devices use a detachable cable that can be no longer than 5 meters. Full Speed USB seldom exceeds actual throughput of 900 KB/s or so.
Hi-Speed USB peripherals operate at a data rate of 480 Mb/s, and are supported only by USB 2.0 interfaces. Hi-Speed USB is intended for such high-bandwidth devices as external drives. Hi-Speed USB devices use active components that are more expensive than Full Speed USB components. Also, Hi-Speed USB hubs require additional circuitry to arbitrate between mixed Hi-Speed and Full Speed devices connected to that hub. Accordingly, Hi-Speed USB devices, particularly hubs, were initially more expensive than USB 1.1 devices, although that differential had largely disappeared by early 2003. Hi-Speed USB devices use the same detachable cable used by Full Speed USB devices, which can be no longer than 5 meters. Hi-Speed USB typically achieves actual maximum throughput of 35 to 40 MB/s, which is fast enough to keep up with all but the fastest hard drives.
Note that USB bandwidth is shared among all devices connected to the bus, and that the system reserves some bandwidth (typically 10%) for control signals and other administrative purposes. Although many Hi-Speed USB devices require much less than 480 Mb/s, if you do connect more than one high-bandwidth Hi-Speed device to a single USB channel, you may throttle the bandwidth available to each when more than one are operating. In that situation, if your system has more than one USB 2.0 HCI, we recommend splitting your high-bandwidth devices among different host controllers.
USB uses a tiered-star topology, shown in Figure 24-1. At the center of the star is the USB host, which defines the USB, and only one of which is permitted per USB. (Note, however, that more than one USB host may be installed in a PC, and in fact most recent motherboards have multiple USB hosts installed.) The USB host resides inside the PC, and is implemented as a combination of hardware, firmware, and software. The USB host has one or more USB root hubs, which provide attachment points called USB ports to which USB hubs and USB functions may be connected. (Loosely speaking, a USB function is a peripheral such as a scanner, printer, mouse, digital camera, etc.)
USB hubs use two types of connections. An upstream connection links the USB hub to another USB hub in the next-higher tier. A downstream connection links the USB hub to another USB hub or to a USB function located in the next-lower tier. Each USB hub has one upstream port, and may have as many as seven downstream ports. Via daisy-chaining, USB allows connecting a maximum of 127 devices (USB hubs and USB functions) in a maximum of seven tiers. The limitation on the number of tiers is required to ensure that the most distant USB device can communicate within the maximum allowable propagation delay defined in the USB specification.
If you mix USB 1.1 and USB 2.0 devices on a bus, it's important to understand the following points:
USB 2.0 hubs support USB 1.0/1.1 and USB 2.0 devices, including downstream USB 1.0/1.1 hubs and USB 2.0 hubs, providing full bandwidth to each device according to its version.
USB 1.0/1.1 hubs support USB 1.0/1.1 and USB 2.0 devices, but USB 2.0 devices connected to a USB 1.1 hub function as USB 1.1 Full Speed devices (i.e., at 12 Mb/s maximum), which means that it is pointless to connect a USB 2.0 hub downstream from a USB 1.1 hub.
Although USB 2.0 hubs provide transparent support for Low Speed and Full Speed USB devices, that support incurs significant overhead on the USB 2.0 hub and is intended only for limited use, such as connecting a USB mouse and keyboard. Connecting multiple Low Speed or Full Speed USB devices to a USB 2.0 hub, either directly or downstream, degrades the ability of the USB 2.0 hub to support Hi-Speed USB 2.0 devices. If you have many Low Speed or Full Speed USB devices, connect them to a USB 1.1 root hub port and reserve your USB 2.0 ports for Hi-Speed devices.
USB connectors and cables are simple and rigidly standardized. USB defines three plug/jack combinations, designated Series A, Series B, and Series mini-B.
The narrow Series A jacks, shown in Figure 24-2, appear on the back of a PC or USB hub, and may be labeled "down" jacks. These provide connection points for USB peripherals, including USB hubs. Some USB peripherals have permanently connected cables that terminate in a Series A plug. Series A plugs always face upstream, toward the host system, and Series A jacks always face downstream, toward the device.
Peripherals that do not have a permanent cable instead have a Series B jack, shown in Figure 24-3. Series B plugs always face downstream, and Series B jacks always face upstream. Use a standard USB A-B device cable to connect these peripherals to the PC or hub.
A USB cable uses four wires, two each for data and power. The data wires are a green/white twisted pair that carry +Data and -Data, respectively. USB uses differential digital signaling, which means that the same signal is present on each data wire, but with different polarity. This allows electrical noise to be eliminated from the circuit because induced voltages affect the + and - signals equally, netting to zero. The power wires may or may not be twisted. The red wire carries nominal +5V DC, and the black is a ground return for the power circuit. The USB specification permits cables as long as 5 meters (~16 feet), a limitation enforced by the allowable propagation delay between a port and a connected device.
The USB specification defines only three types of USB cable:
Keyboards and similar low-speed devices use a USB low-speed captive cable. The maximum allowable length for a low-speed USB cable is 3 meters (9 feet, 10 inches). This limit is determined by the rise and fall times of low-speed USB signaling, which restricts low-speed USB cables to a maximum length only 60% that of standard full-speed/hi-speed cables. A USB standards-compliant low-speed cable must be captive or hardwired, which is to say that the cable either must be permanently connected to the device or must use a nonstandard or proprietary connector on the end that connects to the device. The concern is that if a low-speed USB device used a standard USB device connector, a standard detachable USB cable longer than acceptable for low-speed USB devices could be used to connect that device.
Most full-speed and hi-speed USB devices use a USB standard detachable cable. This cable is terminated on one end with a Series A plug and on the other with a Series B plug or Series mini-B plug. The maximum allowable length for a standard detachable cable is 5 meters (16 feet, 5 inches).
Some full-speed and hi-speed USB devices use a USB hi-/full-speed captive cable. This cable is terminated on one end with a Series A plug. The other end terminates either as a hard-wired connection to the device or with a vendor-proprietary connector. The maximum allowable length for a hi-/full-speed captive cable is also 5 meters.
Although the USB standard states that only these three cable assemblies are acceptable, it further emphasizes it by specifically prohibiting the following cable assemblies, all of which have been manufactured and sold despite their non-compliance:
Some vendors produce cables that terminate with two Series A plugs, two Series B receptacles, or two Series mini-B receptacles, which allow connecting USB ports and devices in prohibited combinations.
A cable that terminates with a Series A plug and a Series A receptacle, a Series B plug and a Series B receptacle, or a Series mini-B plug and a Series mini-B receptacle is specifically prohibited by the USB specification. However, many vendors sell such cables, including some vendors who should know better. The purpose of these cables is to extend the distance between port and device by joining multiple cable segments. The risk is that the joined cables will exceed the maximum 5 meters permissible under the standard, which can cause problems, from sporadic operation to complete failure of the entire USB. Even if the joined cables total less than 5 meters, the electrical characteristics of the extended cable may fall outside specifications. Avoid using extension cables under any circumstances.
The USB specification does not permit low-speed devices to use standard detachable cables. Standard detachable cables are used only to connect hi-speed/full-speed devices. Their capacitive load exceeds the maximum allowable for a low-speed device.
USB uses a set of unidirectional and bidirectional pipes to transfer user data and control information between the host and USB devices. Each device may support multiple pipes for different purposes, and data transferred in one pipe is independent from data transferred in other pipes. For example, a USB printer might have one pipe that it uses to receive page data from the host, and a second pipe that it uses to transfer status information to the host. USB defines the following data flow types:
Isochronous Data Transfers are used for periodic, continuous communication between the host and a device, typically time-critical data such as audio or video streams. Isochronous Data Transfers are enabled by reserving the required amount of bandwidth for the isochronous device, which the USB host controller makes unavailable to other devices whether the isochronous device happens to be using that bandwidth at any given time. Isochronous Data Transfers have the highest priority for bandwidth. If all available bandwidth is reserved for Isochronous Data Transfers, no other device can use the USB.
Interrupt Data Transfers are used for small, limited-latency transfers when timely, reliable delivery of data is required?for example, to receive coordinate changes from a mouse or status changes from a modem. Interrupt Data Transfers have lower priority for available bandwidth than do Isochronous Data Transfers.
Control Transfers are used to configure a device when it is connected to the USB, and may be used for other device-specific control, configuration, and status commands, including controlling other pipes on the device. Control Transfers usually comprise small amounts of data that are not time-critical, and have lower priority for available bandwidth than do Interrupt Data Transfers.
Bulk Data Transfers are used to communicate large amounts of nonperiodic, bursty data with relaxed timing constraints to a device?e.g., sending page data to a USB printer. Bulk Data Transfers are not time-critical, and have the lowest priority for available bandwidth. Some early HCIs implemented bulk mode poorly, and so work properly with USB devices such as keyboards and mice but are unsuitable for use with devices such as scanners and printers.