STM32Cube  Version 2.0
Create Projects for STM32L4 Series with STM32Cube HAL and STM32CubeMX
 All Files Functions Variables Macros Pages
CMSIS-Driver MCI Setup

The CMSIS-Driver MCI requires:

  • Setup of SDIO with DMA for Rx DMA transfers.

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

Peripheral Resource STM32L496G-DISCO STM32L476G-EVAL
SDMMC1 Mode SD 4 bits n/a

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

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

Pinout tab

  1. Configure SDIO mode
    • Peripherals SDMMC1: Mode=SD 4 bits Wide bus

Clock Configuration tab

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

Configuration tab

  1. Under Connectivity open SDMMC1 Configuration:
    • DMA Settings: setup DMA transfers for Rx
      Add - Select SDMMC1_RX: Stream=DMA2 Channel 5, Direction=Peripheral to Memory, Priority=Low Add - Select SDMMC1_TX: Stream=DMA2 Channel 4, Direction=Memory to Peripheral, Priority=Low
    • GPIO Settings: review settings, no changes required
      Pin Name Signal on Pin GPIO mode GPIO Pull-up/Pull..Maximum out User Label
      PC8 SDMMC1_D0 Alternate No pull-up and no..Very High .
      PC9 SDMMC1_D1 Alternate No pull-up and no..Very High .
      PC10 SDMMC1_D2 Alternate No pull-up and no..Very High .
      PC11 SDMMC1_D3 Alternate No pull-up and no..Very High .
      PC12 SDMMC1_CK Alternate No pull-up and no..Very High .
      PD2 SDMMC1_CMD Alternate No pull-up and no..Very High .
    • NVIC Settings: enable interrupts
      Interrupt Table Enable Preemption Priority Sub Priority
      SDMMC1 global interrupt ON 0 0
      DMA2 channel5 global interrupt ON 0 0
      DMA2 channel4 global interrupt ON 0 0
    • Parameter Settings: not used
    • User Constants: not used
    • Click OK to close the SDIO Configuration dialog
  2. Under System open NVIC Configuration:
    • Disable generation of SDMMC1 interrupt handler
    • Click OK to close the NVIC Configuration dialog
  3. Open Project - Settings - Advanced Settings from the menu and enable "Not Generate Function call" for MX_SDMMC1_SD_Init