Configuration of the USB Device Core.
Configuration of the USB Device Core.
The configuration file USBD_Config_n.c contains generic settings for the USB Device and parameters that are necessary to create USB Descriptors . Some parts of the USB descriptors are configured in the respective device class configuration files (USBD_Config_ADC.h, USBD_Config_CDC.h, USBD_Config_CustomClass.h, USBD_Config_HID.h and USBD_Config_MSC.h).
USB Device Core Configuration File
The configuration file USBD_Config_n.c contains the following settings:
- Connect to hardware via Driver_USBD# sets the CMSIS-Driver Number to be used (according to the selected USB controller). For single USB Device Controllers it will be '0'.
- High-Speed may be selected if supported by the USB controller.
- Device Settings are used to create the Device Descriptor.
- Max Endpoint 0 Packet Size sets the maximum packet size for Endpoint 0.
- The Vendor ID (VID) needs to be set to a private VID. The default Vendor ID is owned by Keil and must not be used for actual products. Please visit USB-IF for more information on how to apply for a valid Vendor ID.
- Every device variant needs an unique Product ID. Together with the VID, it is used by the Host computer's operating system to find a driver for your device.
- The Device Release Number will be shown in Windows and Linux systems as “Firmware Revision”. The number will be interpreted as “binary coded decimal”, meaning that 0x0101 will be shown as firmware revision 1.01.
- Configuration Settings are used to create the Configuration Descriptor.
- Power determines whether the device is self- or bus-powered.
- Maximum Power Consumption (in mA) advertises the maximum current drawn from the bus in this specific configuration when the USB Device is fully operational.
- String Settings are used to create the string descriptor within the Device Descriptor.
- Language ID set the product's language.
- Manufacturer String describes the product's manufacturer.
- Product String describes the product.
- Enable Serial Number String to be able to assign a serial number string to the product.
- Default value describes the device's default serial number string when enabled.
- Maximum Length (in characters) describes the maximum number of serial number string characters that can be set at run-time.
- Microsoft OS Descriptor Settings are used to create the Microsoft OS Descriptors.
- Enable OS String for device to contain Microsoft OS string descriptor.
- Vendor Code specifies the vendor code used to retrieve associated feature descriptors.
- Control Transfer Buffer Size specifies the maximum size of control transfer.
- Use the OS Resources Settings to optimize the usage of OS resources.
- The default Core Thread Stack Size is 512 bytes.
- The default Core Thread priority is osPriorityAboveNormal. This priority can be changed by changing USBDn_CORE_THREAD_PRIORITY define in this configuration file. This priority needs to be high enough so that USB Stack can react to USB events in a timely manner. Due to this requirement it is recommended to keep this setting at default.