embedded-trainings-2020/embedded-workshop-book/src/control-transfers.md

21 lines
2.2 KiB
Markdown
Raw Normal View History

2020-07-13 11:48:24 +00:00
# Control Transfers
2020-07-16 09:21:55 +00:00
<p align="center">
2020-07-16 14:03:41 +00:00
<img src="/usb-control.svg" alt="USB hierarchy diagram showing the relationship between configurations, interfaces and endpoints. The diagram consists of nested rectangles. In this version of the diagram the 'control endpoint' rectangle is highlighted in blue.
The outermost rectangle is labeled 'device' and represents the complete USB device.
Inside the 'device' rectangle there is one rectangle labeled 'configuration 1'; this rectangle has a 'parallel lines' symbol that indicates there may be more than one configuration instance; the symbol is labeled 'bNumConfigurations=1' indicating that this device has only one configuration.
Inside the 'configuration 1' rectangle there are two rectangles labeled 'control endpoint' and 'interface 0'. Inside the 'control endpoint' rectangle there are two rectangles labeled 'endpoint 0 IN' and 'endpoint 0 OUT. The 'interface 0' rectangle has a 'parallel lines' symbol that indicates there may be more than one interface instance; the symbol is labeled 'bNumInterfaces=1' indicating that this configuration has only one interface.
Inside the 'interface 0' rectangle there are three rectangles labeled 'endpoint 1 IN', 'endpoint 2 IN' and 'endpoint 2 OUT'. Between these three rectangle there is a label that says 'bNumEndpoints=3'; it indicates that this interface has only three endpoints.">
2020-07-16 09:21:55 +00:00
<p>
2020-07-15 14:28:37 +00:00
Before we continue we need to discuss how data transfers work under the USB protocol.
2020-07-13 11:48:24 +00:00
The control pipe handles *control transfers*, a special kind of data transfer used by the host to issue *requests*. A control transfer is a data transfer that occurs in three stages: a SETUP stage, an optional DATA stage and a STATUS stage.
During the SETUP stage the host sends 8 bytes of data that identify the control request. Depending on the issued request there may be a DATA stage or not; during the DATA stage data is transferred either from the device to the host or the other way around. During the STATUS stage the device acknowledges, or not, the whole control request.
2020-07-16 09:21:55 +00:00
For detailed information about control transfers check section 5.5, Control Transfers, of the [USB 2.0 specification][usb20].
2020-07-16 15:50:38 +00:00
[usb20]: https://www.usb.org/document-library/usb-20-specification