Revision as of 21:18, 8 December 2004 editSchmuckyTheCat (talk | contribs)Extended confirmed users, Pending changes reviewers, Rollbackers23,934 edits →Overview: clarification of hubs and power distribution← Previous edit | Revision as of 22:07, 8 December 2004 edit undoOmegatron (talk | contribs)Administrators35,798 editsmNo edit summaryNext edit → | ||
Line 9: | Line 9: | ||
A USB system has an ] design, consisting of a ] controller and multiple ]s connected in a ]-like fashion using special ] ]s. There is a limit of 5 levels of branching hubs per controller. Up to 127 devices may be connected to a single host controller, but the count must include the hub devices as well. A modern computer likely has several host controllers so the total useful number of connected devices is beyond what could reasonably be connected to a single computer. There is no need for a ] on any USB bus, as there is for ] and some others. | A USB system has an ] design, consisting of a ] controller and multiple ]s connected in a ]-like fashion using special ] ]s. There is a limit of 5 levels of branching hubs per controller. Up to 127 devices may be connected to a single host controller, but the count must include the hub devices as well. A modern computer likely has several host controllers so the total useful number of connected devices is beyond what could reasonably be connected to a single computer. There is no need for a ] on any USB bus, as there is for ] and some others. | ||
Connected devices can be either bus-powered or self-powered. The standard includes provision for ] (5 ]) to the connected device. The bus has a total of 500] of power to distribute to bus-powered devices. A bus-powered device may use as much of that power as allowed by the port it is plugged into. Bus-powered hubs can continue to distribute the bus provided power to connected devices but the USB specification only allows for a single level of bus-powered devices from a bus-powered hub. This disallows connection of a bus-powered hub to another bus-powered hub. Many hubs include external power supplies which will power devices connected through them without taking power from the bus. Devices that need more than |
Connected devices can be either bus-powered or self-powered. The standard includes provision for ] (5 ]) to the connected device. The bus has a total of 500 ] of power to distribute to bus-powered devices. A bus-powered device may use as much of that power as allowed by the port it is plugged into. Bus-powered hubs can continue to distribute the bus provided power to connected devices but the USB specification only allows for a single level of bus-powered devices from a bus-powered hub. This disallows connection of a bus-powered hub to another bus-powered hub. Many hubs include external power supplies which will power devices connected through them without taking power from the bus. Devices that need more than 500 mA or higher than 5 volts must provide their own power. | ||
The design of USB aimed to remove the need for adding separate ]s into the computer's ] or ] bus, and improve ] capabilities by allowing devices to be ]ped or added to the system without ] the computer. When the new device first plugs in, the host ] it and loads the ] necessary to run it. | The design of USB aimed to remove the need for adding separate ]s into the computer's ] or ] bus, and improve ] capabilities by allowing devices to be ]ped or added to the system without ] the computer. When the new device first plugs in, the host ] it and loads the ] necessary to run it. |
Revision as of 22:07, 8 December 2004
Note: USB may also mean upper sideband in radio.
Universal Serial Bus (USB) provides a serial bus standard for connecting devices, usually to a computer, but it also is in use on other devices such as set-top boxes, game consoles and PDAs.
Overview
A USB system has an asymmetric design, consisting of a host controller and multiple devices connected in a tree-like fashion using special hub devices. There is a limit of 5 levels of branching hubs per controller. Up to 127 devices may be connected to a single host controller, but the count must include the hub devices as well. A modern computer likely has several host controllers so the total useful number of connected devices is beyond what could reasonably be connected to a single computer. There is no need for a terminator on any USB bus, as there is for SCSI and some others.
Connected devices can be either bus-powered or self-powered. The standard includes provision for power (5 volts) to the connected device. The bus has a total of 500 mA of power to distribute to bus-powered devices. A bus-powered device may use as much of that power as allowed by the port it is plugged into. Bus-powered hubs can continue to distribute the bus provided power to connected devices but the USB specification only allows for a single level of bus-powered devices from a bus-powered hub. This disallows connection of a bus-powered hub to another bus-powered hub. Many hubs include external power supplies which will power devices connected through them without taking power from the bus. Devices that need more than 500 mA or higher than 5 volts must provide their own power.
The design of USB aimed to remove the need for adding separate expansion cards into the computer's ISA or PCI bus, and improve plug-and-play capabilities by allowing devices to be hot swapped or added to the system without rebooting the computer. When the new device first plugs in, the host enumerates it and loads the device driver necessary to run it.
USB can connect peripherals such as mice, keyboards, scanners, digital cameras, printers, hard drives, and networking components. For multimedia devices such as scanners and digital cameras, USB has become the standard connection method. For printers, USB has also grown in popularity and started displacing parallel ports because USB makes it simple to add more than one printer to a computer. As of 2004 there were about 1 billion USB devices in the world.
Compared to other standards
Storage
USB implements connections to storage device using a set of standards called the USB mass storage device class. This was initially intended for traditional magnetic and optical drives, but has been extended to support a wide variety of devices.
In the case of hard drives, USB seems unlikely to completely replace buses such as ATA (IDE) and SCSI because USB performs somewhat more slowly than those standards. However, USB has one important advantage in making it possible to install and remove devices without opening the computer case, making it useful for external drives. Today, a number of manufacturers offer portable USB hard drives that offer performance nearly indistinguishable from conventional ATA (IDE) drives.
These external drives are often composed of translating devices that connect to USB on one side and to conventional IDE, ATA, ATAPI, or SCSI drives on the other. When a drive is available from a manufacturer only as an "internal" drive, it is sometimes possible to purchase an inexpensive (or non-functioning) USB drive and swap the device. This makes it possible to use an "internal" drive with a laptop computer.
Firewire technology is also commonly used with portable hard drives. USB 2.0 boasts only 480Mbps throughput (as opposed to Firewire's 800Mbps) and Firewire connections of the same throughput tend to perform better in speed benchmarks than USB connections. However, USB ports are more common on consumer-level computers, which enhances the portability of a USB drive. Some portable drive enclosures provide both types of ports.
Peripherals
USB has not completely replaced AT keyboard connections and PS/2 mouse connections, but virtually all PC motherboards today have one or more USB ports. As of 2004, most new motherboards have multiple USB 2.0 high-speed ports, though some are internal, and require a "header" connection to be accessible from the front or rear of the computer case.
USB standards
USB 1.0 came out in 1995, the same year that Apple adopted the IEEE 1394 standard known as Firewire. It supports two data rates of 1.5 Mbit/s for keyboards, mice, joysticks and the like, and a full speed mode at 12 Mbit/s, which is about 1.5 Mbyte/s.
USB 1.1 came out later in 1995. This standard added interrupt OUT transfers. See for details.
USB 2.0 came out in 2002. The major feature of this standard is the addition of a high-speed rate of 480 Mbit/s, which is about 57 Mbyte/s. It also clarifies minor technical errata. At its highest speed USB competes directly with FireWire, except in the area of digital camcorders, where USB has technological limitations that prevent it from being viable.
Confusingly, the USB Forum has renamed USB 1.1 to USB 2.0 Full Speed; and USB 2.0 to USB 2.0 High Speed.
Connectors
The USB 1.0, 1.1 and 2.0 specifications define two types of connectors for the attachment of devices to the bus: A, B. However, the mechanical layer has changed in some examples. For example, the IBM UltraPort is a proprietary USB connector located on the top of IBM's notebook LCDs. It uses a different mechanical connector while preserving the USB signaling and protocol. Other manufacturers of small items also developed their own small form factor connector, and a wide variety of these have appeared. For specification purposes, these devices were treated as having a captive cable.
An extension to USB called USB-On-The-Go allows a single port to act as either a host or a device - chosen by which end of the cable plugs into the socket on the unit. Even after the cable is hooked up and the units are talking, the two units may "swap" ends under program control. This facility targets units such as PDAs where the USB link might connect to a PC's host port as a device in one instance, yet connect as a host itself to a keyboard and mouse device in another instance. USB-On-The-Go has therefore defined two small form factor connectors, the mini-A and mini-B, and a hermaphroditic socket, which should stop the proliferation of proprietary designs.
Wireless USB is a promising future standard being developed to extend the USB standard while maintaining backwards compatiblity with USB 1.1 and USB 2.0 on the protocol level.
Technical details
USB connects several devices (in USB lingo referred to as functions) to a host controller through a chain of hubs. The hubs are special purpose devices that are not officially considered functions. There always exists one hub known as the root hub, which is attached directly to the host controller.
These devices/functions (and hubs) have associated pipes (logical channels) which are connections from the host controller to a logical entity on the device named an endpoint. These endpoints (and their respective pipes) are numbered 0-15 in each direction, so a device/function can have up to 32 active pipes, 16 inward and 16 outward. (The OUT direction shall be interpreted out of the host controller and the IN direction is into the host controller.) Endpoint 0 is however reserved for the bus management in both directions and thus takes up two of the 32 endpoints. In these pipes, data is transferred in packets of varying length. Each pipe has a maximum packet length, typically bytes, so a USB packet will often contain something in the order of 8, 16, 32, 64, 128, 256, 512 or 1024 bytes.
Each endpoint can transfer data in one direction only, either into or out of the device/function, so each pipe is uni-directional. All USB devices have at least two such pipes/endpoints: namely endpoint 0 which is used to control the device on the bus. There is always an inward and an outward pipe numbered 0 on each device. The pipes are also divided into four different categories by way of their transfer type:
- control transfers - typically used for short, simple commands to the device, and a status response, used e.g. by the bus control pipe number 0
- isochronous transfers - at some guaranteed speed (often but not necessarily as fast as possible) but with possible data loss, e.g. realtime audio or video
- interrupt transfers - devices that need guaranteed quick responses (bounded latency), e.g. pointing devices and keyboards
- bulk transfers - large sporadic transfers using all remaining available bandwidth (but with no guarantees on bandwidth or latency), e.g. file transfers
When a device (function) or hub is attached to the host controller through any hub on the bus, it is given a unique 7 bit address on the bus by the host controller. The host controller then polls the bus for traffic, usually in a round-robin fashion, so no device can transfer any data on the bus without explicit request from the host controller.
To access an endpoint, a hierarchical configuration must be obtained. The device connected to the bus has one (and only one) device descriptor which in turn has one or more configuration descriptors. These configurations often correspond to states, e.g. active vs. low power mode. Each configuration descriptor in turn has one or more interface descriptors, which describe certain aspects of the device, so that it may be used for different purposes: for example, a camera may have both audio and video interfaces. These interface descriptors in turn have one default interface setting and possibly more alternate interface settings which in turn have endpoint descriptors, as outlined above. An endpoint may however be reused among several interfaces and alternate interface settings.
The hardware that contains the host controller and the root hub has an interface toward the programmer which is called Host Controller Device (HCD) and is defined by the hardware implementer. Compaq created the first such public specification and named it Open Host Controller Interface (OHCI). Intel subsequently created specifications for two such standard interfaces named Universal Host Controller Interface (UHCI) and Extended Host Controller Interface (EHCI). In practice, these are hardware registers (ports) in the computer. These are the only interfaces found in practice on desktop computers. Only EHCI can support high-speed transfers.
Devices that attach to the bus can be full-custom devices requiring a full-custom device driver to be used, or may belong to a device class. These classes define an expected behaviour in terms of device and interface descriptors so that the same device driver may be used for any device that claims to be a member of a certain class.
USB adapters
Some USB adapters allow the connection of "devices" simply to get power (car lighter USB adapter), such as to recharge a small device (like a keychain digital camera), or to power a small LED-light lamp for reading.
See also
- ACCESS.bus.
- PictBridge.
- Firewire (IEEE1394).
- MP3.
- USB Keydrive.
- USB streaming
- Wireless: Wifi, Bluetooth.
External links
- USB home, including documentation
- USB for DOS
- Linux USB Project, containing much technical information and documentation.
- USB 2.0 vs Firewire - benchmark using external drives on Macs
- USB in a NutShell - a primer for developers