Supporting USB

22 Mar

Supporting USB
Many mass-storage devices store files that PCs or other computers must access. To make files available to any PC or other USB host, a device can use either of these approaches:

• Include a USB device controller and support for USB’s mass-storage class. The files can be stored in any media. To access the files from a USB host, attach the device to a USB port on the host.

• Include a USB host controller and a mass-storage driver. The device can then store files on the same USB drives that PCs and other USB hosts can access. To access the files from another USB host, remove the drive from the device and attach the drive to the other host.

An additional option that doesn’t require USB support on the device is to store files in flash-memory cards. To access a card’s contents from a PC, insert the card in a card reader/writer device either built into the PC or attached via USB. (You can also use flash-memory cards as the storage media in a device that has a USB interface.)

A USB device interface is a popular choice for mass-storage devices because it’s inexpensive to implement and convenient to use. Every recent PC has USB 2.0 ports that support the bus speeds used by mass-storage devices: 12 megabits/sec and 480 megabits/sec. Windows and other operating systems support USB’s mass-storage class. A USB host interface is a good solution if you need a host controller to communicate with other devices or if you want to use off-the-shelf USB storage devices.

This chapter introduces the USB interface and USB’s mass storage class.

The Interface in Brief
The Universal Serial Bus is an interface and protocol that enable a single host computer to communicate with a variety of peripheral devices. USB is appropriate for just about any kind of mass-storage device, including hard drives, CD and DVD drives, and flash drives.

The USB specifications are available from the USB Implementers Forum (USB-IF) ( The USB-IF is the non-profit corporation founded by companies involved with developing the USB specification. The USB-IF also sponsors a developers Web forum, provides software and hardware to help in developing and testing products, and develops compliance tests for devices, hosts, and related hardware.

The USB 2.0 specification is the main document that defines the interface.

Hosts and Devices
Every USB communication is between a host and a device. The host is in charge of the bus. Devices communicate only when requested to do so by the host. The only exception is the remote-wakeup feature, which enables a device in the low-power Suspend state to request communications with the host.

A USB host is a computer that contains USB host-controller hardware, a root hub with one or more USB ports, and program code to manage communications and events on the bus. The host-controller hardware formats data for transmitting on the bus and converts received data to a format that host software can understand. The host controller also performs functions related to managing communications on the bus. The root hub has one or more connectors for attaching devices. The root hub, in combination with the host controller, detects newly attached and removed devices, carries out requests received from the host, and passes data between devices and the
host controller.

A USB host can be a desktop or notebook computer, a handheld, or any embedded system that contains host-controller hardware and software. To communicate with mass-storage devices, the host must have a driver that supports the protocols defined for USB’s mass-storage class.

A USB device contains USB device-controller hardware and a microcontroller, CPU, or other intelligent hardware. As Chapter 1 explained, some devices contain a microcontroller with an on-chip USB device controller, while other devices use a microcontroller or CPU that interfaces to a USB controller on a separate chip. The hardware that implements the low-level USB protocols in the device controller is called the serial interface engine (SIE). Program code in a USB device is typically firmware stored in non-volatile memory. Some devices manage USB communications entirely in hardware and require no programming for the USB communications.

A USB device can connect to a host’s root hub or to an external hub. The device can have a standard USB series-B or mini-B receptacle, a vendor-specific connector, or a permanently attached USB cable. The upstream (toward the host) end of the device’s cable has a series-A plug that attaches to a host or hub or a mini-A plug that attaches to an On-The-Go device. Figure 2-1 shows the different plug types.

An On-The-Go (OTG) device is a special kind of USB device that can function as a limited-capability host or as a device. An On-The-Go device has a mini-AB receptacle that can accept a mini-A plug or a mini-B plug. An example of a USB On-The-Go device is a camera that can function as a mass-storage device that stores images that PCs can access via USB and as a host that sends images to a USB printer.

Random Posts

No comments yet

Leave a Reply

You must be logged in to post a comment.