Configuration of the USB Host Core.
Configuration of the USB Host Core.
The configuration file USBH_Config_n.h contains generic settings for the USB Host. Support for certain USB Classes is configured in the respective device class configuration files (USBH_Config_CDC.h, USBH_Config_CustomClass.h, USBH_Config_HID.h and USBH_Config_MSC.h).
USB Host Configuration File
The USB Host configuration file USBH_Config_n.h contains the following settings:
- Connect to hardware via Driver_USBH# specifies the hardware driver number to use in case that microcontroller device contains more than one USB Host interface. For device with single USB Host Controller it will typically be '0'.
- Maximum Port Power Delivery (in mA) specifies maximum current that a port can source (in mA). USB Devices exceeding this requirement will not be usable by the USB Host.
- Maximum Pipes in System specifies the maximum number of active pipes (pipe is a communication channel to an USB Device endpoint).
- Memory Pool specifies the size of the USB memory pool and is also used for locating the USB memory pool in a specific memory.
- Size specifies the size of the USB memory pool (in bytes) that the USB Host controller will use for the USB communication data. This size should be at least equal to the size of the maximum expected packet + 128 bytes.
- Locate specifies if the USB memory pool is located in a specific memory (via the linker script). This is usually necessary in case that USB Controller has some specific requirements regarding memory for USB transfers. For example if USB Controller can only access specific memory, or if this memory needs to be non-cacheable.
- Section Name specifies the section name for the USB memory pool that is used by the linker script to position it in memory. Default section name is
.driver.usbh<instance>
, for example for USB Controller 0 the default section name is .driver.usbh0
.
- Use the OS Resources Settings to optimize the usage of OS resources.
- The default Core Thread Stack Size is 2048 bytes.
- The default Core Thread priority is osPriorityAboveNormal. This priority can be changed by changing USBHn_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.