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

The CMSIS-Driver MCI requires:

  • Setup of SDIO 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_CD
  • Optional Configuration for Write Protect Pin:
    • Configure arbitrary pin in GPIO_Input mode and add User Label: MemoryCard_WP
Note
The User Label name is used to connect the CMSIS-Driver to the GPIO pin.

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

Peripheral Resource MCBSTM32F200 STM3220G-EVAL
SDIO Mode SD 4 bits SD 4 bits
Card Detect Input pin PH15 PH13
Write Protect Input pin n/a n/a

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 SDIO mode
    • Peripherals SDIO: Mode=SD 4 bits Wide bus
  2. Configure Card Detect pin:
    • Click in chip diagram on pin PH15 and select GPIO_Input.

Clock Configuration tab

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

Configuration tab

  1. Under Connectivity open SDIO Configuration:

    • DMA Settings: setup DMA transfers for Rx and Tx
      Add - Select SDIO_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 SDIO_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
      SDIO 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 SDIO 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
      PH15 n/a Input modeNo pull-up and no..n/a MemoryCard_CD

    Click OK to close the Pin Configuration dialog