USB Device Configuration#
This section discusses how to configure Silicon Labs USB Device. There are three groups of configuration parameters, as follows:
USB Device Core Configuration#
Silicon Labs USB Device can be configured at compile time via a set of #defines located in the sl_usbd_core_config.h file. USB Device uses #defines when possible because they allow code and data sizes to be scaled at compile time based on which features are enabled. This allows the read-only memory (ROM) and random-access memory (RAM) footprints of Silicon Labs USB Device to be adjusted based on your application's requirements.
Recommended: Start the configuration process with the default values (highlighted in bold).
The sections below are organized based on the order in the template configuration file, sl_usbd_core_config.h.
Core Configuration#
Table - USB Device Core Configuration Constants#
Constant | Description | Default Value |
---|---|---|
| Configures the stack size in bytes of USBD core task | 4096 |
| Configures the priority of USBD core task. This is a CMSIS-RTOS2 priority. | osPriorityHigh |
| If enabled, the USB device will be automatically started once the kernel is started and that USBD core task is scheduled for the first time. If disabled, your application will need to call | 1 |
| The total number of configurations that will be added via the | 1 |
| The total number of USB interfaces to be added for all your configurations. This greatly depends on the class(es) used. For more information on how many interfaces a class instance requires, refer to the section "Resource Needs from core" of your class(es). | 10 |
| The total number of USB alternate interfaces to be added for all your configurations. This greatly depends on the class(es) used. This value must always be equal or greater than | 10 |
| The total number of USB interface groups that will be added for all your configurations. This greatly depends on the class(es) used. For more information on how many interface groups requires a class instance, refer to the section "Resource Needs from Core" of your class(es). | 2 |
| The total number of Endpoint descriptors that will be added for all your configurations. This greatly depends on the class(es) used. For more information on how many endpoint descriptors a class instance requires, refer to "Number of endpoints" in the section "Resource Needs from Core" of your class(es). Note that the control endpoints don't need to be considered here. | 20 |
| The total number of USB strings. Setting the quantity to zero will disable the feature. Disabling this will cause the device to not store any USB description strings passed from the application. This means the host will be unable to retrieve the description strings (such as manufacturer and product name). | 30 |
| The total number of opened endpoints per configuration. A device requires at least two opened endpoints for control transfers, but you must also add the endpoints of the class(es) used. For more information on how many opened endpoints a class instance requires, refer to "Number of endpoints" in the section "Resource Needs from Core" of your class(es). | 20 |
Classes Configuration#
Classes have specific compile-time configurations. Refer to USB Device Classes for more information.
USB Device Information Configuration#
The sl_usbd_device_config.h configuration file regroups compile-time #define-s to set basic information regarding your device, such as Vendor/Product ID, device strings, etc.
The table below describes each information configuration define available in this configuration file.
Table - USB Device Information Configuration Defines#
Constant | Description |
---|---|
| Your vendor identification number as delivered by the USB Implementers Forum. For more information on how you can obtain a vendor ID, see http://www.usb.org/developers/vendor/ . |
| Your product identification number. |
| Release number of your device. |
| String describing the manufacturer of your device. This configuration is ignored when the configuration |
| String describing your product. This configuration is ignored when the configuration |
| String containing the serial number of your device. This configuration is ignored when the configuration |
| Identification number of the language of your device's strings. Possible values are: |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
This configuration is ignored when the configuration |
USB Device Hardware Configuration#
Depending on the Silicon Labs device you are using, you will possibly have the GPIO pin and port to configure for USB VBUS Sense signal. The configuration defines are in the sl_usbd_hardware_config.h header file.
Constant | Description |
---|---|
| GPIO Port for the USB VBUS Sense signal on your board. |
| GPIO Pin for the USB VBUS Sense signal on your board. |