Configuration of the USB Device Custom Class in µVision.
Configuration of the USB Device Custom Class in µVision.
This configuration file defines:
- The assignment of the Custom Class to the USB Device instance.
- Up to four interfaces that
- can have bulk, interrupt and isochronous IN and OUT endpoints. Every endpoint can be configured for full/low-speed or high-speed operation.
- carry their own class, subclass, and protocol code. Also, an interface string can be defined separately.
- have a independent Interface Descriptor.
- Thread stack size settings for every endpoint separately. To allow parallel functionality of the four interfaces, every endpoint (or pair of IN/OUT endpoints on the same endpoint number) uses one thread.
These settings are used to create the Interface Descriptor and Endpoint Descriptor of the related USB Device Class. It is important that the settings match the application specific behavior in the related C source file USBD_User_CustomClass_n.c.
Custom Class Configuration File
The USB Device Custom Class configuration file USBD_Config_CustomClass_n.h contains the following settings:
- Assign Device Class to USB Device # selects USB Device that is used for this Device Class instance.
- Interface Association enables usage and settings for Interface Association Descriptor (IAD).
- Class Code defines the interface association class code.
- Subclass Code defines the interface association subclass code.
- Protocol Code defines the interface association protocol code.
- Interface
- Interface Settings
- Endpoint Settings
- Endpoint: Select if the specified Endpoint exists in this interface.
- Type sets the type of the endpoint.
- Number sets the number of the endpoint to be used. Conflicting settings are flagged by compile-time error messages.
- Maximum Endpoint Packet Size specifies the physical packet size used for information exchange (in bytes). This setting is available for full/low and high-speed devices.
- Endpoint Polling Interval (in xxx) specifies the frequency of requests initiated by USB Host. This setting is available for full/low and high-speed devices. In case of high-speed device and bulk endpoint it represents maximum NAK rate.
- Additional Transactions per Microframe specifies additional transactions per microframe for improved communication performance. This setting is available only for interrupt or isochronous endpoints on a high-speed devices.
- String Settings
- Interface String Enable is used to enable/disable interface string creation.
- Interface String configures the string descriptor content.
- Microsoft OS Descriptor Settings are used to create the Microsoft OS Extended Compat ID Feature descriptor.
- Extended Compat ID OS Feature Descriptor Function Section is used to configure function section within Extended Compat ID OS Feature descriptor.
- compatibleID configures the function's compatible ID.
- subCompatibleID configures the function's subcompatible ID.
- Extended Properties OS Feature Descriptor are settings used to create the custom property sections within Microsoft Extended Properties OS Feature descriptor.
- Custom Property Section x is used to configure the custom property section x of Microsoft Extended Properties OS Feature descriptor.
- Data Type configures the custom property section x property data format.
- Name configures the custom property section x property name.
- Data configures the custom property section x property data.
- Unicode String configures the custom property section x property data if Data Type is selected as Unicode String.
- 32-bit Integer configures the custom property section x property data if Data Type is selected as 32-bit Integer.
- OS Resources Settings
- Endpoint x Thread Stack Size is used for memory allocation in the USB component.
- The default Endpoint x Thread priority is osPriorityAboveNormal. This priority can be changed by changing USBD_CUSTOM_CLASSn_EPx_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.