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

The CMSIS-Driver MCI requires:

  • Setup of SDMMC1 with DMA for Rx and Tx DMA transfers.
  • Optional Configuration for Card Detect Pin:
    • Configure arbitrary pin in GPIO_Input mode and add User Label: MemoryCard_CD0
  • Optional Configuration for Write Protect Pin:
    • Configure arbitrary pin in GPIO_Input mode and add User Label: MemoryCard_WP0
Note
The User Label name is used to connect the CMSIS-Driver to the GPIO pin.

The example below uses correct settings for STM32F746G-Discovery:

  • SDMMC1 Mode: SD 4bits Wide bus
  • Card Detect Input pin: PC13
  • Write Protect Input pin: not available

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

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

Pinout tab

  1. Configure SDMMC1 mode
    • Peripherals SDMMC1: Mode=SD 4 bits Wide bus
  2. Configure Card Detect pin:
    • Click in chip diagram on pin PC13 and select GPIO_Input.

Clock Configuration tab

  1. Configure SDMMC Clock: "To SDMMC (MHz)": 48

Configuration tab

  1. Under Connectivity open SDMMC1 Configuration:

    • DMA Settings: setup DMA transfers for Rx and Tx
      Add - Select SDMMC1_RX: Stream=DMA2 Stream 3, Direction=Peripheral to Memory, Priority=Low
      DMA Request Settings Label Peripheral Memory
      Mode: Peripheral Flow Control Increment Address off ON
      Use Fifo ON Threshold: Full Data Width WORD WORD
      . Burst Size 4 Increm..4 Increm..
      Add - Select SDMMC1_TX: Stream=DMA2 Stream 6, Direction=Memory to Peripheral, Priority=Low
      DMA Request Settings Label Peripheral Memory
      Mode: Peripheral Flow Control Increment Address off ON
      Use Fifo ON Threshold: Full Data Width WORD WORD
      . Burst Size 4 Increm..4 Increm..
    • 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..High .
      PC9 SDMMC1_D1 Alternate No pull-up and no..High .
      PC10 SDMMC1_D2 Alternate No pull-up and no..High .
      PC11 SDMMC1_D3 Alternate No pull-up and no..High .
      PC12 SDMMC1_CK Alternate No pull-up and no..High .
      PD2 SDMMC1_CMD Alternate No pull-up and no..High .
    • NVIC Settings: enable interrupts
      Interrupt Table Enable Preemption Priority Sub Priority
      SDMMC1 global interrupt ON 0 0
      DMA2 stream3 global interrupt ON 0 0
      DMA2 stream6 global interrupt ON 0 0
    • Parameter Settings: not used
    • User Constants: not used

    Click OK to close the SDMMC1 Configuration dialog

  2. Under System open GPIO Pin Configuration
    • Enter user label for Card Detect pin
      Pin Name Signal on Pin GPIO mode GPIO Pull-up/Pull..Maximum out User Label
      PC13 n/a Input modeNo pull-up and no..n/a MemoryCard_CD0
      Click OK to close the Pin Configuration dialog