36. Mass storage interfaces

36.1 Overview

STM32MP23/25xx devices embed three types of mass storage interfaces:

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

36.2.2 FMC interface block diagram

Figure 203. 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:

MSv66528V2

Figure 203. FMC interface block diagram

36.2.3 FMC interface reset

Figure 204. 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

Figure 204. FMC interface reset

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:

Table 249. FMC interface interrupts

FMC signal nameCPU1 interruptCPU2 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

For a complete list of features, refer to:

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.
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.

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

Figure 206. OCTOSPI interface resets block diagram showing connections from RCC signals, clock/reset inputs through Reset Sync blocks to OCTOSPI1, OCTOSPI2, OTFDEC1, OTFDEC2, DLYBOS1, DLYBOS2, and OCTOSPIM.

Detailed description of Figure 206:

MSv66519V2

Figure 206. OCTOSPI interface resets block diagram showing connections from RCC signals, clock/reset inputs through Reset Sync blocks to OCTOSPI1, OCTOSPI2, OTFDEC1, OTFDEC2, DLYBOS1, DLYBOS2, and OCTOSPIM.

There are seven independent resets for the Octo-SPI interface:

When configuring the Octo-SPI interface, the reset sequence to be applied is the following:

  1. 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. 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. 3. Configure the OCTOSPI1 (respectively OCTOSPI2) and the OTFDEC1 (respectively OTFDEC2) engine.
  4. 4. Set OSPIIOMEN to 1. This activates the peripheral clock of OCTOSPIM and releases its reset.
  5. 5. Configure the OCTOSPIM.
  6. 6. For configurations where the programmable delays must be used:
    1. a) Wait for the DLL to be locked. This is indicated by LOCK bit in SYSCFG_DLYBOS1SR (respectively SYSCFG_DLYBOS2SR).
    2. 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 areaOCTOSPI2 area
000256 Mbytes
0x6000_0000 -> 0x6FFF_FFFF
0 Mbyte
001192 Mbytes
0x6000_0000 -> 0x6BFF_FFFF
64 Mbytes
0x6C00_0000 -> 0x6FFF_FFFF
010128 Mbytes
0x6000_0000 -> 0x67FF_FFFF
128 Mbytes
0x6800_0000 -> 0x6FFF_FFFF
01164 Mbytes
0x6000_0000 -> 0x63FF_FFFF
192 Mbytes
0x6400_0000 -> 0x6FFF_FFFF
1xx0 Mbyte256 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 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 Figure 207: Programmable delay block diagram. Shows DLYBOSx internal structure containing Master Delay Line, Phase Comparator, Digital Control, RX Delay Line, and TX Delay Line interconnected with SYSCFG block.
Figure 207: Programmable delay block diagram. Shows DLYBOSx internal structure containing Master Delay Line, Phase Comparator, Digital Control, RX Delay Line, and TX Delay Line interconnected with SYSCFG block.

The DLL architecture is based on one master delay line, and two slave delay lines (RX and TX). There are two operating modes:

Table 251. RX and TX delays in lock mode
rx_ph_select[5:0] (respectively tx_ph_select[5:0])RX delay (respectively TX delay)
0000000
0000011/32 × T(dll\_clk)
......
01111131/32 × T(dll\_clk)
10000032/32 × T(dll\_clk)
Table 252. Number of delay elements enabled in each delay unit
dll_bypass_cmd[4:0]Number of delay elements enabled
00000reserved
000011 delay element is enabled
000102 delay elements are enabled
......
11000 to 11111All 24 delay elements are enabled

36.3.9 Octo-SPI interface interrupts

Each OCTOSPI and each OTFDEC instance generate one interrupt.

Table 253. Octo-SPI interface interrupts

PeripheralSignal nameCPU1 interruptCPU2 interrupt
OCTOSPI1it_ospioctospi1_itoctospi1_it
OCTOSPI2it_ospioctospi2_itoctospi2_it
OTFDEC1irqotfdec1_itotfdec1_it
OTFDEC2irqotfdec2_itotfdec2_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.

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 CSSELCSSEL_OVR_ENCSSEL_OVR_01OCTOSPI1 CS mapped on
00xOCTOSPIM_P1_NCS1
10xOCTOSPIM_P1_NCS2
x10OCTOSPIM_P1_NCS1
x11OCTOSPIM_P1_NCS2

Table 255. OCTOSPI2 CS mapping when MUXEN = 0 and MODE = 0

OCTOSPI2 CSSELCSSEL_OVR_ENCSSEL_OVR_02OCTOSPI2 CS mapped on
00xOCTOSPIM_P2_NCS1
10xOCTOSPIM_P2_NCS2
x10OCTOSPIM_P2_NCS1
x11OCTOSPIM_P2_NCS2

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 CSSELCSSEL_OVR_ENCSSEL_OVR_01OCTOSPI1 CS mapped on
00xOCTOSPIM_P2_NCS1
10xOCTOSPIM_P2_NCS2
x10OCTOSPIM_P2_NCS1
x11OCTOSPIM_P2_NCS2

Table 257. OCTOSPI2 CS mapping when MUXEN = 0 and MODE = 1

OCTOSPI2 CSSELCSSEL_OVR_ENCSSEL_OVR_02OCTOSPI2 CS mapped on
00xOCTOSPIM_P1_NCS1
10xOCTOSPIM_P1_NCS2
x10OCTOSPIM_P1_NCS1
x11OCTOSPIM_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:

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)

Block diagram of flash configuration example showing OCTOSPI1 connected to OCTOSPIM IO Matrix, outputting to Device 1 and Device 2.

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):

Block diagram of flash configuration example showing OCTOSPI1 connected to OCTOSPIM IO Matrix, outputting to Device 1 and Device 2.

• 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 CSSELOCTOSPI2 CSSELCSSEL_OVR_ENCSSEL_OVR_01CSSEL_OVR_02OCTOSPI1 CS mapped onOCTOSPI2 CS mapped on
010xxOCTOSPIM_P1_NCS1OCTOSPIM_P1_NCS2
100xxOCTOSPIM_P1_NCS2OCTOSPIM_P1_NCS1
xx101OCTOSPIM_P1_NCS1OCTOSPIM_P1_NCS2
xx110OCTOSPIM_P1_NCS2OCTOSPIM_P1_NCS1

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 CSSELOCTOSPI2 CSSELCSSEL_OVR_ENCSSEL_OVR_01CSSEL_OVR_02OCTOSPI1 CS mapped onOCTOSPI2 CS mapped on
010xxOCTOSPIM_P2_NCS1OCTOSPIM_P2_NCS2
100xxOCTOSPIM_P2_NCS2OCTOSPIM_P2_NCS1
xx101OCTOSPIM_P2_NCS1OCTOSPIM_P2_NCS2
xx110OCTOSPIM_P2_NCS2OCTOSPIM_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.

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:

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.

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)

Block diagram of Flash configuration example: dual quad mode, showing OCTOSPI2 connected via OCTOSPIM IO Matrix to Quad Device 1 and Quad Device 2 on port 2.

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

Block diagram of Flash configuration example: dual quad mode, showing OCTOSPI2 connected via OCTOSPIM IO Matrix to Quad Device 1 and Quad Device 2 on port 2.

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 bitsControl input or status output in the OCTOSPIComment
BYP_ENdll_bypass_cmd_enSelection of lock or pure-delay mode
ENdll_start_lockEnable 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 bitsControl input or status output in the OCTOSPIComment
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
LOCKdll_lockedWhen in lock mode, indicates that the DLL has locked on the input clock frequency
RX_TAP_SEL_ACKrx_ph_select_ackIndicates that the RX delay line has switched to the delay selected by RX_TAP_SEL[5:0]
TX_TAP_SEL_ACKtx_ph_select_ackIndicates 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 bitsControl input or status output in the OCTOSPIComment
BYP_ENdll_bypass_cmd_enSelection of lock or pure-delay mode
ENdll_start_lockEnable 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
LOCKdll_lockedWhen in lock mode, indicates that the DLL has locked on the input clock frequency
RX_TAP_SEL_ACKrx_ph_select_ackIndicates that the RX delay line has switched to the delay selected by RX_TAP_SEL[5:0]
TX_TAP_SEL_ACKtx_ph_select_ackIndicates 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 ModeSTR or DTRDQS used in read ?Max frequencySetup/Hold constraints on memory deviceData valid Window at output of memory DeviceTX clock configurationRX sampling strobe selection
HyperBus( Cypress, Spansion)DTRyes200
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]STRno133
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]DTRyes133
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)STRno1331.8 / 1.8 ns
Wrt memory clock rising edge
2.8ns @12pFSet 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)DTRyes1330.8 / 0.8 ns
Wrt memory clock edges
2 nsif 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

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

Figure 211: SD/e•MMC interface block diagram showing SDMMC1, SDMMC2, and SDMMC3 connected to SoC Interconnect, SYSCFG, DLYBSD, CPU1 GIC, CPU2 NVIC, and external signals.

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.

Figure 211: SD/e•MMC interface block diagram showing SDMMC1, SDMMC2, and SDMMC3 connected to SoC Interconnect, SYSCFG, DLYBSD, CPU1 GIC, CPU2 NVIC, and external signals.

MSv66525V2

36.4.3 SD/eMMC interface reset

Figure 212. SD/eMMC interface resets

Block diagram showing the reset logic for three SD/eMMC interfaces (SDMMC1, SDMMC2, SDMMC3) within the RCC. Each interface has a clock input (ck_icn_m_sdmmc1/2/3) and a reset input (SDMMC1RST/2RST/3RST). 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/2DLLRST/3DLLRST) that connects to the rst_n pin of its corresponding DLYBSD block.

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.

Block diagram showing the reset logic for three SD/eMMC interfaces (SDMMC1, SDMMC2, SDMMC3) within the RCC. Each interface has a clock input (ck_icn_m_sdmmc1/2/3) and a reset input (SDMMC1RST/2RST/3RST). 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/2DLLRST/3DLLRST) 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

Peripheralpin nameCPU1 interruptCPU2 interrupt
SDMMC1IRQsdmmc1_gbl_itsdmmc1_gbl_it
SDMMC2IRQsdmmc2_gbl_itsdmmc2_gbl_it
SDMMC3IRQsdmmc3_gbl_itsdmmc3_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:

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 bitsControl input or status output in the SDMMCComment
BYP_ENdll_bypass_cmd_enSelection of lock or pure-delay mode
ENdll_start_lockEnable 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 bitsControl input or status output in the SDMMCComment
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
LOCKdll_lockedWhen in lock mode, indicates that the DLL has locked on the input clock frequency
RX_TAP_SEL_ACKrx_ph_select_ackIndicates 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 bitsControl input or status output in the SDMMCComment
BYP_ENdll_bypass_cmd_enSelection of lock or pure-delay mode
ENdll_start_lockEnable 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
LOCKdll_lockedWhen in lock mode, indicates that the DLL has locked on the input clock frequency
RX_TAP_SEL_ACKrx_ph_select_ackIndicates 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 bitsControl input or status output in SDMMCComment
BYP_ENdll_bypass_cmd_enSelection of lock or pure-delay mode
ENdll_start_lockEnable 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
LOCKdll_lockedWhen in lock mode, indicates that the DLL has locked on the input clock frequency
RX_TAP_SEL_ACKrx_ph_select_ackIndicates 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 ModeMax card clock freq. SDMMCn_CLKIO VoltageSetup/hold constraints on SD deviceData valid Window at output of SD DeviceKernel clock freq (SCLK)DDRNEGEDGECLKDIVSelection of RX sampling clock (SELCLKRX)
DS (default speed)(1)25 MHz3V35ns/5ns26ns25 MHz0NA0 (div by 1)SDMMC_CLKio
HS (high speed)(1)50 MHz3V36ns/2ns8.5ns50 MHz0NA0 (div by 1)SDMMC_CLKio
SDR12(1)25 MHz1V83ns/0.8ns27.5ns25 MHz0NA0 (div by 1)SDMMC_CLKio
SDR25(1)50 MHz1V83ns/0.8ns7.5ns50 MHz0NA0 (div by 1)SDMMC_CLKio
DDR50 (2)50 MHz1V83ns/0.8ns4.5ns50 MHz1(3)1 (div by 2)SDMMC_CLKio
SDR50(2)100 MHz1V83ns/0.8ns4ns100 MHz0NA0 (div by 1)SDMMC_CLKio
SDR104208 MHz1V81.4ns/0.8ns2,88ns208 MHz0NA0 (div by 1)SDMMC_FB_CLK
  1. 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. 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. 3. Value to be programmed depend on timings of the interface. For functional simulation, either value works.
Table 268. eMMC Speed modes and recommended clock configuration
Speed ModeMax card clock freq. SDMMCn_CLKIO Voltage(1)Setup/Hold constraints on SD deviceData valid Window at output of eMMC DeviceKernel clock freq (SCLK)DDRNEGEDGECLKDIVSelection of RX sampling clock (SELCLKRX)
Legacy compatible(2)26 MHz3V3, 1V8, 1V23ns/3ns20ns26 MHz0NA0 (div by 1)SDMMC_CLKio
High speed SDR(2)52 MHz3V3, 1V8, 1V23ns/3ns8ns52 MHz0NA0 (div by 1)SDMMC_CLKio
High Speed DDR(3)52 MHz3V3, 1V8, 1V2CMD: 3ns/3ns
DATA: 2.5ns/2.5ns
CMD: 8ns
DATA: 4.1ns
104 MHz1(4)1 (div by 2)SDMMC_CLKio
High speed HS200200 MHz1V8, 1V21.4ns/0.8ns0.575 UI
(2.88ns at 200 MHz)
200 MHz0NA0 (div by 1)SDMMC_FB_CLK
  1. 1V2 is not supported in STM32MP23/25xx.
  2. 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.
  3. 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.
  4. 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. 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. 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. 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. 4. Select the RX delay value by programming RX_TAP_SEL[5:0] in SYSCFG_DLYBSDnCR.
  5. 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.