USB

external computer bus to connect peripheral devices; the host computer has USB sockets, the external devices are plugged in

The Universal Serial Bus (USB) is technology that allows a person to connect an electronic device to a computer. It is a fast serial bus type.

A USB Type A plug

It is mostly used on personal computers. USB is also used on other devices, such as smartphones and video game consoles. USB connects different devices using a standard interface.

Most people use USB for computer mice, keyboards, scanners, printers, digital cameras, and USB flash drives. There are over six billion USB devices around the world.

The standard was made to improve plug and play devices. This means that a device can be plugged into a free socket, and simply work. The computer will notice the device. The computer sometimes installs special software to use the device. The device can be removed after it stops being used. This technology is called "hot swapping". "Hot swapping" means it can be plugged and unplugged while the power is on. The computer does not need to be turned off for people to change the devices.

USB can provide a small amount of power to the attached device through the USB cord. Devices that only need a little power can get it from the bus, and do not need a separate electric power plug. That allows gadgets like USB battery chargers, lights, and fans. They can also power external hard drives and SSD.

As of 2022, almost all computers have USB and have replaced older standards. Those include the parallel port, serial port and SCSI. These old standards are rare nowadays, but very few computers in the world still use these old connectors for a few jobs where USB cannot replace them.

Brief history

change
 
Full sized USB-B plug
 
USB4 Gen3x2 cable (40Gbit/s) with 100W Power Delivery

The first version of the Universal Serial Bus was created in 1995. This new technology became an instant success. Since the introduction of USB, people that make electronic devices thought about how it could be used in the future. Today, USB connects a computer or other devices like laptops and MP3 players to peripheral devices.

The bus was introduced by seven companies which represent the leaders in the industry of information technology: Compaq, IBM, Intel, Microsoft, NEC, Northern Telecom, and Digital Equipment Corporation (DEC).

Several years earlier, adopters and developers of USB held a meeting called Plugfest at a special hotel in California to test their devices. They selected a hotel that included rooms for sleeping and for testing. The meeting lasted three days. During the meeting, the representatives of about 50 companies connected their USB devices to one general host system.

The logo of the USB device also has its own history. The USB logo was in development for several months.

  • 1994 - Seven companies united to begin the development of USB.
  • 1995 - 340 companies formed the USB Implementation Forum.
  • 1996 - More than five hundred USB products were already developing around the world.
  • 1997 - USB Implementation Forum became richer with 60 more companies.
  • 1998 - USB becomes the most popular technology on the market of electronics.
  • 2000 - The introduction of USB 2.0. Today it represents the most widely used USB device.
  • 2005 - USB becomes wireless.
  • 2008 - USB 3.0 is introduced. It is over 10 times faster than USB 2.0.
  • 2013 - USB 3.1 is introduced. It is about twice as fast as USB 3.0.
  • 2015 - USB Type-C is introduced. It is a reversible connector, which means that you can plug it in both ways.
  • 2019 - USB 4 is introduced. It is over 8 times faster than USB 3.0.

Different standards

change

Currently, five different USB standards are used: USB 1.0, USB 1.1, USB 2.0, USB 3.0 and USB 3.1. USB 3.1 was released in 2016 and doubled the speed of 3.0. It optionally uses a different connector called USB Type-C, which is reversible (meaning you can plug it in both ways).[1] USB 1.0 is now rarely used.

Different kinds of USB can carry different amounts of power.

USB offers five different transfer speeds: 1.5 MBit per second (called low speed), 12 MBit per second (Full Speed), 480 MBit/second (Hi Speed), 5Gbit per second (called super speed), and 10 Gbit/s (“super speed+“). Hi speed is only available in USB 2.0 and later, and Super speed is only available in USB 3.0. These speeds are raw bit rates (in Million bits per second). The actual data rate is usually lower due to protocol overhead.

In order to use the hi speed transfer rate, the USB controller and the connected device both need to support it. USB is backwards compatible. Faster and slower USB devices and controllers can be connected together, but they will run at the slower speed.

USB Hubs

change
 
USB hubs like this can be used to extend the USB ports on your computer.

As of 2022, almost all computers sold today have USB ports, and most of them support USB 3.0 or later and have at least one USB-C port. Apple Macbooks only have USB-C ports. The number of ports they have is usually limited, though. Between two and four ports are common. USB allows connecting USB hubs to add more USB ports.

The hubs themselves are also compliant to one of the USB standards. Devices connected to a USB 2.0 hub will only go as fast as USB 2.0 rates. Devices connected to a later controller can use different standards.

USB Connectors

change
 
A Series "A" connector and receptacle.
 
A USB Type-C connector.

USB was designed to be easy to use. The engineers learned from other connectors before they designed USB connectors. There are 3 connectors.

  • Type A, commonly used at computer end of cable
    • Micro-A (rare)
  • Type B, at peripheral end, rare except for printers
  • Type C, at either end. As of 2022, many computers, phones and peripherals use it.

Usability

change
  • It's not possible to plug in a USB A or B connector the wrong way. They can not go in upside down, and it is obvious from the look and kinesthetic feeling, when it goes in properly. Sometimes, however, a user doesn't understand or see how the connector goes, so it might be necessary to try both ways.
  • Type C USB connectors can be plugged in both ways. It does not matter which way the connector is plugged in.
  • There is no need to push or pull very hard to plug or unplug it. This was in the specification. USB cables and small USB devices are held in place by the gripping force from the receptacle. USB does not need screws, clips, or other fasteners. The force needed to make or break a connection is small. This allows connections to be made in awkward positions or by those with motor disabilities.
  • Before the advent of Type C, the connectors enforced the directed topology of a USB network. USB does not support cyclical networks, so the connectors from incompatible USB devices are themselves incompatible. Unlike other communications systems (e.g. RJ-45 cabling) gender-changers were almost never used before the advent of USB-On-The-Go (OTG), making it difficult to create a cyclic USB network.
 
USB extension cord

Durability

change
  • The connectors are designed to be tough. Early connector designs were fragile, with pins or other delicate components which could easily bend or break, even if treated gently. The electrical contacts in a USB connector are protected by a plastic tongue. The entire connecting assembly is usually further protected by an enclosing metal sheath. As a result, USB connectors can safely be handled, inserted, and removed, even by a small child.
  • The connector construction always ensures that the external sheath on the plug contacts with its counterpart in the receptacle before the four connectors within are connected. This sheath is typically connected to the system ground, allowing otherwise damaging static charges to be safely discharged by this route (rather than via delicate electronic components). This means of enclosure also means that there is a (moderate) degree of protection from electromagnetic interference afforded to the USB signal while it travels through the mated connector pair (this is the only location when the otherwise twisted data pair must travel a distance in parallel). As well, the power and common connections are made after the system ground but before the data connections. This type of staged make-break timing allows for safe hot-swapping and has been used for connectors in the aerospace industry.
  • The newer USB micro receptacles are designed to allow up to 10,000 cycles of insertion and exertion between the receptacle and plug, compared to 500 for the standard USB and Mini-USB receptacle. This is done by adding a locking device and by moving the leaf-spring connector from the jack to the plug, so that the most-stressed part is on the cable side of the connection. This change was made so that the connector on the (relatively inexpensive) cable would bear the most wear instead of the micro-USB device.

Compatibility

change
  • The USB standard specifies relatively big tolerances for compliant USB connectors. This is done to minimize incompatibilities in connectors produced by different vendors (a goal that has been very successfully achieved). Unlike most other connector standards, the USB specification also defines limits to the size of a connecting device in the area around its plug. This was done to prevent a device from blocking adjacent ports due to its size. Compliant devices must either fit within the size restrictions or support a compliant extension cable which does.
  • Two-way communication is also possible. Usually cables have only plugs, and hosts and devices have only receptacles: hosts having type-A receptacles and devices type-B. Type-A plugs only join with type-A receptacles, and type-B with type-B. However, 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.

How USB works

change

A USB system has an asymmetric design. It is made of a host, several downstream USB ports, and multiple peripheral devices connected in a star topology. Additional USB hubs may be included in the tiers, allowing branching into a tree structure with up to five tier levels.

A USB host can have multiple host controllers. Each host controller provides one or more USB ports. Up to 127 devices, including the hub devices, may be connected to a single host controller.

USB devices are linked in series through hubs. There is always one hub known as the root hub. The root hub is built into the host controller. There are special hubs, called "sharing hubs". These allow multiple computers to access the same peripheral devices. They work by switching the access between PCs, either manually or automatically. They are popular in small-office environments. In network terms, they converge rather than diverge branches.

A physical USB device can have several logical sub-devices that are referred to as device functions. A single device may provide several functions, for example, a webcam (video device function) with a built-in microphone (audio device function).

 
USB endpoints are actually on the connected device: the channels to the host are referred to as pipes.

USB device communication is based on pipes (logical channels). Pipes are connections from the host controller to a logical entity on the device named an endpoint. The term endpoint is occasionally used to incorrectly refer to the pipe. A USB device can have up to 32 active pipes, 16 into the host controller and 16 out of the controller.

Each endpoint can transfer data in one direction only, either into or out of the device, so each pipe is uni-directional. Endpoints are grouped into interfaces and each interface is associated with a single device function. An exception to this is endpoint zero, which is used for device configuration and which is not associated with any interface.

When a USB device is first connected to a USB host, the USB device enumeration process is started. The enumeration starts by sending a reset signal to the USB device. The speed of the USB device is determined during the reset signaling. After reset, the USB device's information is read by the host, then the device is assigned a unique 7-bit address. If the device is supported by the host, the device drivers needed for communicating with the device are loaded and the device is set to a configured state. If the USB host is restarted, the enumeration process is repeated for all connected devices.

The host controller polls the bus for traffic, usually in a round-robin fashion, so no USB device can transfer any data on the bus without an explicit request from the host controller.

Host controllers

change

The computer hardware that contains the host controller and the root hub has an interface for the programmer. It is called Host Controller Device (HCD) and is defined by the hardware implementer.

For USB 1.0 and 1.1, there were two different HCD implementations, Open Host Controller Interface (OHCI) and Universal Host Controller Interface (UHCI). OHCI was developed by Compaq, Microsoft and National Semiconductor, UHCI by Intel.

 
A typical USB connector.

VIA Technologies licensed the UHCI standard from Intel; all other chipset implementers use OHCI. UHCI relies more on software. This means UHCI is slightly more processor-intensive than OHCI but easier and cheaper to make. Because there were two different implementations, operating system vendors and hardware vendors needed to develop and test on both of them. This increased cost.

The USB specification does not specify any HCD interfaces and is not concerned with them. In other words, USB defines the format of data transfer through the port, but not the system by which the USB hardware communicates with the computer it sits in.

During the design phase of USB 2.0, the USB-IF insisted that there was only one implementation. The USB 2.0 HCD implementation is called the Enhanced Host Controller Interface (EHCI). Only EHCI can support hi-speed (480 Mbit/s) transfers. Most of PCI-based EHCI controllers have other HCD implementations called 'companion host controller' to support Full Speed (12 Mbit/s) and may be used for any device that claims to be a member of a certain class. An operating system is supposed to implement all device classes, so it can provide generic drivers for any USB device. Device classes are decided upon by the Device Working Group of the USB Implementers Forum.

USB device classes

change

Device classes include:[2]

Class Usage Description Examples
00h Device Unspecifiedclass 0 (Device class is unspecified. Interface descriptors are used for determining the required drivers.)
01h Interface Audio Speaker, microphone, sound card
02h Both Communications and CDC Control Ethernet adapter, modem, serial port adapter
03h Interface Human Interface Device (HID) Keyboard, mouse, joystick
05h Interface Physical Interface Device (PID) Force feedback joystick
06h Interface Image Digital camera (Most cameras function as Mass Storage for direct access to storage media).
07h Interface Printer Laser printer, Inkjet printer
08h Interface Mass Storage USB flash drive, memory card reader, digital audio player, external drives
09h Device USB hub Full speed hub, hi-speed hub
0Ah Interface CDC-Data (This class is used together with class 02h - Communications and CDC Control.)
0Bh Interface Smart Card USB smart card reader
0Dh Interface Content Security -
0Eh Interface Video Webcam
0Fh Interface Personal Healthcare -
DCh Both Diagnostic Device USB compliance testing device
E0h Interface Wireless Controller Wi-Fi adapter, Bluetooth adapter
EFh Both Miscellaneous ActiveSync and Palm sync device
FEh Interface Application Specific IrDA Bridge
FFh Both Vendor Specific (This class code indicates that the device needs vendor specific drivers.)

Note class 0: Use class information in the Interface Descriptors. This base class is defined to be used in Device Descriptors to indicate that class information should be determined from the Interface Descriptors in the device.

 
An M.2 (2242) solid-state-drive (SSD) connected into USB 3.0 adapter and connected to computer.
change

References

change
  NODES
camera 3
HOME 1
languages 1
mac 2
Note 2
os 60
web 2