USB Component
Version 6.17.0
MDK Middleware for USB Device and Host Communication
|
USB is a polled bus, where the USB Host initiates all data exchanges. The data travels to or from Endpoints in an USB Device. The client in the USB Host stores data in buffers, but does not have endpoints. The USB Host and the peripheral USB Device have distinct layers, as shown in the picture below. The connections between the layers are logical Host-Device interfaces between each horizontal layer. Between the logical connections data is transferred using Pipes.
Basically, two types of pipes exist:
Most pipes come into existence when an USB Device has been connected to the USB Bus and configured by the USB Host. A pipe originates from a data buffer within the host client and terminates inside the USB Device at an Endpoint.
Transfers (data flow types) can consist of one or more transactions. A pipe supports only one of the following transfer types:
Endpoints can be described as data sources or sinks and exists in USB Devices only. The data stored at an endpoint may either be received from or waiting for being sent to the USB Host. An endpoint can be configured to support four transfer types defined in the USB specification (Control Transfers, Interrupt Transfers, Isochronous Transfers, and Bulk Transfers). Within the limits of the hardware, endpoints can be configured using the USB Middleware (e.g. limit an endpoint to a certain transfer type).
An endpoint acts as a kind of buffer. A USB Host's client may send data to Endpoint 1 for example. Coming from the USB Host, the data will be sent to the OUT Endpoint 1. The program on the microcontroller will then read the data as soon as it is ready to do so. Returning data has to be written to the IN Endpoint 1, as the program cannot access the USB bus freely (the USB bus being controlled by the USB Host). The data in IN Endpoint 1 stays there until the host sends an IN packet to Endpoint 1 requesting the data.
These rules apply to all microcontroller devices: