36. Mass storage interfaces
36.1 Overview
STM32MP23/25xx devices embed three types of mass storage interfaces:
- • FMC interface: manages access to external parallel NOR, parallel NAND, or parallel static RAM devices.
- • Octo-SPI interface: manages access to external serial NOR or serial NAND devices.
- • SD/e.MMC interface: manages access to external SD or e.MMC or SDIO devices.
36.2 FMC interface
The FMC is compliant with the RIF (resource isolation framework). See Section 37: Flexible memory controller (FMC).
36.2.1 Main features of the FMC interface
- • NOR/PSRAM:
- – ‘Generic interface’ to parallel NOR/PSRAM or external device 8080 display or external FPGA
- – Parallel NOR flash memory not supported as BOOT device
- – Up to 4 regions (4 CS, 64 Mbytes each), independent memory and RIF configuration for each region
- – 8- or 16-bit data modes
- – Separate or multiplexed address and data buses
- – A clock divided from the kernel clock provided for synchronous devices
- • NAND:
- – SLC NAND
- – Hamming and BCH ECC controllers
- – Supported as BOOT device
- – 4 CS + 1 RnB signals
- – 8- or 16-bit data modes
- – Hardware sequencer which can be used jointly with DMA channels to free the CPU of sequencing tasks
- – RIF compliant
36.2.2 FMC interface block diagram
Figure 203. FMC interface block diagram

The diagram illustrates the FMC interface block diagram. The central FMC block is connected to several external components:
- RCC: Provides clock signals:
ck_ker_fmctokclk,ck_icn_s_fmctoaclk, andck_icn_p_fmctohclk. - Device interconnect: Communicates with the FMC via
AHB slaveandAXI slaveinterfaces. It also connects to theIAC(RIF illegal access controller). - IAC: RIF illegal access controller, which receives inputs from the FMC via
h*_ilac (illegal access)anda*_ilac (illegal access)signals. - HPDMA: Handles DMA requests and acknowledgments:
FMC_TXRXconnects todmareq[0]anddmaack[0].FMC_BCHconnects todmareq[1]anddmaack[1].
- FMC outputs and status signals:
FMC_CLK(bidirectional)FMC_NE[4:1]FMC_NBL[1:0]FMC_NLm_addr[25:0]→FMC_A[25:0], with bit [17] asFMC_ALEand bit [16] asFMC_CLEFMC_NCE[3:0]FMC_AD[15:0]/FMC_D[15:0](bidirectional)FMC_NWEFMC_NOEFMC_NWAIT(input)nd_rnb[0]←FMC_RNBnd_rnb[3:1]←0nd_int[1]→fmc_gbl_ittoCPU1 GICnd_int[2]→fmc_gbl_ittoCPU2 NVIC
MSv66528V2
36.2.3 FMC interface reset
Figure 204. FMC interface reset

The diagram shows the reset path from the RCC block (where FMCRST drives rstn_fmc) to the FMC block, which contains RESETn.
MSv66527V1
There is only one reset for the FMC interface (rstn_fmc) which is controlled by FMCRST in RCC_FMCCFGR register.
36.2.4 FMC interface interrupt
The FMC generates two interrupts, one for each CID that can be attached to the NAND controller:
- • nd_int[1] generated if the CID attached to the NAND controller corresponds to CPU1
- • nd_int[2] generated if the CID attached to the NAND controller corresponds to CPU2
Table 249. FMC interface interrupts
| FMC signal name | CPU1 interrupt | CPU2 interrupt |
|---|---|---|
| nd_int[1] | fmc_gbl_it | - |
| nd_int[2] | - | fmc_gbl_it |
36.3 Octo-SPI interface
The Octo-SPI interface offers two OCTOSPI physical ports. Accesses to the OCTOSPI controllers are protected by RISUP components.
36.3.1 Main features of the Octo-SPI interface
- • Support sNOR and sNAND devices from different families: HyperBus™ compliant devices (HyperRAM™ and HyperFlash™ devices from Spansion, Cypress, including MCP devices which integrate both HyperRAM™ and HyperFlash™), Micron devices (Xcella family), Macronix™ devices.
- • Three functional modes: indirect, automatic-status polling, memory-mapped
- • Up to 4 Gbytes of external memory can be addressed in indirect mode (per physical port and per CS), and up to 256 Mbytes in memory-mapped mode (combined for both physical ports and per CS).
- • Single-, dual-, quad-, and octal-SPI communication
- • Dual-quad communication
- • Single data rate (SDR) and double transfer rate (DTR)
- • Maximum target frequency is 133 MHz for SDR and 133 MHz for DTR
- • Data strobe support
- • DMA channel for indirect mode
- • Support for on-the-fly decryption of data read from an external flash memory:
- – Up to four regions can be defined with independent decryption attributes (execute-only and execute-never) and keys.
- – The decryption applies when the OCTOSPI controller is used in read memory-mapped mode.
- • Encryption support
- • Double CS mapping that allows two external flash devices to be addressed with a single OCTOSPI controller mapped on a single OCTOSPI port.
- • I/O manager (OCTOSPIM):
- – It allows the access to two external flash devices attached to a single OCTOSPI physical port and controlled independently by the OCTOSPI1 and OCTOSPI2 controllers (multiplexed mode).
- – It also allows the swap of the OCTOSPI controllers mapping on the physical ports (OCTOSPI1 controller mapped on OCTOSPI port2, and OCTOSPI2 controller mapped on OCTOSPI port1).
For a complete list of features, refer to:
- • Section 38: Octo-SPI interface (OCTOSPI)
- • Section 62: On-the-fly decryption engine (OTFDEC)
- • Section 39: Octo-SPI I/O manager (OCTOSPIM).
36.3.2 Octo-SPI interface block diagram
Figure 205. Octo-SPI interface block diagram
![Figure 205: Octo-SPI interface block diagram. This diagram illustrates the internal architecture of the OCTOSPI interface. On the left, a Device interconnect and Address mapper are shown. The Address mapper connects to two OTFDEC blocks (OTFDEC1 and OTFDEC2), each with S0 (reg) and S1 (mem) components. These connect to OCTOSPI1 and OCTOSPI2 memory controllers respectively. Each OCTOSPI block contains reg, mem, dma, and it_ospi sections, and is connected to a SYSCFG and DLYBOS block. An Arbitration block sits between the two OCTOSPI controllers. Both controllers interface with an OCTOSPIM (I/O matrix) block. The OCTOSPIM manages connections to Port 1 and Port 2, each with NCLK, CLK, IO[7:0], NCS1, NCS2, and DQS signals. At the bottom right, CPU1 GIC and CPU2 NVIC blocks are shown receiving interrupts from the OCTOSPI and OTFDEC blocks. The diagram is labeled MSv66518V2 at the bottom right.](/RM0457-STM32MP23-25/b3abce429e1ca22b1171e5e59894d4bb_img.jpg)
The OCTOSPI1 and OCTOSPI2 are the memory controllers. They are symmetric and can be accessed by either CPU1 or CPU2.
The OCTOSPIM manages the mapping of OCTOSPI1 and OCTOSPI2 controllers on the two OCTOSPI physical ports. By default, the OCTOSPI1 is mapped on port 1, and the OCTOSPI2 is mapped on port 2, but this can be swapped by software. The OCTOSPIM enables a multiplexed mode where OCTOSPI1 and OCTOSPI2 controllers share dynamically a single physical port. This is useful for instance to support one SPI_NOR and one SPI_NAND devices attached to the same port, and controlled by independent OCTOSPI controllers.
The OTFDEC1 and OTFDEC2 are in charge of on-the-fly decryption of data read from the external memory devices.
The DLYBOS1 and DLYBOS2 are DLL-based programmable delays which are used to tune the phase of RX sampling clocks and TX launch clocks.
36.3.3 Octo-SPI interface resets
Figure 206. OCTOSPI interface resets

Detailed description of Figure 206:
- RCC inputs on left:
- OSPIIOMRST → rstn_octospiiom along with clock ck_icn_p_ospiiom into a Reset Sync block, outputting HCLK and HRESETn to OCTOSPIM.
- OSPI1DLLRST → rstn_ospi1dll input to DLYBOS1 (rst_n).
- OSPI1RST → rstn_ospi1 along with ck_icn_s_ospi1 into a Reset Sync block, outputting HCLK and HRESETn to OCTOSPI1.
- OTFDEC1RST → rstn_otfd1 along with ck_icn_p_otfd1 into a Reset Sync block, outputting HCLK and HRESETn to OTFDEC1.
- OSPI2RST → rstn_ospi2 along with ck_icn_s_ospi2 into a Reset Sync block, outputting HCLK and HRESETn to OCTOSPI2.
- OTFDEC2RST → rstn_otfd2 along with ck_icn_p_otfd2 into a Reset Sync block, outputting HCLK and HRESETn to OTFDEC2.
- OSPI2DLLRST → rstn_ospi2dll input to DLYBOS2 (rst_n).
- Right side components: OCTOSPIM with I/O matrix, OCTOSPI1, OCTOSPI2, OTFDEC1, OTFDEC2, DLYBOS1, and DLYBOS2.
MSv66519V2
There are seven independent resets for the Octo-SPI interface:
- • rstn_octospiiom: controlled by OSPIIOMRST in RCC_OSPIIOMCFGR register
- • rstn_ospi1dll: controlled by OSPI1DLLRST in RCC_OSPI1CFGR register
- • rstn_ospi1: controlled by OSPI1RST in RCC_OSPI1CFGR register
- • rstn_otfd1: controlled by OTFDEC1RST in RCC_OSPI1CFGR register
- • rstn_ospi2dll: controlled by OSPI2DLLRST in RCC_OSPI2CFGR register
- • rstn_ospi2: controlled by OSPI2RST in RCC_OSPI2CFGR register
- • rstn_otfd2: controlled by OTFDEC2RST in RCC_OSPI2CFGR register
When configuring the Octo-SPI interface, the reset sequence to be applied is the following:
- 1. At device reset, OSPIIOMRST, OSPI1DLLRST (respectively OSPI2DLLRST), OSPI1RST (respectively OSPI2RST), OTFDEC1RST (respectively OTFDEC2RST) are all 0. OSPIIOM, DLYBOS1 (respectively DLYBOS2), OCTOSPI1 (respectively OCTOSPI2), OTFDEC1 (respectively OTFDEC2) are under reset because their clocks are disabled.
- 2. Set OSPI1EN (respectively OSPI2EN) to 1. This activates the peripheral clock of OCTOSPI1 and OTFDEC1 (respectively OCTOSPI2 and OTFDEC2) and releases their resets.
- 3. Configure the OCTOSPI1 (respectively OCTOSPI2) and the OTFDEC1 (respectively OTFDEC2) engine.
- 4. Set OSPIIOMEN to 1. This activates the peripheral clock of OCTOSPIM and releases its reset.
- 5. Configure the OCTOSPIM.
- 6. For configurations where the programmable delays must be used:
- a) Wait for the DLL to be locked. This is indicated by LOCK bit in SYSCFG_DLYBOS1SR (respectively SYSCFG_DLYBOS2SR).
- b) Perform a training sequence to determine which delay values correspond to the middle of the valid window for RX sampling (and possibly Tx launching).
For configurations where the programmable delay is not needed, DLYBOS1 (respectively DLYBOS2) can be maintained under reset by setting OSPI1DLLRST (respectively OSPI2DLLRST) to 1.
36.3.4 Octo-SPI interface memory
256 Mbytes are allocated in the STM32MP23/25xx memory map for OCTOSPI1 and OCTOSPI2. This area is used when OCTOSPI1 and/or OCTOSPI2 operate in memory-mapped mode. These 256-Mbyte allocation between OCTOSPI1 and OCTOSPI2 is static and controlled by OCTOSPI_ADDRESS_MAPPING[2:0] in SYSCFG_OCTOSPIAMCR register.
Table 250. 256-Mbyte allocation between OCTOSPI1 and OCTOSPI2
| OCTOSPI_ADDRESS_MAPPING[2:0] | OCTOSPI1 area | OCTOSPI2 area |
|---|---|---|
| 000 | 256 Mbytes 0x6000_0000 -> 0x6FFF_FFFF | 0 Mbyte |
| 001 | 192 Mbytes 0x6000_0000 -> 0x6BFF_FFFF | 64 Mbytes 0x6C00_0000 -> 0x6FFF_FFFF |
| 010 | 128 Mbytes 0x6000_0000 -> 0x67FF_FFFF | 128 Mbytes 0x6800_0000 -> 0x6FFF_FFFF |
| 011 | 64 Mbytes 0x6000_0000 -> 0x63FF_FFFF | 192 Mbytes 0x6400_0000 -> 0x6FFF_FFFF |
| 1xx | 0 Mbyte | 256 Mbytes 0x6000_0000 -> 0x6FFF_FFFF |
36.3.5 OCTOSPI1/2 description
Refer to Section 38: Octo-SPI interface (OCTOSPI).
36.3.6 OCTOSPIM description
Refer to Section 39: Octo-SPI I/O manager (OCTOSPIM).
36.3.7 OTFDEC1/2 description
Refer to Section 62: On-the-fly decryption engine (OTFDEC).
36.3.8 DLYBOS1/2 description
Refer to Section 41: Delay block (DLYB)
One programmable delay is used for each OCTOSPI. These programmable delays are used to tune the phase of:
- • the RX sampling clock (or DQS) in order to sample the data in their valid window
- • the TX launch clock in order to meet setup and hold constraints of TX signals versus the memory clock
The programmable delay block is based on a DLL that compensates for voltage and temperature variations. The DLL features 32 taps and covers the [50 MHz, 208 MHz] frequency range. The clock on which the DLL locks is a free running clock provided by the OCTOSPI. This clock is at the same frequency as the clock sent to the memory. When an Octo-SPI interface operates below 50 MHz, either the programmable delay is not used (standard case), or it must be used in bypass mode (case of OCTOSPI devices with DQS strobe).
Figure 207. Programmable delay block diagram
The DLL architecture is based on one master delay line, and two slave delay lines (RX and TX). There are two operating modes:
- • Lock mode (dll_bypass_cmd_en = 0)
- – This mode can only be used when the dll_clk frequency is in the range [50 MHz, 208 MHz].
- – The DLL is enabled by setting dll_start_lock to 1.
- – The DLL locks on the frequency of the dll_clk input clock, and compensates for voltage and temperature variations. This process determines the command to be applied to each of the 32 delay units (named tap) of the master delay line for the total master delay to represent one period of dll_clk. This command is copied to each delay unit of the RX and TX delay lines. The command varies with voltage and temperature for the DLL to remain locked. This guarantees that each delay unit of the RX and TX delay lines represents 1/32th of the input clock period.
- – Independent delay values can be selected for the RX and TX delay lines by controlling rx_ph_select[5:0] and tx_ph_select[5:0] parameters independently. The granularity of the delay is 1/32th of the input clock period.
| rx_ph_select[5:0] (respectively tx_ph_select[5:0]) | RX delay (respectively TX delay) |
|---|---|
| 000000 | 0 |
| 000001 | 1/32 × T(dll\_clk) |
| ... | ... |
| 011111 | 31/32 × T(dll\_clk) |
| 100000 | 32/32 × T(dll\_clk) |
- – When selecting a new delay value with rx_ph_select[5:0] (respectively tx_ph_select[5:0]), an acknowledge is returned when the change takes place with rx_ph_select_ack (respectively tx_ph_select_ack).
- • Bypass mode (dll_bypass_cmd_en = 1)
- – In this mode, delays in RX and TX delay lines are used as “pure” delays: without trying to lock on the frequency of the dll_clk input clock. There is therefore no voltage nor temperature compensation in this mode, and RX and TX delay values vary with the voltage and the temperature. The command applied to each delay unit of the RX and TX delay lines is controlled by dll_bypass_cmd[4:0]. Each delay unit includes 24 delay elements. The number of delay elements which are enabled in each delay unit depends on the value of dll_bypass_cmd[4:0].
| dll_bypass_cmd[4:0] | Number of delay elements enabled |
|---|---|
| 00000 | reserved |
| 00001 | 1 delay element is enabled |
| 00010 | 2 delay elements are enabled |
| ... | ... |
| 11000 to 11111 | All 24 delay elements are enabled |
- – Independent delay values can be selected for the RX and TX delay lines by controlling rx_ph_select[5:0] and tx_ph_select[5:0] parameters independently. Rx_ph_select[5:0] and tx_ph_select[5:0] control the number of delay units that are enabled in the RX and TX delay lines: a value of n corresponds to n delay units enabled. The total delay inserted by the RX (respectively TX) delay line depends on rx_ph_select[5:0] (respectively tx_ph_select[5:0]) and dll_bypass_cmd[4:0] values.
- – This mode is required to be able to insert a delay between the rx_ip_clk (respectively tx_ip_clk) input clock and the rx_op_clk (respectively tx_op_clk) output clock when the operating frequency is lower than the minimum frequency supported by the DLL (f < 50 MHz). This is necessary to support OCTOSPI devices in DTR mode at low frequency for which DQS must be delayed to sample data.
36.3.9 Octo-SPI interface interrupts
Each OCTOSPI and each OTFDEC instance generate one interrupt.
Table 253. Octo-SPI interface interrupts
| Peripheral | Signal name | CPU1 interrupt | CPU2 interrupt |
|---|---|---|---|
| OCTOSPI1 | it_ospi | octospi1_it | octospi1_it |
| OCTOSPI2 | it_ospi | octospi2_it | octospi2_it |
| OTFDEC1 | irq | otfdec1_it | otfdec1_it |
| OTFDEC2 | irq | otfdec2_it | otfdec2_it |
36.3.10 OCTOSPI mapping on OCTOSPI physical ports
The OCTOSPIM enables several mapping configuration depending on MUXEN and MODE in OCTOSPIM_CR register.
- MUXEN = 0 and MODE = 0 (non multiplexed, non swapped mode):
The OCTOSPI1 is mapped on port1, and the OCTOSPI2 is mapped on port2.
The CS mapping depends on the value of CSSEL in OCTOSPI_CR registers, as well as CSSEL_OVR_01, CSSEL_OVR_02, CSSEL_OVR_EN bits in OCTOSPIM_CR.
Table 254. OCTOSPI1 CS mapping when MUXEN = 0 and MODE = 0
| OCTOSPI1 CSSEL | CSSEL_OVR_EN | CSSEL_OVR_01 | OCTOSPI1 CS mapped on |
|---|---|---|---|
| 0 | 0 | x | OCTOSPIM_P1_NCS1 |
| 1 | 0 | x | OCTOSPIM_P1_NCS2 |
| x | 1 | 0 | OCTOSPIM_P1_NCS1 |
| x | 1 | 1 | OCTOSPIM_P1_NCS2 |
Table 255. OCTOSPI2 CS mapping when MUXEN = 0 and MODE = 0
| OCTOSPI2 CSSEL | CSSEL_OVR_EN | CSSEL_OVR_02 | OCTOSPI2 CS mapped on |
|---|---|---|---|
| 0 | 0 | x | OCTOSPIM_P2_NCS1 |
| 1 | 0 | x | OCTOSPIM_P2_NCS2 |
| x | 1 | 0 | OCTOSPIM_P2_NCS1 |
| x | 1 | 1 | OCTOSPIM_P2_NCS2 |
- MUXEN = 0 and MODE = 1 (non multiplexed, swapped mode):
The OCTOSPI1 is mapped on port2, and the OCTOSPI2 is mapped on port1.
The CS mapping depends on the value of CSSEL in OCTOSPI_CR registers, as well as CSSEL_OVR_01, CSSEL_OVR_02, CSSEL_OVR_EN bits in OCTOSPIM_CR.
Table 256. OCTOSPI1 CS mapping when MUXEN = 0 and MODE = 1
| OCTOSPI1 CSSEL | CSSEL_OVR_EN | CSSEL_OVR_01 | OCTOSPI1 CS mapped on |
|---|---|---|---|
| 0 | 0 | x | OCTOSPIM_P2_NCS1 |
| 1 | 0 | x | OCTOSPIM_P2_NCS2 |
| x | 1 | 0 | OCTOSPIM_P2_NCS1 |
| x | 1 | 1 | OCTOSPIM_P2_NCS2 |
Table 257. OCTOSPI2 CS mapping when MUXEN = 0 and MODE = 1
| OCTOSPI2 CSSEL | CSSEL_OVR_EN | CSSEL_OVR_02 | OCTOSPI2 CS mapped on |
|---|---|---|---|
| 0 | 0 | x | OCTOSPIM_P1_NCS1 |
| 1 | 0 | x | OCTOSPIM_P1_NCS2 |
| x | 1 | 0 | OCTOSPIM_P1_NCS1 |
| x | 1 | 1 | OCTOSPIM_P1_NCS2 |
Note: In non multiplexed mode (MUXEN = 0), two flash devices can be connected to the same port and can be controlled by the same OCTOSPI controller. Both flash devices cannot be used simultaneously. Switching from one device to the other requires the following:
- - to re-program OCTOSPI(1 or 2) CSSEL (or reprogram CSSEL_OVR bits) to remap CS.
- - to re-program the OCTOSPI(1or2) controller.
The figure below gives an example of this possibility where two 8-bit devices are controlled by OCTOSPI1 on port1.
Figure 208. Flash configuration example: 2x 8-bit flash devices controlled by OCTOSPI1 on port1 (MUXEN = 0, MODE = 0, CSSEL_OVR_EN = 0)

The diagram illustrates the connection between OCTOSPI1, OCTOSPIM, and two flash devices (Device 1 and Device 2) in a non-multiplexed, non-swapped mode (MUXEN = 0, MODE = 0, CSSEL_OVR_EN = 0):
- OCTOSPI1 CSSEL value:
- 0 : chip select is mapped to OCTOSPIM_P1_NCS1. OCTOSPIM_P1_NCS2 is inactive. Device1 can be selected.
- 1 : chip select is mapped to OCTOSPIM_P1_NCS2. OCTOSPIM_P1_NCS1 is inactive. Device2 can be selected.
- OCTOSPI1 block inputs/outputs to IO Matrix:
- afo_CSSEL
- afo_ncs
- OSPI1 other signals (bidirectional)
- OCTOSPIM IO Matrix outputs:
- OCTOSPIM_P1_NCLK → Device 1 clock
- OCTOSPIM_P1_CLK → Device 1 data
- OCTOSPIM_P1_IO[7:0] ↔ Device 1 data strobe
- OCTOSPIM_P1_DQS ↔ Device 1 chip select
- OCTOSPIM_P1_NCS1 → Device 2 data strobe
- OCTOSPIM_P1_NCS2 → Device 2 data, clock, chip select
- OCTOSPIM_P2 signals: OCTOSPIM_P2_NCLK, OCTOSPIM_P2_CLK, OCTOSPIM_P2_IO[7:0], OCTOSPIM_P2_NCS1, OCTOSPIM_P2_NCS2, OCTOSPIM_P2_DQS
• MUXEN = 1 and MODE = 0 (multiplexed, non swapped mode):
The OCTOSPI1 and OCTOSPI2 are both mapped on port1. All OCTOSPI signals are multiplexed, including CS. OCTOSPI1 and OCTOSPI2 must not use the same CS line: either CSSEL bits in OCTOSPI1 and OCTOSPI2 must be consistently programmed, or this can be ensured by using the CS override mechanism in OCTOSPIM (CSSEL_OVR_EN = 1) which defines the OCTOSPI CS mapping in a unique cell. The table below shows example programming for this mode.
Table 258. OCTOSPI CS mapping when MUXEN = 1 and MODE = 0
| OCTOSPI1 CSSEL | OCTOSPI2 CSSEL | CSSEL_OVR_EN | CSSEL_OVR_01 | CSSEL_OVR_02 | OCTOSPI1 CS mapped on | OCTOSPI2 CS mapped on |
|---|---|---|---|---|---|---|
| 0 | 1 | 0 | x | x | OCTOSPIM_P1_NCS1 | OCTOSPIM_P1_NCS2 |
| 1 | 0 | 0 | x | x | OCTOSPIM_P1_NCS2 | OCTOSPIM_P1_NCS1 |
| x | x | 1 | 0 | 1 | OCTOSPIM_P1_NCS1 | OCTOSPIM_P1_NCS2 |
| x | x | 1 | 1 | 0 | OCTOSPIM_P1_NCS2 | OCTOSPIM_P1_NCS1 |
- • MUXEN = 1 and MODE = 1 (multiplexed, swapped mode):
OCTOSPI1 and OCTOSPI2 are both mapped on port2. All OCTOSPI signals are multiplexed, including the Chip Selects. Care must be taken that OCTOSPI1 and OCTOSPI2 do not use the same Chip Select line: either CSSEL bits in OCTOSPI1 and OCTOSPI2 must be consistently programmed or this can be ensured by using the chip select override mechanism in OCTOSPIM (CSSEL_OVR_EN = 1) which allows to define OCTOSPI chip select mapping in a unique cell. The table below shows example programming for this mode.
Table 259. OCTOSPI CS mapping when MUXEN = 1 and MODE = 1
| OCTOSPI1 CSSEL | OCTOSPI2 CSSEL | CSSEL_OVR_EN | CSSEL_OVR_01 | CSSEL_OVR_02 | OCTOSPI1 CS mapped on | OCTOSPI2 CS mapped on |
|---|---|---|---|---|---|---|
| 0 | 1 | 0 | x | x | OCTOSPIM_P2_NCS1 | OCTOSPIM_P2_NCS2 |
| 1 | 0 | 0 | x | x | OCTOSPIM_P2_NCS2 | OCTOSPIM_P2_NCS1 |
| x | x | 1 | 0 | 1 | OCTOSPIM_P2_NCS1 | OCTOSPIM_P2_NCS2 |
| x | x | 1 | 1 | 0 | OCTOSPIM_P2_NCS2 | OCTOSPIM_P2_NCS1 |
An example of flash configuration in multiplexed mode (MUXEN = 1) is depicted in Figure 209 where the CS override mechanism in OCTOSPIM is used (CSSEL_OVR_EN = 1). In this example, device1 and 2 are both connected to port 1 (MODE = 0). The device1 is controlled by the OCTOSPI1. The device2 is controlled by the OCTOSPI2.
Figure 209. Flash configuration example: 2x 8-bit flash devices connected to port1 and controlled by independent OCTOSPI controllers (MUXEN = 1, MODE = 0, CSSEL_OVR_EN = 1, CSSEL_OVR_01 = 0, CSSEL_OVR_02 = 1)
![Block diagram showing OCTOSPI1 and OCTOSPI2 connecting to OCTOSPIM IO Matrix, which routes Port 1 signals (OCTOSPIM_P1_NCLK, OCTOSPIM_P1_CLK, OCTOSPIM_P1_IO[7:0], OCTOSPIM_P1_DQS, OCTOSPIM_P1_NCS1, OCTOSPIM_P1_NCS2) to Device 1 and Device 2, while Port 2 signals remain unused.](/RM0457-STM32MP23-25/2e785bc874676d995dd943f621707b90_img.jpg)
MUXEN = 1, MODE = 0 : Multiplexed mode on port1
CSSEL_OVR_EN = 1 : chip select override mechanism is enabled.
CSSEL_OVR_01 = 0 : OCTOSPI1 chip select is mapped to OCTOSPIM_P1_NCS1. OCTOSPI1 controls Device 1.
CSSEL_OVR_02 = 1 : OCTOSPI2 chip select is mapped to OCTOSPIM_P1_NCS2. OCTOSPI2 controls Device 2.
The diagram shows:
- OCTOSPI1: note "OCTOSPI1 CSSEL : value does not matter because is overridden in OCTOSPIM", signals
afo_CSSEL,afo_ncs, andOSPI1 other signalsconnect to OCTOSPIM IO Matrix. - OCTOSPI2: note "OCTOSPI2 CSSEL : value does not matter because is overridden in OCTOSPIM", signals
afo_CSSEL,afo_ncs, andOSPI2 other signalsconnect to OCTOSPIM IO Matrix. - OCTOSPIM IO Matrix Outputs to Port 1:
OCTOSPIM_P1_NCLK(inverted/differential) andOCTOSPIM_P1_CLKconnected to Device 1 clock and Device 2 clock.OCTOSPIM_P1_IO[7:0]connected to Device 1 data and Device 2 data.OCTOSPIM_P1_DQSconnected to Device 1 data strobe and Device 2 data strobe.OCTOSPIM_P1_NCS1connected to Device 1 chip select.OCTOSPIM_P1_NCS2connected to Device 2 chip select.
- Port 2 signals from IO Matrix (unused):
OCTOSPIM_P2_NCLK,OCTOSPIM_P2_CLK,OCTOSPIM_P2_IO[7:0],OCTOSPIM_P2_NCS1,OCTOSPIM_P2_NCS2,OCTOSPIM_P2_DQS.
In multiplexed or non-multiplexed mode, the OCTOSPI interface also supports dual-quad mode. In dual quad mode, two 4-bit devices are connected to the same port and the same Chip Select and are controlled by a unique OCTOSPI controller in order to provide a throughput similar to an 8-bit device. This mode is configured by the bit DQM in OCTOSPI_CR register. An example is shown in the figure below.
Figure 210. Flash configuration example: dual quad mode. Two 4-bit devices are connected to port 2 and controlled by OCTOSPI2 (MUXEN = 0, MODE = 0, CSSEL_OVR_EN = 0)

MUXEN = 0, MODE = 0 : non multiplexed, non swapped mode.
CSSEL_OVR_EN = 0 : chip select override mechanism is disabled.
OCTOSPIM
IO Matrix
OCTOSPIM_P1_NCLK
OCTOSPIM_P1_CLK
OCTOSPIM_P1_IO[7:0]
OCTOSPIM_P1_DQS
OCTOSPIM_P1_NCS1
OCTOSPIM_P1_NCS2
OCTOSPI2 DQM = 1
OCTOSPI2 CSSEL = 0 : OCTOSPI2 chip select is mapped to OCTOSPIM_P2_NCS1
OCTOSPI2
afo_CSSEL
afo_ncs
OSPI2 other signals
OCTOSPIM_P2_NCLK
OCTOSPIM_P2_CLK
OCTOSPIM_P2_IO[3:0]
OCTOSPIM_P2_IO[7:4]
OCTOSPIM_P2_DQS
OCTOSPIM_P2_NCS1
OCTOSPIM_P2_NCS2
Quad Device 1
clock
data[3:0]
chip select
Quad Device 2
chip select
data[3:0]
clock
36.3.11 Octo-SPI interface programmable parameters
Octo-SPI memory area allocation in memory-mapped mode
Refer to Section 36.3.4: Octo-SPI interface memory.
DLYBOS1 control
The DLYBOS1 programmable delay is controlled by bits in SYSCFG_DLYBOS1CR and SYSCFG_DLYBOS1SR registers. The table below gives the correspondence between SYSCFG bitfields and the control parameters described in Section 36.3.8.
Table 260. DLYBOS1 SYSCFG bits
| DLYBOS1 SYSCFG bits | Control input or status output in the OCTOSPI | Comment |
|---|---|---|
| BYP_EN | dll_bypass_cmd_en | Selection of lock or pure-delay mode |
| EN | dll_start_lock | Enable of DLL when configured in Lock mode |
| RX_TAP_SEL[5:0] | rx_ph_select[5:0] | Selection of delay in RX delay line |
| TX_TAP_SEL[5:0] | tx_ph_select[5:0] | Selection of delay in TX delay line |
Table 260. DLYBOS1 SYSCFG bits (continued)
| DLYBOS1 SYSCFG bits | Control input or status output in the OCTOSPI | Comment |
|---|---|---|
| BYP_CMD[4:0] | dll_bypass_cmd[4:0] | Command applied to every delay units in RX and TX delay lines when the DLL is configured in pure-delay mode |
| LOCK | dll_locked | When in lock mode, indicates that the DLL has locked on the input clock frequency |
| RX_TAP_SEL_ACK | rx_ph_select_ack | Indicates that the RX delay line has switched to the delay selected by RX_TAP_SEL[5:0] |
| TX_TAP_SEL_ACK | tx_ph_select_ack | Indicates that the TX delay line has switched to the delay selected by TX_TAP_SEL[5:0] |
DLYBOS2 control
DLYBOS2 programmable delay is controlled by bits in SYSCFG_DLYBOS2CR and SYSCFG_DLYBOS2SR registers. The table below gives the correspondence between the SYSCFG bitfields and the control parameters described in Section 36.3.8.
Table 261. DLYBOS2 SYSCFG bits
| DLYBOS2 SYSCFG bits | Control input or status output in the OCTOSPI | Comment |
|---|---|---|
| BYP_EN | dll_bypass_cmd_en | Selection of lock or pure-delay mode |
| EN | dll_start_lock | Enable of DLL when configured in Lock mode |
| RX_TAP_SEL[5:0] | rx_ph_select[5:0] | Selection of delay in RX delay line |
| TX_TAP_SEL[5:0] | tx_ph_select[5:0] | Selection of delay in TX delay line |
| BYP_CMD[4:0] | dll_bypass_cmd[4:0] | Command applied to every delay units in RX and TX delay lines when the DLL is configured in pure-delay mode |
| LOCK | dll_locked | When in lock mode, indicates that the DLL has locked on the input clock frequency |
| RX_TAP_SEL_ACK | rx_ph_select_ack | Indicates that the RX delay line has switched to the delay selected by RX_TAP_SEL[5:0] |
| TX_TAP_SEL_ACK | tx_ph_select_ack | Indicates that the TX delay line has switched to the delay selected by TX_TAP_SEL[5:0] |
36.3.12 Select the RX sampling strobe and configure the TX clock
The table below lists the various OCTOSPI modes, and gives guidelines to select the RX sampling strobe and configure the TX clock. Some information is also given on how to enable the DLL.
Table 262. OCTOSPI modes and recommended clock configuration
| OCTOSPI Mode | STR or DTR | DQS used in read ? | Max frequency | Setup/Hold constraints on memory device | Data valid Window at output of memory Device | TX clock configuration | RX sampling strobe selection |
|---|---|---|---|---|---|---|---|
| HyperBus( Cypress, Spansion) | DTR | yes | 200 166 133 100 50 | 0.40 / 0.40 ns 0.60 / 0.60 ns 0.80 / 0.80 ns 1 / 1 ns wrt memory clock edges | 1.45 ns 1.70 ns 2.37 ns 3.30 ns | if kernel clock is a multiple of memory clock, set DHQC = 1 (this automatically bypasses the TX delay). If kernel clock is equal to memory clock, set DQHC = 0. The DLL must be used for TX delay. | DQS delayed (DQSE = 1, DLYBYP = 0). The DLL must be used for RX delay. |
| Macronix [For instr. READ, FASTREAD, OCTAREAD-STR] | STR | no | 133 100 66 | 2 / 2 ns 2 / 2 ns 2 / 2 ns wrt memory clock rising edge | 2 ns@10pF 4 ns@15pF 7 ns@30pF | Set DQHC = 0 and configure the TX delay to minimum value. | Feedback clock delayed @133 MHz and 100 MHz (DQSE=0, DLYBYP=0). The DLL must be used for RX delay. Feedback clock @66 MHz (DQSE=0, DLYBYP=1). The DLL is not used for RX delay. |
| Macronix [For instr. OCTAREAD - DTR] | DTR | yes | 133 100 66 | 0.8 / 0.8 ns 1 / 1 ns 1 / 1 ns | 1.5ns@10pF 2.8ns @15pF 4.9ns @30pF | if kernel clock is a multiple of memory clock, set DHQC = 1 (this automatically bypasses the TX delay). If kernel clock is equal to memory clock, set DQHC = 0. The DLL must be used for TX delay. | DQS delayed (DQSE = 1, DLYBYP = 0). The DLL must be used for RX delay. |
| Micron Xcella (MT35XL01 GBBA ds) | STR | no | 133 | 1.8 / 1.8 ns Wrt memory clock rising edge | 2.8ns @12pF | Set DQHC = 0 and configure the TX delay to minimum value. | Feedback clock delayed @133 MHz and 100 MHz (DQSE=0, DLYBYP=0). The DLL must be used for RX delay. Feedback clock @66 MHz (DQSE=0, DLYBYP=1). The DLL is not used for RX delay. |
| Micron Xcella (MT35XL01 GBBA ds) | DTR | yes | 133 | 0.8 / 0.8 ns Wrt memory clock edges | 2 ns | if kernel clock is a multiple of memory clock, set DHQC = 1 (this automatically bypasses the TX delay). If kernel clock is equal to memory clock, set DQHC = 0. The DLL must be used for TX delay. | DQS delayed (DQSE = 1, DLYBYP = 0). The DLL must be used for RX delay. |
DHQC is bit #28 in OCTOSPI_TCR register. DQSE is bit #29 in OCTOSPI_CCR register. DLYBYP is bit #3 in OCTOSPI_DCR1 register.
Enabling the DLL for frequencies greater or equal to 50 MHz (lock mode)
The DLL is enabled by setting EN = 1. The DLL lock state is reached when LOCK = 1. Once the DLL is locked, an RX delay value can be selected by programming RX_TAP_SEL[5:0], and a TX delay value can be selected by programming TX_TAP_SEL[5:0]. Each tap corresponds to 1/32th of the memory device clock period. The selected delays are applied
to RX sampling strobe and TX launch clock once RX_TAP_SEL_ACK and TX_TAP_SEL_ACK are set to 1.
Enabling the DLL for frequencies lower than 50 MHz (bypass mode)
The DLL is enabled by setting BYP_EN = 1. The command applied to every DLL delay unit is defined by BYP_CMD[4:0] bits (the value 0 is reserved and must not be used).
RX_TAP_SEL[5:0] and TX_TAP_SEL[5:0] define the number of elementary delays inserted on RX sampling clock and TX launch clock. For minimum delay, RX_TAP_SEL[5:0] (respectively TX_TAP_SEL[5:0]) must be set to 0.
EN, RX_TAP_SEL[5:0], TX_TAP_SEL[5:0], BYP_EN, BYP_CMD[4:0] bits are located in SYSCFG_DLYBOSnCR (n=1,2) registers. LOCK, RX_TAP_SEL_ACK, TX_TAP_SEL_ACK bits are located in SYSCFG_DLYBOSnSR (n=1,2) registers.
36.4 SD/eMMC interface
The SD/eMMC interface offers three SD/eMMC physical ports. The accesses to the SDMMC controllers are protected by RISUP components.
36.4.1 SD/eMMC interface main features
- • SDMMC1 interface:
- – supports SD cards, eMMC memories, and SDIO devices. Alternate multiplexing is optimized for SD.
- – 1-bit, 4-bit, 8-bit modes.
- – SD: supports SD 3.01 up to UHS-1 modes (SDR104, DDR50, SDR50, DDR25) and all backward compatible modes.
- – eMMC: supports eMMC 5.1 up to HS200 (HS400 not supported)
- – SDIO: supports SDIO 4.0 and all backward compatible modes.
- – SD or eMMC devices are supported as Boot device.
- – DLL to tune the RX sampling clock.
- – SDMMC1 IO segment is in a dedicated \(V_{DDIO1}\) supply domain. Both 1V8 and 3V3 devices are supported. 1V2 is not supported.
- – 3V3 to 1V8 voltage transition for UHS-1 modes of SD card can be supported in two different ways:
- . An SDMMC1_VSEL function is mapped on a GPIO and controls an external voltage regulator to switch from 3V3 to 1V8. This voltage regulator supplies the SDMMC1 IO segment.
- . External Level Shifters are used. The enable of these Level Shifters is controlled by a GPIO and their direction is controlled by SDMMC1_CDIR, SDMMC1_D0DIR and SDMMC1_D123DIR alternate functions.
- • SDMMC2 interface:
- – supports SD cards, eMMC memories and SDIO devices. Alternate multiplexing is optimized for eMMC.
- – 1-bit, 4-bit, 8-bit modes.
- – SD: supports SD 3.01 up to UHS-1 modes (SDR104, DDR50, SDR50, DDR25) and all backward compatible modes.
- – eMMC: supports eMMC 5.1 up to HS200 (HS400 not supported).
- – SDIO: supports SDIO 4.0 and all backward compatible modes.
- – SD or eMMC devices are supported as Boot device.
- – DLL to tune the RX sampling clock.
- – SDMMC2 IO segment is in a dedicated \(V_{DDEMMC}\) supply domain. Both 1V8 and 3V3 devices are supported. 1V2 is not supported.
- – 3V3 to 1V8 voltage transition for UHS-1 modes of SD card can be supported in two different ways:
- . An SDMMC2_VSEL function is mapped on a GPIO and controls an external voltage regulator to switch from 3V3 to 1V8. This voltage regulator supplies the SDMMC2 IO segment.
- . External Level Shifters are used. The enable of these Level Shifters is controlled by a GPIO and their direction is controlled by SDMMC2_CDIR, SDMMC2_D0DIR and SDMMC2_D123DIR alternate functions.
- • SDMMC3 interface:
- – supports SD cards, eMMC memories (limited to 4-bit) and SDIO devices.
- – 1-bit, 4-bit modes.
- – SD: supports SD 3.01 up to UHS-1 modes (SDR104, DDR50, SDR50, DDR25) and all backward compatible modes.
- – eMMC: supports eMMC 5.1 up to HS200 (HS400 not supported).
- – SDIO: supports up to SDIO 4.0 and all backward compatible modes.
- – DLL to tune the RX sampling clock.
- – SDMMC3 IOs do not have a dedicated supply. They are in VDD IO domain. The external device must also be in VDD IO domain or external Level Shifters must be used.
- – 3V3 to 1V8 voltage transition for UHS-1 modes of SD card can only be supported with external Level Shifters. Like for the other SDMMC interfaces, the enable of these Level Shifters is controlled by a GPIO and their direction is controlled by SDMMC3_CDIR, SDMMC3_D0DIR and SDMMC3_D123DIR alternate functions.
For a complete list of features refer to Section 40: Secure digital input/output MultiMediaCard interface (SDMMC).
36.4.2 SD/e•MMC interface block diagram
Figure 211. SD/e•MMC interface block diagram

The diagram illustrates the SD/e•MMC interface architecture within a SoC. A central vertical bar represents the SoC Interconnect. Three SD/e•MMC controller blocks, SDMMC1, SDMMC2, and SDMMC3, are connected to this interconnect via AHB Slave and AHB Master interfaces. Each controller is also linked to a SYSCFG block. SDMMC1, SDMMC2, and SDMMC3 connect to DLYBSD1, DLYBSD2, and DLYBSD3 respectively. Each controller has an IRQ output. SDMMC1, SDMMC2, and SDMMC3 IRQs connect to CPU1 GIC and CPU2 NVIC via sdmmc1_gbl_it, sdmmc2_gbl_it, and sdmmc3_gbl_it signals. The external pins for each controller are: SDMMC1: SDVSEL1, SDMMC1_CK, SDMMC1_CKIN, SDMMC1_CMD, SDMMC1_D[3:0], SDMMC1_D[7:4], SDMMC1_CDIR, SDMMC1_D0DIR, SDMMC1_D123DIR; SDMMC2: SDVSEL2, SDMMC2_CK, SDMMC2_CKIN, SDMMC2_CMD, SDMMC2_D[7:0], SDMMC2_CDIR, SDMMC2_D0DIR, SDMMC2_D123DIR; SDMMC3: SDMMC3_CK, SDMMC3_CKIN, SDMMC3_CMD, SDMMC3_D[3:0], SDMMC3_CDIR, SDMMC3_D0DIR, SDMMC3_D123DIR.
MSv66525V2
36.4.3 SD/eMMC interface reset
Figure 212. SD/eMMC interface resets

The diagram illustrates the reset logic for three SD/eMMC interfaces (SDMMC1, SDMMC2, and SDMMC3) within the RCC (Reset and Clock Control) block. Each interface has a clock input (ck_icn_m_sdmmc1, ck_icn_m_sdmmc2, and ck_icn_m_sdmmc3) and a reset input (SDMMC1RST, SDMMC2RST, and SDMMC3RST). The reset inputs pass through a 'Reset Sync' block before reaching the HRESETn pin of the respective interface. Additionally, each interface has a DLL reset input (SDMMC1DLLRST, SDMMC2DLLRST, and SDMMC3DLLRST) that connects to the rst_n pin of its corresponding DLYBSD block.
36.4.4 SDMMC1/2 description
Refer to Section 40: Secure digital input/output MultiMediaCard interface (SDMMC).
36.4.5 DLYBSD1/2 description
One programmable delay is used for each SDMMC interface. The programmable delay can be used to tune the phase of the RX sampling clock in order to sample the data in their valid window. The programmable delay has no effect on the TX path.
These programmable delays are identical to the ones used in the OCTOSPI interfaces. The clock on which the DLL locks is a free running clock provided by the SDMMC controller which is at the same frequency as the clock sent to the memory. When an SDMMC interface operates below 50 MHz, the programmable delay cannot be used. Refer to Section 36.3.8 for a detailed description.
36.4.6 SD/eMMC interface interrupts
Each SDMMC instance generates one interrupt.
Table 263. SD/eMMC interface interrupts
| Peripheral | pin name | CPU1 interrupt | CPU2 interrupt |
|---|---|---|---|
| SDMMC1 | IRQ | sdmmc1_gbl_it | sdmmc1_gbl_it |
| SDMMC2 | IRQ | sdmmc2_gbl_it | sdmmc2_gbl_it |
| SDMMC3 | IRQ | sdmmc3_gbl_it | sdmmc3_gbl_it |
36.4.7 SD/eMMC interface programmable parameters
Control of external voltage regulator
For SDMMC1 and SDMMC2 interfaces, an external voltage regulator can be used to manage the 3V3 to 1V8 voltage transition for UHS-1 modes of SD card. This external voltage regulator can be controlled by the SDVSEL1 (respectively SDVSEL2) alternate function. These alternate functions are controlled by the following SYSCFG bits:
- • SDMMC1 interface: SDMMC1_VSEL bit in SYSCFG_SDMMC1CR register.
- • SDMMC2 interface: SDMMC2_VSEL bit in SYSCFG_SDMMC2CR register.
PWR_CR8.VDDIO1VRSEL (respectively PWR_CR7.VDDIO2VRSEL) must be controlled according to external voltage regulator transition.
DLYBSD1 control
DLYBSD1 programmable delay is controlled by bits in SYSCFG_DLYBSD1CR and SYSCFG_DLYBSD1SR registers. The table below gives the correspondence between the SYSCFG bitfields and the control parameters described in Section 36.3.8.
Table 264. DLYBSD1 SYSCFG bits
| DLYBSD1 SYSCFG bits | Control input or status output in the SDMMC | Comment |
|---|---|---|
| BYP_EN | dll_bypass_cmd_en | Selection of lock or pure-delay mode |
| EN | dll_start_lock | Enable of DLL when configured in Lock mode |
| RX_TAP_SEL[5:0] | rx_ph_select[5:0] | Selection of delay in RX delay line |
Table 264. DLYBSD1 SYSCFG bits (continued)
| DLYBSD1 SYSCFG bits | Control input or status output in the SDMMC | Comment |
|---|---|---|
| BYP_CMD[4:0] | dll_bypass_cmd[4:0] | Command applied to every delay units in RX and TX delay lines when the DLL is configured in pure-delay mode |
| LOCK | dll_locked | When in lock mode, indicates that the DLL has locked on the input clock frequency |
| RX_TAP_SEL_ACK | rx_ph_select_ack | Indicates that the RX delay line has switched to the delay selected by RX_TAP_SEL[5:0] |
DLYBSD2 control
DLYBSD2 programmable delay is controlled by bits in SYSCFG_DLYBSD2CR and SYSCFG_DLYBSD2SR registers. The table below gives the correspondence between the SYSCFG bitfields and the control parameters described in Section 36.3.8.
Table 265. DLYBSD2 SYSCFG bits
| DLYBSD2 SYSCFG bits | Control input or status output in the SDMMC | Comment |
|---|---|---|
| BYP_EN | dll_bypass_cmd_en | Selection of lock or pure-delay mode |
| EN | dll_start_lock | Enable of DLL when configured in Lock mode |
| RX_TAP_SEL[5:0] | rx_ph_select[5:0] | Selection of delay in RX delay line |
| BYP_CMD[4:0] | dll_bypass_cmd[4:0] | Command applied to every delay units in RX and TX delay lines when the DLL is configured in pure-delay mode |
| LOCK | dll_locked | When in lock mode, indicates that the DLL has locked on the input clock frequency |
| RX_TAP_SEL_ACK | rx_ph_select_ack | Indicates that the RX delay line has switched to the delay selected by RX_TAP_SEL[5:0] |
DLYBSD3 control
DLYBSD3 programmable delay is controlled by bits in SYSCFG_DLYBSD3CR and SYSCFG_DLYBSD3SR registers. The table below gives the correspondence between the SYSCFG bitfields and the control parameters described in Section 36.3.8.
Table 266. DLYBSD3 SYSCFG bits
| DLYBSD3 SYSCFG bits | Control input or status output in SDMMC | Comment |
|---|---|---|
| BYP_EN | dll_bypass_cmd_en | Selection of lock or pure-delay mode |
| EN | dll_start_lock | Enable of DLL when configured in Lock mode |
| RX_TAP_SEL[5:0] | rx_ph_select[5:0] | Selection of delay in RX delay line |
| BYP_CMD[4:0] | dll_bypass_cmd[4:0] | Command applied to every delay units in RX and TX delay lines when the DLL is configured in pure-delay mode |
| LOCK | dll_locked | When in lock mode, indicates that the DLL has locked on the input clock frequency |
| RX_TAP_SEL_ACK | rx_ph_select_ack | Indicates that the RX delay line has switched to the delay selected by RX_TAP_SEL[5:0] |
36.4.8 Guidelines for selecting the RX sampling clock
The tables below list the various SD/eMMC speed modes and gives guidelines to select the RX sampling clock and configure the clock control bits in the SDMMC cell. It is assumed here that no external level shifters are used. Some information is also given on how to enable the DLL.
Table 267. SD speed modes and recommended clock configuration
| Speed Mode | Max card clock freq. SDMMCn_CLK | IO Voltage | Setup/hold constraints on SD device | Data valid Window at output of SD Device | Kernel clock freq (SCLK) | DDR | NEGEDGE | CLKDIV | Selection of RX sampling clock (SELCLKRX) |
|---|---|---|---|---|---|---|---|---|---|
| DS (default speed)(1) | 25 MHz | 3V3 | 5ns/5ns | 26ns | 25 MHz | 0 | NA | 0 (div by 1) | SDMMC_CLKio |
| HS (high speed)(1) | 50 MHz | 3V3 | 6ns/2ns | 8.5ns | 50 MHz | 0 | NA | 0 (div by 1) | SDMMC_CLKio |
| SDR12(1) | 25 MHz | 1V8 | 3ns/0.8ns | 27.5ns | 25 MHz | 0 | NA | 0 (div by 1) | SDMMC_CLKio |
| SDR25(1) | 50 MHz | 1V8 | 3ns/0.8ns | 7.5ns | 50 MHz | 0 | NA | 0 (div by 1) | SDMMC_CLKio |
| DDR50 (2) | 50 MHz | 1V8 | 3ns/0.8ns | 4.5ns | 50 MHz | 1 | (3) | 1 (div by 2) | SDMMC_CLKio |
| SDR50(2) | 100 MHz | 1V8 | 3ns/0.8ns | 4ns | 100 MHz | 0 | NA | 0 (div by 1) | SDMMC_CLKio |
| SDR104 | 208 MHz | 1V8 | 1.4ns/0.8ns | 2,88ns | 208 MHz | 0 | NA | 0 (div by 1) | SDMMC_FB_CLK |
- 1. For these modes, other clock configurations exist where the kernel clock frequency is a multiple of the card clock. However, considering that all three SDMMC controllers have dedicated kernel clocks, it seems more straightforward to align the kernel clock frequency with the card clock frequency.
- 2. For these modes, it is also possible to enable the programmable delay and select the delayed loopback clock (SDMMC_FB_CLK) as RX sampling clock if it is needed to adjust the sampling edge.
- 3. Value to be programmed depend on timings of the interface. For functional simulation, either value works.
| Speed Mode | Max card clock freq. SDMMCn_CLK | IO Voltage(1) | Setup/Hold constraints on SD device | Data valid Window at output of eMMC Device | Kernel clock freq (SCLK) | DDR | NEGEDGE | CLKDIV | Selection of RX sampling clock (SELCLKRX) |
|---|---|---|---|---|---|---|---|---|---|
| Legacy compatible(2) | 26 MHz | 3V3, 1V8, 1V2 | 3ns/3ns | 20ns | 26 MHz | 0 | NA | 0 (div by 1) | SDMMC_CLKio |
| High speed SDR(2) | 52 MHz | 3V3, 1V8, 1V2 | 3ns/3ns | 8ns | 52 MHz | 0 | NA | 0 (div by 1) | SDMMC_CLKio |
| High Speed DDR(3) | 52 MHz | 3V3, 1V8, 1V2 | CMD: 3ns/3ns DATA: 2.5ns/2.5ns | CMD: 8ns DATA: 4.1ns | 104 MHz | 1 | (4) | 1 (div by 2) | SDMMC_CLKio |
| High speed HS200 | 200 MHz | 1V8, 1V2 | 1.4ns/0.8ns | 0.575 UI (2.88ns at 200 MHz) | 200 MHz | 0 | NA | 0 (div by 1) | SDMMC_FB_CLK |
- 1V2 is not supported in STM32MP23/25xx.
- For these modes, other clock configurations exist where the kernel clock frequency is a multiple of the card clock. However, considering that all three SDMMC controllers have dedicated kernel clocks, it seems more straightforward to align the kernel clock frequency with the card clock frequency.
- For this mode, it is also possible to enable the programmable delay and select the delayed loopback clock (SDMMC_FB_CLK) as RX sampling clock if it is needed to adjust the sampling edge.
- Value to be programmed depend on timings of the interface. For functional simulation, either value works.
DDR, NEGEDGE, CLKDIV and SELCLKRX are bitfields in SDMMC_CLKCR register.
The DLL is enabled by writing BYP_EN to 0 and setting EN to 1. The DLL lock state is reached when the status bit LOCK is equal to 1. Once the DLL is locked, a delay value can be selected by programming RX_TAP_SEL[5:0]. The selected delay is applied to the RX sampling clock when the status bit RX_TAP_SEL_ACK is equal to 1. These control and status bits are located in the SYSCFG_DLYBSDnCR and SYSCFG_DLYBSDnSR registers (n=1,2,3).
Sequencing between SDMMC and DLL programming when the DLL is used
- 1. Enable in SDMMC the generation of the free running clock towards the DLL. This is done as soon as PWRCTRL is set to 0b11.
- 2. Once the memory frequency is increased to high speed (i.e. after the initialization sequence), reset and enable the DLL. The reset of the DLL is controlled by SDMMCnDLLRST (n=1,2,3) bit in the RCC. The enable of the DLL is controlled by EN bit in SYSCFG_DLYBSDnCR (n=1,2,3) register.
- 3. Once the DLL is locked (as indicated by LOCK = 1 in SYSCFG_DLYBSDnSR register), select the delayed feedback clock as the RX sampling clock by writing SELCLKRX to 0b10.
- 4. Select the RX delay value by programming RX_TAP_SEL[5:0] in SYSCFG_DLYBSDnCR.
- 5. Wait for RX_TAP_SEL_ACK bit to be set to 1 in SYSCFG_DLYBSDnSR register before reading data from memory.
At startup a tuning phase is required where steps 4 and 5 are repeated for every RX_TAP_SEL[5:0] values. This enables to determine a range of delays where data are read successfully. The delay value corresponding to the middle of this valid range must be selected for further operation.