STM32Cube  Version 2.0
Create Projects for STM32F2 Series with STM32Cube HAL and STM32CubeMX
 All Files Pages
CMSIS-Driver USBD_FS Setup

The CMSIS-Driver USBD_FS requires:

  • Setup of USB clk to 48MHz
  • Configuration of USB_OTG_FS

Valid settings for various evaluation boards are listed in the table below:

Peripheral Resource MCBSTM32F200 STM3220G-EVAL
USB_OTG_FS Mode Device_only Device_only
Activate_VBUS enabled enabled

For different boards, refer to the hardware schematics to reflect correct setup values.

The STM32CubeMX configuration for MCBSTM32F200 with steps for Pinout, Clock, and System Configuration are listed below. Enter the values that are marked bold.

Pinout tab

  1. Configure USBD mode
    • Peripherals USB_OTG_FS: Mode=Device_Only
    • Peripherals USB_OTG_FS: Activate_VBUS=enabled

Clock Configuration tab

  1. Configure USB Clock: "48MHz clocks (MHz)": 48

Configuration tab

  1. Under Connectivity open USB_OTG_FS Configuration:
    • DMA Settings: not used
    • GPIO Settings: review settings, no changes required
      Pin Name Signal on Pin GPIO mode GPIO Pull-up/Pull..Maximum out User Label
      PA11 USB_OTG_FS_DM Alternate No pull-up and no..High .
      PA12 USB_OTG_FS_DP Alternate No pull-up and no..High .
      - NVIC Settings: enable interrupts
      Interrupt Table Enable Preemption Priority Sub Priority
      USB On The Go FS global interrupt ON 0 0
      - Parameter Settings: not used
    • User Constants: not used
    • Click OK to close the USB_OTG_FS Configuration dialog
  2. Under System Core open NVIC Configuration and select Code generation tab:
    • Disable Generate IRQ handler for USB On The Go HS global interrupt