Saturday, November 7, 2009

USB-2nd part

USB Data Transfer Protocol

The USB device consist of a logical entity called Endpoints in it through which the data transfer takes place. An USB device can have multiple Endpoints. The connection between the Endpoint and the host is called logical pipes. The device driver of the host sends data to the endpoint for any type of data transfer require point. It will send data to the Endpoint1-out buffer (for example) while will receive the incoming data packets in the Endpoint1-in buffer. Each device must support Endpoint0 which is used for the control transfer while the other are used for data transfer

Types Of Data Transfer

The types of data transfer are

1:- Control Transfer: - This type of transfer takes place for command and status operation like resetting or enumeration commands. Enumeration is the initialization of the of the USB device for the data transfer by communicating with the endpoint0. The steps taken for the process are as follows.

The host generates a setup token, which helps the incoming packet to recognize as the setup packet, to the endpoint0. The endpoint is selected by default as all the control transfers are done via the endpoint0. The host then sends the 8 bytes DATA0 packet requesting the device descriptor of the USB device, which will help the OS of the host to load the appropriate driver to recognize and control the USB device, to the endpoint0-out buffer. The USB device will acknowledge the packet if there is no error otherwise if the packet is corrupted then it just ignores the packet. The host will resend it in the next few seconds. The device descriptor request as send by the host to the endpoint0-out buffer is then checked and the device sends the device descriptors. But it sends these descriptors only when the host is ready to receive it which is indicated by the issuing of IN token by the host to the device. Then the device will send the device descriptor values to the endpoint0-in buffer.A small comparison between the OUT and IN concept is given below---
a: OUT :- Whenever the host wants to send any data it issues an out token followed by a data packet which is received by the device endpointx-out buffer and if there is no error an acknowledgement is send to the host.
b:- IN :- Whenever a host wants to receive something it issues an IN token which is received by the device and then it sends the data as requested by the host in the previous OUT data-packet, to the endpointx-in buffer.

Remember that the direction of data transfer is based with reference to the host not the device.

2:- Isochronous Transfer: - Isochronous transfers occur continuously and periodically. They typically contain time sensitive information, such as an audio or video stream

3:- Interrupt Transfer


Bulk Transfer: - Bulk transfers can be used for large bursty data. Such examples could include a print-job sent to a printer or an image generated from a scanner. These is supported only by the high speed or the full speed devices

Fields of Set-up Packet:-


The Setup Packet contains the following fields:-

bmRequestType , bRequest, wValue, wIndex, wLength


Depending upon various type of requests like

Standard device request, Standard Interface request, Standard endpoint request the above mentioned fields has different values


No comments:

Post a Comment