USB

Introduction100px-Usb-logo

Universal Serial Bus (USB) is a standardised bus for connecting peripherals to a computer and other peripherals. Many different peripherals can be connected to a computer using USB, including: mass storage devices (such as flash cards and hard disks), cameras, printers, and input devices such as mice and keyboards. USB devices are plug and play, which means that they can be added and removed without needing to reboot the computer. USB can power low consumption devices directly over the bus.

The USB 1.0 standard specified two data rates: 1.5Mbit/s (Low-Speed) and 12 Mbit/s (Full-Speed). The USB 1.1 specification fixed a number of problems with the 1.0 standard. The USB 2.0 specification adds an additional speed of 480 Mbit/s (Hi-Speed). In practical terms, most USB hi-speed devices can only achieve around half the maximum speed of 480 Mbit/s. Some USB 2.0 devices may not operate at hi-speed unless USB 2.0 compliant cables are used.

More information about USB can be found at: http://www.usb.org/home.

Documentation and specifications for USB can be found here:

ARM USB support is widespread with many chips supporting USB device and USB host.

Device Classes

The USB standard provides a number of device classes, which are standard interface behaviours which devices can conform to. Most operating systems provide full implementations for all known device classes which means that a USB device belonging to a standard device class can be used without any additional drivers or software. Some of the device classes are:

  • Audio devices (Class 0x01)
  • Human Interface Devices (Class 0x03)
  • Mass storage (Class 0x08)
  • Wireless controllers (Class 0xe0)

A full list of the USB device classes can be found at: http://www.usb.org/developers/defined_class/. Some of the devices classes are further divided by a sub-class and protocol identifier. A number of classes have been set aside for vendor specific devices. Vendor specific devices typically require additional software drivers in order to work correctly.

Hosts and Devices

A USB host controller is a machine with a root hub which allows other USB devices to be connected to it. There are three main Host Controller Device (HCD) implementations: Open Host Controller Interface (OHCI), Universal Host Controller Interface (UHCI) and Enhanced Host Controller Interface (EHCI). OHCI and UHCI are competing standards for USB 1.1 devices. UHCI is controller mostly from software making it cheaper to implement than OHCI, with the trade-off that it is more CPU intensive. EHCI is used to controller USB 2.0 hi-speed devices. Linux and Windows CE both support all three standards.

A USB device, or gadget in Linux terminology, is a device which connects to a USB host controller. ARM USB devices can operate as almost any chosen device, emulating a hard drive, mouse, or ethernet adaptor, for example.

Connectors

180px-Usb-connectors
Various USB connectors

USB connectors are available in a number of sizes. The original USB specification details two connectors: type A, which measure 11mm by 4mm, and type B, which measure 7mm by 4mm. The USB 2.0 standard added Mini-USB connectors, and more recently the Micro-USB standard has been introduced. The Micro-USB connectors measure only 7mm by 2mm.

USB pin headers are often placed on carrier boards to allow external USB ports to be connected. Typically these headers are 9 pins, in a 2 by 5 arrangement with one of the corner pins removed, and allow two USB ports to be connected.

Cables

The USB 2.0 specification states that cables should not be longer than 5 meters. Using cables which are longer than this limit can cause the USB host controller to consider a device to be lost if the round trip time exceeds 1500ns. Hubs and active extension cables can be used when USB connections are required over longer distances. Active extension cables are powered over the USB bus and act as a transparent hub. They can extended the maximum cable length to around 50 meters.

Pin out

The pin out for the USB connectors is as follows:

Pin Name Colour Description
1 VCC Red +5V
2 D- White Data-
3 D+ Green Data+
4 GND Black Ground

USB is a differential, bi-directional serial bus. The differential nature of the bus means that the D+ and D- lines are always the opposite of each other (except for some special situations such as reset). This makes the bus more robust, since any noise will affect the D+ and D- pins in the same way resulting in no data loss. Data is transmitted in NRZI (Non Return to Zero Inverted) form. The NZRI form encodes one's as a change on the bus and zero's as no change. USB does clock synchronisation between the host and the device by sending a preamble clocking sequence which toggles the data lines at the clock frequency. The clocking preambles are sent periodically to maintain synchronisation.

Bluewater Systems Experience

Bluewater Systems have implemented USB on ARM on a number of boards, both controllers and devices.

Snapper Ekit

Snapper E-Kit

The Snapper E-Kit is a single board, 66 pin DIP package with an ARM 7 microprocessor. It was designed in association with Canterbury University primarily as a tool for teaching embedded systems design. The Snapper E-Kit is a ARM USB serial device and is powered directly over the bus when connected to a host computer. The Snapper E-Kit is controlled from the host computer by using a serial communications program such as telnet. The user can issue commands such as reading and writing to the pin connectors using a simple command line interface provided via the USB serial link.

USB on the Rig 200

The Rig 200 can function as both a ARM USB host controller and an ARM USB device. A female type A connector is provided for USB host, and a female type B connector for USB device. There is also a USB pin out header on the board which allows a further two USB connectors to be added. When used a USB device the Rig 200 can be powered over the bus, although some features such as the hard drive and expansion modules may not be able to be used when powered via USB. Depending on the Linux kernel configuration the Rig 200 can be used as a USB serial, network, or mass storage.

By adding a USB mouse and keyboard, along with a standard VGA monitor, to a Rig 200, it can be used as a desktop computer.

 

rs1

rs_2

rs_3

rs_4