Tech Primer
USB is a replacement for legacy serial & parallel communications and is a point to point connection including multi-drop topologies. The cabling consists of a pair of twisted wires carrying differential signalling data bundled with two wires for powering low-powered peripherals. A single cable of up to 5m long is allowed and for full and high-speed use it must be screened. Terminations are usually by the original standard ‘A’ and ‘B’ connectors with mini and micro versions exist and for some applications the device end may be permanently fixed to the PCB, a mouse being a good example.
• One end of the cable is the upstream host (master), the other the downstream function (slave) and unless we’re talking about USB-OTG (on-the-go) that demarcation is cast in stone (well silicon).
• A beauty of USB is that for small, simple low-powered peripherals the power can be supplied by the host down the same cable (bus powered). The limit being 100mA before enumeration, 500mA after (see USB spec for more details).
• Device functions may be plugged / unplugged while the host remains powered, known as hot plugging. There are software exceptions to this (the hardware won’t mind), for example a mass storage device may not have completed it’s write process, the user must therefore wait until notified it is safe to unplug.
• Up to 127 functions are allowed per host port by fanning out into a tree structure using hubs, note the hubs count towards the 127 limit. There is of course a maximum supply current limit of 500mA so such a structure would almost certainly require "self-powered" hubs.
• USB-2.0 specifies speeds of:
“ Original” or “Low-speed“ at 1.5Mbits/s, the specification suggests a maximum useful data rate of 187KB/s max though many low-end micros won’t reach such sustained levels.
“ Full speed” at 12Mbits/s, for which the specification suggests a useful throughput of 1.5MB/s max
“ High speed” with 480Mbits/s yielding up to 60MB/s max of useful data throughput.
• The USB-OTG “on-the-go” extension was introduced to allow the host – function roles to be arbitrated. Taking the example of a printer, it may operate as a PC peripheral or as a camera host.
• Wireless USB and USB 3.0 have since been added but are sufficiently out of scope they’ll not be mentioned again here.
• The host controls the flow of data, no device function may send data back to the host without it being requested.
• Data is transferred between endpoints through “pipes”, think FIFOs, one or more at each end of the cable.
• Four transfer modes are employed:
• Bulk transfers are, as the name suggests, used to move large chunks of data, they have a low priority thus bandwidth may suffer in a system with isochronous and interrupt traffic.
• Isochronous transfers are used where regular data is required, for example streaming audio, each packet being up to about 1K.
• Interrupt transfers are a bit of a misnomer to anyone familiar with microprocessor design, these just guaranteed latency (regular) packets. The function doesn’t interrupt the host, rather the host polls it at a pre-arranged rate
• Control: used for setting up the function, these are short packets.
• Enumeration is in simple terms the process by which the host determines what has been plugged in and the subsequent configuration of it. The unit will for example have to report the vendor and product ID, allowing the host to load suitable device drivers.
• To be allowed to badge and sell USB peripherals the unit must undergo and pass compliance testing.
Other Resources
Glossary:
| USB | Universal Serial Bus |
| OTG | On-The-Go. A supplement to USB2.0 to allow communication between two USB 2.0 devices. This is accomplished with the concept of dual role devices. In this concept host is the A role and peripheral is the B role. OTG provides mechanisms to request the B role (SRP) and temporary role switching (HNP). This standard is under active revision. |
| Bandwidth | The amount of data transmitted per unit of time, typically bits per second (b/s) or bytes per second (B/s. |
| b/s | Transmission rate expressed in bits per second. Also bps especially with a qualifier such as Mbps (mega-bits per second) |
| B/S | Transmission rate expressed in bytes per second. Also Bps as in MBps (mega-bytes per second) |
| Communications Interface | Refers to a USB interfaces that identifies itself as using the Communications Class definition. |
| Downstream | The direction of data flow from the host or away from the host. A downstream port is the port on a hub electrically fastest from the host that generates downstream data traffic from the hub. Downstream ports receive upstream data traffic. |
| Driver | When referring to hardware, an I/O pad that drives an external load. When referring to software, a program responsible for interfacing to a hardware device, that is, a device driver. |
| USB Host | Any device that implements the USB standard to allow one or more USB Devices to connect to it using a USB connection according to the USB 2.0 standard. |
| USB Peripheral | another name for a USB Device. USB is an asymmetrical protocol. The USB Host (q.v.) controls the USB bus. USB allows communication from a USB host to one or more attached USB peripherals (devices). |
| USB Peripheral Controller Driver | used on the USB Device to implement the hardware level I/O for a specific hardware design. |
| Full-speed USB (FS) | USB operation at 12Mbps. This was the usual speed for USB 1.1 devices. See also low-speed and high-speed. |
| Host | The computer system where the USB Host Controller is installed. This includes the host hardware platform (CPU, bus, etc) and the operation system in use. |
| Host Controller | The host’s USB interface. |
| Hub | A USB device that provides additional connections to the USB. |
| HS | High speed. See High-speed USB for details. 2.0 is the highest speed. USB 3.0 introduces USB super speed |
There are no comments on this document