CONCEPT OF PIPES & END POINT
The ports are used to connect the peripheral devices like mouse, keyboards, or audio devices to them. Each device is given a specific address used during the communication process by the host. These devices are connected to the root hub and in turn to the host by pipes. A pipe is a logical connection between the host and end point and is used by client software to transfer data. It sets various parameters such as direction of data flow, length of bandwidth allocated to the device and what kind of transfer will take place. There are two types of pipes in USB one is stream pipe and other is message pipe.
· Stream Pipes- It is unidirectional communication pipes used for most of the data transfers. These pipes have no defined USB format. We can send any type of data from one end and retrieve it from another end. Data flows sequentially and has a pre-defined direction either IN or OUT. Stream pipes support bulk, isochronous and interrupt type of transfers and controlled by either host or device.
· Message Pipes- It is bi-directional communication pipes and only used for sending/receiving short messages. These pipes have defined USB format. They are host controlled initiated by request sent from the host. Data is transferred in the desired direction as per the request. They support only control transfers.
Once we have understood the pipes we learn about various types of data transfers. Depending on the type of data we need to decide which type of pipe to use.
There are four different types of data transfer in USB.
1.Control Transfer- It is used to send commands to the devices for making enquiries. This transfer uses Message pipes.
2. Interrupt Transfers- It is used to send small amount of data that requires a guaranteed minimum time delay. It uses Stream pipes.
3.Bulk Transfer- It is used for transferring large amount of data with no time guarantee and uses Stream pipes
4. Isochronous Transfers- it is used for transferring data that requires a fixed delivery rate as they are capable of fixed bus bandwidth and lack of error correction. Since there is no error correction there is no delay in transfer of data. These transfers use Stream pipes.
In between the device and host there is addressable buffer which is known as endpoint. An endpoint is an electrical terminal usually consists of a set of memory registers that stores the data temporarily in USB peripheral devices on their way in or out. An endpoint stores received data from the host and holds the data to be transmitted to the host. A USB device can have multiple endpoints and each endpoint has a pipe associated with it. Each endpoint is accessed with a device address assigned by the host and an endpoint number that is assigned by the device. Endpoints usually come in pairs, e.g. Endpoint 1 In and Endpoint 1 Out. One set of Endpoints, Endpoint 0 In and Endpoint 0 Out is always turned on which is used for basic commands to all USB devices.
Enumeration Step.
1.The
user plugs the device into a USB port.
2.The
hub detects the device.
3.The
host learns of the devices presence from the hub (Get Port Status Request)
4.The
hub detects whether a device is Low speed or Full Speed.
5.The
hub resets the device.
6.The
host learns if a full speed device supports high speed.
7.The
hub establishes a signal path between the device and the bus.
8.The
host sends a Get Descriptor Request to learn the maximum packet size of the
default pipe.
9.The
host assigns an address (Set Address Request).
10.The
host learn about a devices abilities (Get Descriptor Request).
11.The
host assigns and loads a device driver.
12.The
host’s device driver selects a configuration (Set Configuration Request).