dm00525510 Getting Started With stm32h7 Series SDMMC Host Controller Stmicroelectronics
dm00525510 Getting Started With stm32h7 Series SDMMC Host Controller Stmicroelectronics
Application note
Introduction
The SDMMC (secure digital multimedia card) host interface in the STM32H7 Series provides an interface between the AHB bus
and SD (secure digital) memory cards, SDIO (secure digital input / output) cards and MMC (multimedia card) devices.
This application note describes as an example the SDMMC host interface specific to STM32H743/753 microcontrollers, and
explains how to use the module to transfer data from/to SD, MMC and e-MMC memory cards in multiple configurations.
This document describes the SDMMC interaction with other internal peripherals, and presents typical examples that highlight
the SDMMC host interface features that facilitate its configuration.
1. Maximum bus speed in 4-bit mode for SD& SDIO and 8-bit mode for MMC cards.
2. The maximum data transfer depends on the maximum allowed I/O speed.
AHBS
Cortex-M7 ITCM
DTCM
I/D Cache
SDMMC2
SDMMC1 MDMA
AXIM
SRAM1
SRAM2
AHB3 DLYB SRAM3
FLASH A
AHB2 DLYB
FLASH B
AXI SRAM
QSPI
FMC D2-to-D3 AHB
D2-to-D1 AHB
64-bit AXI bus matrix D1-to-D3 AHB 32-bit AHB bus matrix
D1 domain D2 domain
SRAM4
Backup SRAM
The SDMMC1 is in the D1 domain and the SDMMC2 is in the D2 domain, each one of them have a master
interface connected respectively to the 64-bit AXI bus matrix and the 32-bit AHB bus matrix over an AHB master
bus which can access different memories.
The SDMMC1 and SDMMC2 registers are accessible through their slave interface connected respectively to
AHB3 and AHB2.
Each SDMMC have his own delay block (DLYB) accessible over AHB3 for SDMMC1 and over AHB2 for
SDMMC2. The DLYB can be used to align the sampling clock on the data received (see figure below).
GPIO pin
SDMMC_CK
The master DMA (MDMA) provides a channel for the SDMMC1 to enable successive data transfer from/to TCM
RAMs and any memory region mapped on the three matrixes without any CPU action. The MDMA can also
access the SDMMC1 and SDMMC2 registers and enable a new data transfer using Linked-list mode without any
CPU action.
TCM MDMA
RAMs sdmmc1_dataend_trg
CPU Channel X[0..15] / Stream29
32-bit AHBS
For the next STM32H7 Series revision, two signal triggers from the SDMMC to the MDMA will be added so the
SDMMC will have three signals trigger for the MDMA:
• The data end trigger : sdmmc1_dataend_trg
• The buffer end trigger : sdmmc1_buffend_trg
• The command end trigger : sdmmc1_cmdend_trg
TCM MDMA
RAMs Channel X[0..15] / Stream29 sdmmc1_dataend_trg
CPU
32-bit AHBS sdmmc1_buffend_trg
Channel X[0..15] / Stream30
sdmmc1_cmdend_trg
Channel X[0..15] / Stream31
New signal triggers Any memory region mapped on the three matrixes
The SDMMC1 generate control signals for the external voltage switch transceiver to support the UHS-I mode.
Voltage
STM32 GPIO
EN
regulator VDD
GND VSS
EN
GPIO
SEL
GPIO
SDMMC1
SDMMC_CK
SDMMC_CKIN SD/SDIO card
SDMMC_CDIR External voltage
SDMMC_CMD switch
CLKB
SDMMC_D0DIR
transceiver
CMDB
SDMMC_D0
DAT0B
SDMMC_D123DIR
DAT1B
SDMMC_D1
DAT2B
SDMMC_D2
DAT3B
SDMMC_D3
The table below presents the main features for SDMMC1 and SDMMC2.
Connected to the 64-bit AXI bus matrix Connected to the 32-bit AHB bus matrix
SDMMC master interface in D1 domain through a 32-bit AHB in D2 domain through a 32-bit AHB
master bus master bus
SDMMC slave interface Operating on the AHB3 bus Operating on the AHB2 bus
Domain D1
• AXI SRAM
• Quad-SPI
Domain D1 • FMC
• AXI SRAM
Memory access Domain D2
• Quad-SPI
• SRAM1/SRAM2/SRAM3
• FMC
Domain D3
• SRAM4
• Backup SRAM
SDMMC delay block Operating on the AHB3 bus Operating on the SHB2 bus
• The MDMA provides a channel for
succesful end of data transfer • The MDMA can configure the
MDMA • The MDMA can configure the SDMMC registers to enable a new
SDMMC registers to enable a new data transfer
data transfer
1. Can support external voltage switch transceiver with bus direction sensing (transceiver does not need direction control
signals).
SDMMC interface
SDMMC adapter
Sdmmc_hclk SDMMC_D0DIR
SDMMC_D123DIR
Control unit SDMMC_CDIR
SDMMC_CK
sdmmc_rx_ck
Sdmmc_ker_ck
AHB interface Response sdmmc_io_in_ck
path
DLYB
32-bit AHB Command CLK
sdmmc_fb_ck
slave bus
path MUX
Registers
SDMMC_CKIN
Sdmmc_it
SDMMC_CMD
Data receive
path
Sdmmc_dataend_trg
GPIO
32-bit AHB IDMA
master bus
The SDMMC host interface contains two main interfaces: the adapter interface and the AHB interface. These
interfaces are described in the following sections.
In Double-buffer configuration, the IDMA access one base address and starts the data transfer until all data has
been transferred, then it moves to the second base address and starts another transfer. This allow the firmware to
process the first data buffer while the IDMA is accessing the second memory buffer.
Single-buffer Double-buffer
channel mode channel mode
IDMA access
base address 2
1.3 SDMMC host interface differences between STM32F7 Series and STM32H7
Series
The new SDMMC interface embedded within the STM32H7 Series enhances the SDMMC host capabilities
compared to the previous version of the peripheral embedded in the STM32F7 Series.
The following table contains the main differences between the SDMMC in STM32F7 Series and the SDMMC in
STM32H7 Series.
SDMMC1
SDMMC2
In the pinout panel, the user can chose between SDMMC1 and SDMMC2. The user selects the configuration
mode depending on the desired application and below configurations are created automatically:
• Type of card : SD/SDIO/MMC card
• Bus width: 1-bit , 4-bit , 8-bit mode
• External transceiver: enable/disable command signals for external transceiver.
In the clock configuration panel the user can select the source clock for the sdmmc_ker_ck1 and sdmmc_ker_ck2
either from DIVQ1 or DIVR2. To make the selection, the user scrolls down the panel and finds a figure like the one
below:
In the SDMMC1 and SDMCC2, Clock Mux selects the source clock for sdmmc_ker_ck1 or sdmmc_ker_ck2.
• Enable the Power-save mode (disable the clock when the SDMMC is in idle state and there is no data or
command transfer)
• Enable or disable the hardware flow control (refer to Section 5 SDMMC host interface and hardware flow
control)
• Select the divide factor for the SDMMC_CK (SDMMC_CK = sdmmc_ker_ck / [CLKDIV*2])
In the NVIC Settings tab, the user enables the SDMMC global interrupt then click on the OK button (see figure
below).
The file system FATFS drivers can be added by selecting the middleware configuration as presented in the next
figure:
Finally, in order to configure the MDMA end of data transfer trigger from the SDMMC1, the user selects the
MDMA in the System configuration section.
Once the dialog box is open, the user clicks on the Add a channel button and selects SDMMC1 end of data. Now
the user can configure the MDMA for the data transfer (buffer transfer length, data alignment, source and
destination). See the figure below for an example of the dialog boxes that the user finds when doing this
configuration.
Clock configuration
External transceiver
selection (if needed)
SDMMC GPIO
SDMMC reset
configuration
SDMMC initial
configuration
SDMMC power on
Clock configuration
The RCC registers should be configured to select the clock for sdmmc_ker_ck and SDMMC_hclk.
The figure below illustrates two source clocks for sdmmc_ker_ck for both sdmmc1 and sdmmc2.
PLL
source
mux
HSI
/ DIV Q1
HSE
/ DIV R1
PLL1
To
sdmmc1/2_ker_ck
/ DIV M2 / DIV N2 / DIV P2
/ DIV Q2
SDMMC1/2
/ DIV R2 clock mux
PLL1
With a duty cycle close to 50%, the DIV[P/Q/R]x values shall be even.
For SDMMCx, the duty cycle shall be 50% when supporting DDR.
The configuration of the AHB3/2 clock domain to select the SDMMC_hclk must be done and should respect the
following relation: SDMMC_hclk > ((3x bus width / 32) x SDMMC_CK).
The clock configuration is now completed, sdmmc_ker_ck and SDMMC_hclk are configured but they are not
enabled.
SDMMC power on
The power on of the SDMMC, must be set. Once it is done, the SDMMC is ready for card initialization.
Yes
Yes
Voltage switch sequence
start
The user checks the card version and verify if the card supports UHS-I and if an external voltage switch
transceiver is supported. If yes, the user starts the voltage sequence and defines the card speed as SDR12 (else
define it as normal speed) then move to the card initialization. The support of UHS-I and external transceiver is
optional and it depends on user application.
• Before sending CMD11 check the SDMMC_CK. If it stopped and then busy signal = asserted. If done,
enable the external transceiver, otherwise the SD card do not support that feature.
• Wait for the voltage switch critical timing section completion flag to be set, then check the busy signal. If
done, the voltage switch succeeded and the SD card speed is set to SDR12, otherwise it failed.
• Clear the voltage switch flag and the status flags.
Card initialization
• Send CMD2 to get all cards unique identification number.
• Send CMD3 to set the related card address (RCA).
• Send CMD9 to get the cards specific data (CSD).
5. DDR mode, Bus speed mode and ClockDiv mode must be configured after sending CMD6 because the SD
card switches to the selected speed mode after sending the 64-bytes of data. Changing the clock and bus
mode before sending the command may generate a data read error.
6. Configure the DLYB (if needed) using CMD19 for tuning.
7. Configure the PWRSAV bit. PWRSAV bit stops the clock when the CPSM and DPSM are in Idle state (no
command or data transfer over the bus). Enabling PWRSAV bit before configuring the DLYB causes an error
because the SDMMC_CK is stopped.
Example of CMD6 switch with SDR104:
Card initialization
Card initialization
1. Send CMD2 to get all cards unique identification number.
2. Send CMD3 to set the related card address (RCA).
3. Send CMD9 to get the card the card specific data (CSD).
4. Send CMD13 to check if card is ready.
5. Send CMD8 to get the extended card specific data (EXTCSD).
Configure SDMMC
The detailed steps to configure the wide bus operation are the following:
1. Send CMD6 to select the speed mode (LC, HS or HS200) and wait until the card is ready using CMD13.
2. Send CMD6 to select the bus wide (1-bit, 4-bit, 8-bit) and wait until the card is ready.
The configurations illustrated below are the same for Interrupt, IDMA single buffer and IDMA double buffer modes.
No
Card ready? Card busy
Yes
Data size
Yes
higher than Error
card size?
No
Reset the SDMMC data
control register
Number of No
blocks >1
2. Send block size to the card using CMD16 then send the Write-command block(s).
3. Configure the SDMMC registers for data transfer:
– Set the data timeout.
– Set the data length.
– Set the data block size.
– Configure the data transfer direction (from host to SD/MMC card).
– Configure the data transfer mode block(s).
– Enable the DPSM.
3. Enable CMDTRANS. The CPSM treats the command as a data transfer command, stops the interrupt period
and signals data enable to the DPSM.
4. Configure the SDMMC registers to set the buffer base address for the IDMA and enable the IDMA as Single-
buffer mode.
5. Send the read command block(s).
3. Enable CMDTRANS.
4. Configure the SDMMC registers to set the buffer base address for the IDMA and enable the IDMA as Single-
buffer mode.
5. Send the write command block(s).
Configure the SDMMC registers for Set block size to the card
data transfer (not supported with HS DDR mode for
MMC card)
Yes
The IDMA starts data write from buffer 2
and the CPU fills buffer 1
No
Data count = 0
Yes
Data can be transferred from SD card using file system FATFS in Polling, Interrupt and DMA modes. The
following example (available in STM32Cube_FW_H7_V1.2.0) describes how to create, write and then read a text
document in DMA Single-buffer mode with SDMMC on STM32H743I-EVAL board.
4.1 Imported project files for file system management with SDMMC
In this Example, middleware and BSP files are added to the project for FATFS functions and in order to facilitate
the configuration.
The middleware files contain the FATFS files diskio.c, ff.c and ff_gen_drv.c; and the driver file
sd_diskio_dma.c .
The user can chose the data transfer mode (Interrupt, DMA, and Polling) by modifying or changing the
sd_diskio_dma.c file. It contains the functions for SD initialization, read and write called from the BSP files.
The user needs to select the BSP files depending on the board (as an example here the STM32H743I-EVAL
board) the BSP files contain a set of functions needed to manage the IO pins. User can also integrate his own
BSP files.
The hardware flow control functionality is used to avoid FIFO underrun (TX mode) and overrun (RX mode) errors.
The SDMMC_hclk must respect the following relation:
SDMMC_hclk > ((3x bus width / 32) x SDMMC_CK).
When enabling the hardware flow control, SDMMC_hclk can be a slightly reduced, this action does not cause a
data error but it reducse the SDMMC data speed transfer.
As an example of transferring data in DMA mode with CPU clock frequency = SDMMC_hclk = 37.5 MHz, when
enabling the hardware flow control the CPU clock frequency can reach SDMMC_hclk = 20 MHz but the data
speed transfer is reduced by 33%.
Note: Hardware flow control shall only be used when the SDMMC_Dn data is cycle-aligned with the SDMMC_CK.
Whenever the sdmmc_fb_ck from the DLYB delay block is used (such as in the case of SDR104 mode with a
tOP and DtOP delay > 1 cycle), hardware flow control can not be used. Refer to the device's datasheet for more
information.
The following diagram shows the steps to enable the delay block function:
Unit = 0
Wait LNGF = 1
No
LNG[10:0]>0 and No
Unit = 127?
(LNG[11]=0 or LNG[10]=0)?
Yes
Yes
Unit delay = 10
No Yes
Unit delay = 0?
LNG[unit delay]=1?
No
Yes
Unit delay -- Disable DLYB and select
SEN = 0 another feedback clock:
sdmmc_io_in_ck or
SDMMC_CKIN
SEN = 1
SEN = 0
uint32_t sel=0;
/*select the DLYB feedback clock as input clock*/
MODIFY_REG(hsd->Instance->CLKCR, SDMMC_CLKCR_SELCLKRX, SDMMC_CLKCR_SELCLKRX_1 /*SDMMC_C
LKCR_SELCLKRX_1*/);
/*Enable DLYB with sel = 0 and start tuning proceedure.repeat with updating the value o
f sel until sel = 13 or tuning succeeded */
while (sel!=13)
{
DelayBlock_Enable(DLYB_SDMMC1,sel);
errorstate = tuning(hsd);
if(errorstate == HAL_OK)
{
return errorstate;
}
sel++;
}
/* in case tuning didnt succeed with each selected phase (sel = 13) disable dlyb and se
lect the SDMMC_CKIN */
DelayBlock_Disable(DLYB_SDMMC1);
MODIFY_REG(hsd->Instance->CLKCR, SDMMC_CLKCR_SELCLKRX, SDMMC_CLKCR_SELCLKRX_0/*SDMMC_CLK
CR_SELCLKRX_0*/);
The following diagram shows the steps to enable DLYB with tuning command:
SEL = 0
No
No
Tuning success? SEL++ SEL = 13?
Yes
Yes
The process starts with SEL = 0, then follow the next steps:
1. Select the sdmmc_fb_ck as input clock.
2. Start the DLYB line length configuration procedure , when the delay line length is configured to one input
clock period, select the output clock phase value SEL.
3. Start the tuning process: send CMD19, for tuning it returns 64 bytes of data.
4. Check data CRC error:
– If no data CRC error occurred, DLYB was enabled successfully
– If a data CRC error occurred, reconfigure the DLYB with another clock phase value until the tuning
process succeed or until tuning was tested with all clock phases selection value [0..12] then disable the
DLYB and keep the old configuration of input clock.
7.1 Transfer data from SD card to DTCM memory with SDMMC and MDMA
The following example describes how to configure the MDMA to transfer the data received successfully by the
SDMMC to DTCM memory using end of data transfer trigger.
7.2 Configure the MDMA to enable data transfer with the SDMMC
The following example describes how to configure the MDMA to configure the SDMMC registers to enable data
transfer in DMA Single-buffer mode without any CPU action and using the Linked-list mode.
The following example describes how to execute Normal-boot mode from a multimedia card.
Table 15. Partitions selected to write into and their CMD6 arguments
Table 16. Partitions selected for boot and their CMD6 arguments
Table 17. MMC boot bus widths and their CMD6 arguments
Table 18. MMC speed modes selected for boot and their CMD6 arguments
Table 19. Bus configuration after boot and their CMD6 arguments
After all those steps, the MMC card is configured and ready for boot mode.
1. Send CMD0 with argument = 0xF0F0F0F0 to reset the MMC card to pre-idle state.
2. Wait 74 SDMMC_CK cycles.
3. Reset the DTCTRL register.
4. Configure the DPSM:
– Enable BOOTACKEN.
– Set the acknowledgement timeout and the data timeout (SDMMC_ACKTIMER and SDMMC_DTIMER).
– Set the data block size and the data length.
– Set the transfer direction (from MMC card to SDMMC).
– Set the transfer mode as block mode.
– Disable the DPSM.
5. Enable the following interrupts:
6. Enable the IDMA for Single-buffer transfer mode then configure the CPSM:
– Select the Normal-boot mode.
– Enable boot mode (BOOTEN = 1).
– Enable the CPSM.
9 Conclusion
The STM32H743/753 MCUs offer two new flexible SDMMCs, each one of them offer multiple different features
allowing user to select the best configuration for his application. The SDMMC host interface supports multiple
different memory devices with a very high-speed data transfer. This application note demonstrates the STM32H7
Series SDMMC host interface performances and its flexibility. The user of this interface allows lower development
costs and fasten the time to market.
Revision history
Contents
1 STM32H743/753 SDMMC host interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1 SDMMC host interface in STM32H743/H753 architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 SDMMC host interface block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.1 Adapter interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 SDMMC host interface differences between STM32F7 Series and STM32H7 Series . . . . . 9
3 How to read / write with SDMMC host interface in single / multiple block(s) mode . .21
3.1 Interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2 DMA Single-buffer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.3 DMA Double-buffer mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4 How to read/write with SDMMC host interface using file system FATFS . . . . . . . . . . . .28
4.1 Imported project files for file system management with SDMMC . . . . . . . . . . . . . . . . . . . . . . 28
4.2 File system example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41
List of tables
Table 1. SDMMC supported speed modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Table 2. SDMMC1 and SDMMC2 main features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Table 3. SDMMC internal input/output signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Table 4. SDMMC pins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Table 5. SDMMC differences between STM32F7 Series and STM32H7 Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Table 6. CMD6 data pattern for speed mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 7. CMD6 data pattern for speed mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Table 8. CMD6 data pattern for speed mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Table 9. Interrupts to enable to read in Interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Table 10. Interrupts to enable to write in Interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Table 11. Interrupts to enable to read in DMA Single-buffer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Table 12. Interrupts to enable to write in DMA Single-buffer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Table 13. Interrupts to enable to read in DMA Double-buffer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Table 14. Interrupts to enable to write in DMA Double-buffer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Table 15. Partitions selected to write into and their CMD6 arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Table 16. Partitions selected for boot and their CMD6 arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Table 17. MMC boot bus widths and their CMD6 arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Table 18. MMC speed modes selected for boot and their CMD6 arguments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Table 19. Bus configuration after boot and their CMD6 arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Table 20. Interrupts to enable to configure SDMMC to start Normal-boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Table 21. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
List of figures
Figure 1. SDMMC1 and SDMMC2 internal connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 2. SDMMC and the delay block (DLYB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 3. Master DMA (MDMA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 4. New signal triggers for MDMA and SDMMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 5. Voltage switch transceiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 6. SDMMC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 7. IDMA Single-buffer and Double-buffer channels modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 8. SDMMC pins configuration with STM32CubeMx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 9. sdmmc_ker_ck configuration with STM32CubeMx. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 10. sdmmc_ker_ck source clock selection with STM32CubeMx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 11. SDMMC parameters configuration with STM32CubeMx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 12. SDMMC global interrupt configuration with STM32CubeMx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 13. SDMMC FATFS configuration with STM32CubeMx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 14. MDMA end of data configuration with STM32CubeMx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 15. Synoptic diagram of SDMMC initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 16. Source clock for sdmmc1/2_ker_ck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 17. SD card power on and initialization diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 18. SD card bus wide configuration diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 19. Synoptic diagram of MMC initialization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 20. MMC card bus wide configuration diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 21. Data transfer initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 22. Read/write block(s) commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 23. Read/write data in Interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 24. Read/write data in DMA Single-buffer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 25. Read/write data in DMA Double-buffer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Figure 26. IDMA Double-buffer mode example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Figure 27. Middleware files tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Figure 28. BSP files tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Figure 29. File system example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Figure 30. Delay block configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Figure 31. DLYB configuration with tuning command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Figure 32. MDMA and SDMMC end of data trigger example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Figure 33. MDMA and SDMMC Linked-list mode example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Figure 34. MMC card Normal-boot mode example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Figure 35. SDMMC configuration for Normal-boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38