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

The CMSIS-Driver MCI requires:

  • Setup of SDMMC1.
  • Optional Configuration for Card Detect Pin:
    • Configure arbitrary pin in GPIO_Input mode and add User Label: MemoryCard_CD0
    • Alternatively, define MemoryCard_CDx_Pin_Extern and implement function MCI_ReadCD in application
  • Optional Configuration for Write Protect Pin:
    • Configure arbitrary pin in GPIO_Input mode and add User Label: MemoryCard_WP0
    • Alternatively, define MemoryCard_WPx_Pin_Extern and implement function MCI_ReadWP in application
  • Configuring data buffers to reside in:
    • AXI SRAM when using SDMMC1 (Driver_MCI0)
    • AHB SRAM when using SDMMC2 (Driver_MCI1)
Note
The User Label name is used to connect the CMSIS-Driver to the GPIO pin.

The example below uses correct settings for STM32H743I-EVAL:

  • SDMMC1 Mode: SD 4bits Wide bus with dir voltage converter
  • Card Detect Input pin: available by using MFX GPIO15 from application
  • 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 with dir voltage converter

Clock Configuration tab

  1. Configure SDMMC1,2 Clock Mux: Select PLL1Q or PLL2R clock source and set frequency below 200MHz.

Configuration tab

  1. Under Connectivity open SDMMC1 Configuration:

    • GPIO Settings: review settings, no changes required
      Pin Name Signal on Pin GPIO mode GPIO Pull-up/Pull..Maximum out User Label
      PB8 SDMMC1_CKIN Alternate No pull-up and no..Very High .
      PB9 SDMMC1_CDIR Alternate No pull-up and no..Very High .
      PC6 SDMMC1_D0DIR Alternate No pull-up and no..Very High .
      PC7 SDMMC1_D123DIRAlternate No pull-up and no..Very High .
      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
    • Parameter Settings: not used
    • User Constants: not used

    Click OK to close the SDMMC1 Configuration dialog

  2. Under System open NVIC Configuration:

    • Code generation: Deselect "Generate IRQ Handler" for SDMMC1 global interrupt
    • NVIC: review settings, no changes required

    Click OK to close the NVIC Configuration dialog