This driver requires the STM32 device specific HAL and STM32CubeMX (CubeMX) initialization code generator. The driver instance is mapped to hardware as shown in the table below:
CMSIS Driver Instance | STM32 Hardware Resource |
---|---|
Driver_USBH0 | USB_OTG_FS or USB_FS or USB_DRD_FS |
Driver_USBH1 | USB_OTG_HS |
This driver has the following deviations from the CMSIS-Driver specification:
Conceptual deviations:
main.c
.Functional deviations:
This driver requires the following configuration in CubeMX:
Pin | Functionality |
---|---|
PA11 | USB_OTG_FS_DM |
PA12 | USB_OTG_FS_DP |
PA5 | USB_OTG_HS_ULPI_CK |
PA3 | USB_OTG_HS_ULPI_D0 |
PB0 | USB_OTG_HS_ULPI_D1 |
PB1 | USB_OTG_HS_ULPI_D2 |
PB10 | USB_OTG_HS_ULPI_D3 |
PB11 | USB_OTG_HS_ULPI_D4 |
PB12 | USB_OTG_HS_ULPI_D5 |
PB13 | USB_OTG_HS_ULPI_D6 |
PB5 | USB_OTG_HS_ULPI_D7 |
PI11 | USB_OTG_HS_ULPI_DIR |
PH4 | USB_OTG_HS_ULPI_NXT |
PC0 | USB_OTG_HS_ULPI_STP |
Under Categories: Connectivity select USB_OTG_FS:
Mode:
Configuration:
Pin Name | Signal on Pin | Pin Context.. | GPIO output.. | GPIO mode | GPIO Pull-up/Pull.. | Maximum out.. | Fast Mode | User Label |
---|---|---|---|---|---|---|---|---|
PA11 | USB_OTG_FS_DM | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PA12 | USB_OTG_FS_DP | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
Under Categories: Connectivity select USB_OTG_HS:
Mode:
Configuration:
Pin Name | Signal on Pin | Pin Context.. | GPIO output.. | GPIO mode | GPIO Pull-up/Pull.. | Maximum out.. | Fast Mode | User Label |
---|---|---|---|---|---|---|---|---|
PA5 | USB_OTG_HS_ULPI_CK | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PA3 | USB_OTG_HS_ULPI_D0 | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PB0 | USB_OTG_HS_ULPI_D1 | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PB1 | USB_OTG_HS_ULPI_D2 | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PB10 | USB_OTG_HS_ULPI_D3 | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PB11 | USB_OTG_HS_ULPI_D4 | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PB12 | USB_OTG_HS_ULPI_D5 | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PB13 | USB_OTG_HS_ULPI_D6 | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PB5 | USB_OTG_HS_ULPI_D7 | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PI11 | USB_OTG_HS_ULPI_DIR | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PH4 | USB_OTG_HS_ULPI_NXT | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
PC0 | USB_OTG_HS_ULPI_STP | n/a | n/a | Alternate Function Push Pull | No pull-up and no.. | High | n/a | . |
Under Categories: System Core select NVIC:
Configuration:
NVIC Interrupt Table | Enabled | Preemption Priority | Sub Priority |
---|---|---|---|
USB On The Go HS global interrupt | checked | 0 | 0 |
USB On The Go FS global interrupt | checked | 0 | 0 |
Enabled interrupt table | Select for.. | Generate Enable in.. | Generate IRQ h.. | Call HAL handler |
---|---|---|---|---|
USB On The Go HS global interrupt | unchecked | checked | checked | checked |
USB On The Go FS global interrupt | unchecked | checked | checked | checked |
Under Advanced Settings:
Generated Function Calls:
Generate Code | Function Name | Peripheral Inst.. | Do not generate .. | Visibility (Static) |
---|---|---|---|---|
checked | MX_USB_OTG_FS_HCD_Init | USB_OTG_FS | unchecked | checked |
checked | MX_USB_OTG_HS_HCD_Init | USB_OTG_HS | unchecked | checked |
If VBUS pin is not under control of USB Controller but is controlled with GPIO or Multi Function eXpander (MFX) then it is necessary to provide hardware-specific function USBH_HW_VbusOnOff for VBUS pin control.
Example: