Respond to Standard Requests

22 Mar

Respond to Standard Requests
On power-up or on attachment to a powered host, a device must respond to standard requests sent by the host during enumeration. The host may also send requests any time after enumeration completes. The requests query the capabilities and status of the device or request the device to take other action.

Handle Error Checking
When transmitting data, the device adds error-checking bits. When receiving data, the device uses received error-checking bits to detect errors.

Exchange Data with the Host
All of the above tasks support the main job of the device’s USB port, which is to exchange data with the host.

Each device on the bus has an address and every transaction between a host and a device contains a device address. On detecting a matching address, a device must return requested data or status information. A device may store received data and trigger an interrupt to notify device firmware that a communication has occurred.

Implement the Device’s Function
Of course, a device must also do anything required to implement its function. For some mass-storage devices, the device’s only task is to store blocks of data received from the host and send blocks of data requested by the host.

Other mass-storage devices have additional duties such as operating as a camera, data logger, or other special-function device.

Bus Speeds
The USB 2.0 specification defines three bus speeds: high speed at 480 megabits/sec., full speed at 12 megabits/sec., and low speed at 1.5 megabits/ sec. A USB mass-storage device must support full speed, high speed, or both. Almost all high-speed devices also support full speed because adding support for full speed is rarely difficult and enables the device to work when attached to full-speed hosts. USB hosts in recent PCs support all three speeds. An On-The-Go host or an embedded host with mass-storage support can support full speed, high speed, or both.

The bus speeds describe the rate that information travels on the bus. In addition to data, the bus must carry status, control, and error-checking signals. Plus, all peripherals must share the bus. So the data throughput for a device is always less than the bit rate on the bus.

In theory, on an otherwise idle bus, a full-speed device can transfer just over 1.2 megabytes/sec., and a high-speed device can transfer more than 53 megabytes/sec. Some full-speed hosts can achieve the maximum speed or close to it. At this writing, some high-speed hosts can transfer close to 40 megabytes/sec. The actual rate of data transfer varies depending on the efficiency of the host’s and device’s programming, how busy the bus is, and hardware capabilities of the host and drive.

All bus traffic is to or from device endpoints. An endpoint serves as a buffer for received data or data waiting to transmit. Typically an endpoint is a block of data memory or a register in the device controller.

Every device must have endpoint zero, which is the default endpoint used for control transfers. Endpoint zero is bidirectional.

A device can have up to 30 additional endpoint addresses. Each of these endpoint addresses has a number (1 to 15) and direction (IN or OUT). The direction is defined from the host’s perspective: an IN endpoint provides data to send to the host and an OUT endpoint stores data received from the host. Device hardware or firmware configures each endpoint address for a specific USB transfer type. The number of available endpoints and supported transfer types vary with the device controller. A mass-storage device must have one IN endpoint and one OUT endpoint in addition to endpoint zero.

Random Posts

No comments yet

Leave a Reply

You must be logged in to post a comment.