Difference between revisions of "USB"
(→Speed) |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
== Speed == | == Speed == | ||
− | {| | + | USB is available in different generations: |
+ | |||
+ | {| class=wikitable | ||
|- | |- | ||
| Normal speed | | Normal speed | ||
− | | 1.5 Mbps | + | | 1.5 <= Mbps |
|- | |- | ||
| Full speed | | Full speed | ||
Line 13: | Line 15: | ||
| High speed | | High speed | ||
| <= 480 Mbps | | <= 480 Mbps | ||
+ | |} | ||
+ | |||
+ | == Device classes == | ||
+ | |||
+ | {| class=wikitable | ||
+ | |- | ||
+ | | HID | ||
+ | | Human interface device | ||
+ | |- | ||
+ | | MSC | ||
+ | | Mass storage class | ||
+ | |- | ||
+ | | CDC | ||
+ | | Communication device class | ||
+ | |- | ||
+ | | DFU | ||
+ | | Device firmware update | ||
|} | |} | ||
Line 105: | Line 124: | ||
=== String Descriptors === | === String Descriptors === | ||
− | |||
== Miscellaneous Links == | == Miscellaneous Links == | ||
+ | * [https://github.com/obdev/v-usb/blob/master/usbdrv/USB-IDs-for-free.txt Free USB IDs] | ||
+ | * [https://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/ Tutorial about USB HID Report Descriptors] | ||
+ | * [https://pixcl.com/stm32cubemx-truestudio-and-custom-hid-code/ STM32CubeMX, TrueStudio and Custom HID Code] | ||
+ | * [https://www.programmersought.com/article/79554925960/ STM32 HAL Custom HID] | ||
+ | |||
+ | <!-- | ||
* [https://beyondlogic.org/usbnutshell/usb5.shtml USB In a Nutshell]] | * [https://beyondlogic.org/usbnutshell/usb5.shtml USB In a Nutshell]] | ||
--> | --> |
Latest revision as of 07:37, 1 September 2021
Speed
USB is available in different generations:
Normal speed | 1.5 <= Mbps |
Full speed | <= 12 Mbps |
High speed | <= 480 Mbps |
Device classes
HID | Human interface device |
MSC | Mass storage class |
CDC | Communication device class |
DFU | Device firmware update |
Descriptors
One of the most complex things when developing USB is the descriptors. Descriptors are used by a USB Gadgets to inform the USB Host about it's capabilities.
Overall, USB Descriptors is a hierarchy of descriptors organised like this:
A USB device (or gadget) can only have one device descriptor.
When a USB host enumerates a USB device, the device and configuration descriptors are analysed and one configuration is enabled. Only one configuration can be active at any time.
While it _is_ possible for a host to switch configuration on a device offering more than one, it is very rare for devices to offer more than one configuration.
All descriptors, device, configuration or interface, follow the same common format:
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | Number | Size of the complete descriptor in bytes |
1 | bDescriptorType | 1 | Constant | Descriptor type |
2 | ... | n | Descriptor parameters |
Device Descriptors
The device descriptor represents the entire device and as such each device can only have one of these.
The device descriptor specifies the basic information about the device, such as USB version, packet size, vendor and product id.
Offset | Field | Size | Value | Description |
---|---|---|---|---|
0 | bLength | 1 | Number | Size of the complete descriptor in bytes |
1 | bDescriptorType | 1 | Constant | Descriptor type |
2 | bcdUSB | 2 | BCD | USB specification compliance |
4 | bDeviceClass | 1 | Class | Contains a class code or zero (indicating each interface specifies it's own) or 0xff (class code vendor specified) |
Configuration Descriptors
Interface Descriptors
Endpoint Descriptors
String Descriptors
Miscellaneous Links
- Free USB IDs
- Tutorial about USB HID Report Descriptors
- STM32CubeMX, TrueStudio and Custom HID Code
- STM32 HAL Custom HID