29. XSPI I/O manager (XSPIM)

29.1 XSPIM introduction

The XSPI I/O manager is a low-level interface, enabling an efficient XSPI pin assignment with a full I/O matrix (before alternate function map), and multiplex of single/dual/quad/octal/16-bit SPI interfaces over the same bus.

29.2 XSPIM main features

29.3 XSPIM implementation

Table 202 describes the XSPIM implementation.

Table 202. XSPIM implementation

XSPI featureAvailable on the devices
Supports up to two single/dual/quad interfacesX
Fully I/O multiplexing capabilityX
Supports time-multiplexed modeX
Supports high-speed interfaceX
Chip select selection if XSPI provides dual chip selectX
Supports 16-bit data interface and dual-octal modeX
Supports up to three XSPIsX

29.4 XSPIM functional description

29.4.1 XSPIM block diagram

The block diagram of the XSPI I/O manager is shown in Figure 217.

Figure 217. XSPIM block diagram

Figure 217. XSPIM block diagram: Detailed block diagram showing the XSPI I/O manager with AHB interface, Control register, Static muxing, Dynamic muxing, Arbiter, I/O matrix with Port 1 and Port 2, connected to PHY and High speed interface. Inputs from XSPI1, XSPI2, XSPI3 blocks communicating via REQ, ACK, and bus signals. Outputs include Port 1 signals (XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0,1, XSPIM_P1_NCS1,2, XSPIM_P1_IO[15:0]) and Port 2 signals (XSPIM_P2_CLK, XSPIM_P2_NCLK, XSPIM_P2_DQS0, XSPIM_P2_NCS1,2, XSPIM_P2_IO[7:0]).
Figure 217. XSPIM block diagram: Detailed block diagram showing the XSPI I/O manager with AHB interface, Control register, Static muxing, Dynamic muxing, Arbiter, I/O matrix with Port 1 and Port 2, connected to PHY and High speed interface. Inputs from XSPI1, XSPI2, XSPI3 blocks communicating via REQ, ACK, and bus signals. Outputs include Port 1 signals (XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0,1, XSPIM_P1_NCS1,2, XSPIM_P1_IO[15:0]) and Port 2 signals (XSPIM_P2_CLK, XSPIM_P2_NCLK, XSPIM_P2_DQS0, XSPIM_P2_NCS1,2, XSPIM_P2_IO[7:0]).

29.4.2 XSPIM input/output pins

Table 203. XSPIM input/output pins

Pin name(1)Signal typeDescription
XSPIM_Px_NCLKOutputXSPI inverted clock to support 1.8 V HyperBus protocol.
The inversion must be activated only in this case, setting bit INVCLK in the advanced I/O configuration section.
XSPIM_Px_CLKOutputXSPI clock
XSPIM_Px_IOn (n = 0 to 15)Input/outputXSPI data pins
XSPIM_Px_NCS1,2OutputChip select for the memory
XSPIM_Px_DQS0,1Input/outputData strobe/write mask signals from/to the memory

1. x = 1 to 2.

29.4.3 XSPIM matrix

The XSPI I/O manager matrix allows the user to set a premapping of functions:

Note: There is no possibility to use mixed combinations of signals (like NCS of XSPI1 with data of XSPI2).

When several I/O pins have the same configuration and are enabled at the same time, the result can be unpredictable.

In the default out-of-reset configuration, all the XSPI1 and XSPI2 signals are mapped, respectively, on Port 1 and on Port 2.

The configuration can be changed only when all XSPIs are disabled.

29.4.4 XSPIM multiplexed mode

When this mode is set, the XSPIs are time-multiplexed over the same bus. They get the ownership of the bus (in turn) through a request/acknowledge protocol with REQ/ACK signals.

The time-multiplexing is enabled by setting the MUXEN bit in the configuration register XSPIM_CR.

The fairness counter (MAXTRAN) of each XSPI can be used to manage the maximum duration for which a given XSPI takes the bus: this feature ensures the maximum bus access latency for the other XSPI(s). When one XSPI releases the bus, a round-robin arbitration phase occurs: when another XSPI requests the bus, it gets it.

When the multiplexed mode is enabled, either the fairness counter or the refresh timeout counter of both XSPI interfaces must be activated.

Each XSPI delivers two NCS signals (NCS1, NCS2). In multiplexed modes, the active NCS signal is the one of the XSPI owning the bus. Only XSPIn_IOs, XSPIn_DQS and XSPIn_CLK / XSPIn_NCLK are multiplexed.

When the multiplexed mode is used, only clock mode 0 is supported on the XSPIs.

Due to arbitration and bus sharing, the auto polling interval time of the XSPI, when used, can be increased.

Minimum switching duration

The minimum number of cycles needed to switch from an XSPI to another can be configured. This guarantees a latency between the falling edge of the REQ signal of the active XSPI (the active one releases the bus), and the rising edge of the ACK signal to the requesting XSPI (the bus is granted to the requesting one).

The duration is defined by the REQ2ACK_TIME field in the XSPIM_CR register.

29.5 Use cases description

The following table summarizes the use cases corresponding to IO manager modes.

Table 204. Use cases

IO manager modeMUXENModeReference
Direct
(XSPI1 to Port1, XSPI2 to Port2, XSPI3 not used)
00Section 29.5.1
Section 29.5.2
Swapped
(XSPI1 to Port2, XSPI2 to Port1, XSPI3 not used)
01Section 29.5.4
Multiplexed to Port1
(XSPI1 and XSPI2 to Port1, XSPI3 to Port2)
10Section 29.5.5
Multiplexed to Port2
(XSPI1 and XSPI2 to Port2, XSPI3 to Port1).
11Section 29.5.6
XSPI1 and 2 drive a single external memory connected to Port1 or Port2, and XSPI3 drives one external memory connected to the other port.10 or 1, depending upon the port connected to the memory.Section 29.5.7
XSPI1 or 2 drives two external memories connected to Port1 or Port2, and XSPI3 is not used.00 or 1, depending upon the port connected to the memories. The selected XSPI instance hits the corresponding memory thanks to the NCS selection.Section 29.5.8

29.5.1 XSPIs direct octal mode

This is the baseline mode: each XSPI independently drives the corresponding port (XSPI1 on port 1 and XSPI2 on port 2) and high-speed interface. There is no multiplexing.

The configuration selection signal selects the signals used for each high-speed interface. These signals come from the XSPI_CR and XSPI_CALxxx register outputs.

Alternate function signals can be routed on NCS2 pins as they are not used for the XSPI bus. NCLK clocks are requested in case of 1.8 V HyperBus memory type.

This mode is selected by default through bits XSPIM_CR[1:0].

Figure 218. XSPI direct octal mode

Block diagram of XSPI direct octal mode showing the XSPI I/O manager, XSPI1, XSPI2, XSPI3 (not used), and connections to Octal memory 1 and Octal memory 2.

The diagram illustrates the XSPI direct octal mode architecture. The XSPI I/O manager is the central component, containing Control registers, an Arbiter, and an I/O matrix with ports P1 and P2. XSPI1 is connected to Port P1, and XSPI2 is connected to Port P2. XSPI3 is marked as (not used). The Static and dynamic muxing block is also part of the manager. Alternate functions signals are input to the manager. The manager connects to two High speed interface blocks (High speed interface 1 and High speed interface 2), which in turn connect to Octal memory 1 and Octal memory 2. The connections are as follows:

Additional signals include AHB connected to the Control registers, Port selection from the Control registers to the I/O matrix, and Configuration signals selection and Configuration signals from the XSPI blocks to the High speed interface.

Block diagram of XSPI direct octal mode showing the XSPI I/O manager, XSPI1, XSPI2, XSPI3 (not used), and connections to Octal memory 1 and Octal memory 2.

29.5.2 XSPI direct 16-bit mode

This is the baseline mode, completely similar to XSPI octal direct mode, where each XSPI directly drives the corresponding port (XSPI1 connected to Port 1, XSPI2 connected to Port 2). Two DQS (1 per byte) are needed for each 16-bit port, when available.

Figure 219. XSPI direct 16-bit mode

Block diagram of XSPI direct 16-bit mode showing the XSPI I/O manager, XSPI1, XSPI2, XSPI3 (not used), and two external memories (16-bit memory 1 and Octal memory 2) connected via high-speed interfaces.

The diagram illustrates the XSPI direct 16-bit mode architecture. The XSPI I/O manager is the central component, containing Control registers, an Arbiter, and an I/O matrix with ports P1 and P2. The Arbiter receives data from XSPI1 and XSPI2 and routes it to the I/O matrix. The I/O matrix also includes Static and dynamic muxing and Port selection logic. XSPI3 is shown as (not used). The I/O matrix connects to two High speed interface blocks (High speed interface 1 and High speed interface 2). These interfaces are connected to external memories: 16-bit memory 1 and Octal memory 2. The High speed interface 1 connects to 16-bit memory 1 via signals: XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0, XSPIM_P1_DQS1, XSPIM_P1_NCS1, XSPIM_P1_NCS2, and XSPIM_P1_IO[15:0]. The High speed interface 2 connects to Octal memory 2 via signals: XSPIM_P2_CLK, XSPIM_P2_NCLK, XSPIM_P2_DQS0, XSPIM_P2_NCS1, XSPIM_P2_NCS2, and XSPIM_P2_IO[7:0]. The 16-bit memory 1 interface includes clk, nclk, Data strobe, nCS, and Data[15:0]. The Octal memory 2 interface includes clk, nclk, Data strobe, nCS, and Data[7:0]. The XSPI I/O manager also receives Alternate functions signals and provides Configuration signals selection and Configuration signals to the High speed interface block. The AHB bus is connected to the Control registers.

Block diagram of XSPI direct 16-bit mode showing the XSPI I/O manager, XSPI1, XSPI2, XSPI3 (not used), and two external memories (16-bit memory 1 and Octal memory 2) connected via high-speed interfaces.

29.5.3 XSPI dual-octal mode

This mode is equivalent to XSPI direct mode, but, for simplicity, only one XSPI interface is represented. Two external octal memories are accessed in parallel, similarly to the dual-quad mode implemented with octal interfaces.

Figure 220. XSPI dual-octal mode

Block diagram of XSPI dual-octal mode showing the XSPI I/O manager, High speed interface, and Multichip package (MCP) with Octal memory 1 and 2.

The diagram illustrates the XSPI dual-octal mode architecture. It shows the interaction between the XSPI I/O manager, the High speed interface, and the Multichip package (MCP) containing Octal memory 1 and Octal memory 2.

XSPI I/O manager: This block contains the Control registers, Arbiter, and I/O matrix (P1 and P2). It is connected to AHB and the XSPI block. The Arbiter and I/O matrix are connected to the High speed interface. The I/O matrix also receives Port selection signals from the Control registers. The XSPI block provides configuration signals to the High speed interface.

High speed interface: This block receives alternate functions signals and configuration signals. It outputs signals to the MCP: XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0, XSPIM_P1_NCS1, XSPIM_P1_NCS2, XSPIM_P1_IO[7:0], XSPIM_P1_DQS1, and XSPIM_P1_IO[15:8].

Multichip package (MCP): This block contains Octal memory 1 and Octal memory 2. Octal memory 1 is connected to XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0, XSPIM_P1_NCS1, and XSPIM_P1_NCS2. Octal memory 2 is connected to XSPIM_P1_DQS1 and XSPIM_P1_IO[15:8]. Both memories have clk, nclk, Data strobe, nCS, and Data[7:0] signals.

Block diagram of XSPI dual-octal mode showing the XSPI I/O manager, High speed interface, and Multichip package (MCP) with Octal memory 1 and 2.

29.5.4 XSPI swapped mode

This mode is similar to XSPI direct mode, but the ports are swapped, to help I/O mapping. The mode is selected by bits XSPIM_CR[1:0].

If XSPIM.CR[0] or XSPIM.CR[1] is toggled in application, XSPI.DCR2 or XSPI.CCR must be written, so that the calibration of the high speed interface is launched according to the new XSPI using it.

Note: In swapped mode, the XSPI2 can be configured in 16-bit mode, and the XSPI1 can be configured in octal mode, to connect an external 16-bit memory on Port 1, and to connect in a concurrent way an octal external memory connected to Port 2 of the I/O manager.

Figure 221. XSPI swapped (octal) mode

Block diagram of XSPI swapped (octal) mode showing the XSPI I/O manager, XSPI1, XSPI2, XSPI3 (not used), I/O matrix, high-speed interfaces, and external Octal memories.

The diagram illustrates the XSPI swapped (octal) mode architecture. The XSPI I/O manager is the central component, containing Control registers, an Arbiter, and an I/O matrix with static and dynamic muxing. It interfaces with XSPI1, XSPI2, and XSPI3 (not used) via AHB. The I/O matrix has two ports, P1 and P2, which connect to High speed interface 1 and High speed interface 2 respectively. These interfaces are connected to external Octal memory 1 and Octal memory 2. The Octal memory 1 interface includes signals: XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0, XSPIM_P1_DQS1, XSPIM_P1_NCS1, XSPIM_P1_NCS2, XSPIM_P1_IO[7:0], and XSPIM_P1_IO[15:8]. The Octal memory 2 interface includes: XSPIM_P2_CLK, XSPIM_P2_NCLK, XSPIM_P2_DQS0, XSPIM_P2_NCS1, XSPIM_P2_NCS2, and XSPIM_P2_IO[7:0]. Configuration signals and alternate functions signals are also shown as inputs to the high-speed interfaces. The diagram is labeled MS55957V2.

Block diagram of XSPI swapped (octal) mode showing the XSPI I/O manager, XSPI1, XSPI2, XSPI3 (not used), I/O matrix, high-speed interfaces, and external Octal memories.

29.5.5 Two XSPIs multiplexed mode to Port 1 accessing two external memories, and the third XSPI accessing Port 2

If only one output port is used to access two memories, alternate function signals can be routed to pins corresponding to the other port. This mode is selected by bits XSPIM_CR[1:0].

The arbiter in the IO manager selects XSPI1 or XSPI2 to own the octal-SPI bus according to the existing transfer requests and status of the two MAXTRAN fairness counters.

The external memories can be on separate chips, or embedded in a single multichip package. In this case, each memory requests a dedicated Chip select, selected according to the CSSEL control of the XSPI currently owning the bus.

The configuration signals of the high speed interface toggle when the corresponding XSPI is selected, because the timing characteristics of the two memories can be different.

Figure 222. XSPI multiplexed mode to Port 1

Block diagram of XSPI multiplexed mode to Port 1 showing XSPI I/O manager interfacing with XSPI1, XSPI2, XSPI3 and routing through High speed interface 1 to Octal memory 1 and Octal memory 2, and High speed interface 2 to Octal memory 3.

MS55960V2

Block diagram of XSPI multiplexed mode to Port 1 showing XSPI I/O manager interfacing with XSPI1, XSPI2, XSPI3 and routing through High speed interface 1 to Octal memory 1 and Octal memory 2, and High speed interface 2 to Octal memory 3.

29.5.6 Two XSPIs multiplexed mode to Port 2 accessing two external memories, and the third XSPI accessing Port 1

This is similar to XSPI multiplexed mode to Port 1, but the target is Port 2. This mode is selected by bits XSPIM_CR[2:1].

Figure 223. XSPI multiplexed (octal and dual-octal) mode to Port 2

Block diagram of XSPI I/O manager showing multiplexed mode to Port 2. The diagram illustrates the internal architecture of the XSPI I/O manager, including AHB, Control registers, Arbiter, I/O matrix (P1, P2), and High speed interfaces (1, 2). It shows connections to XSPI1, XSPI2, and XSPI3, and external memory blocks (Octal memory 1, 2, 3) with their respective signal lines like CLK, nCLK, DQS, nCS, and Data[7:0].

The diagram shows the XSPI I/O manager architecture. On the left, AHB connects to Control registers, which then feed into an Arbiter. The Arbiter connects to an I/O matrix with ports P1 and P2. XSPI1, XSPI2, and XSPI3 are connected to the I/O matrix. The I/O matrix connects to High speed interface 1 and High speed interface 2. Configuration signals selection and configuration signals are also shown. High speed interface 1 connects to Octal memory 3 via signals: XSPIM_P1_CLK (clk), XSPIM_P1_NCLK (nclk), XSPIM_P1_DQS0 (Data strobe), XSPIM_P1_DQS1, XSPIM_P1_NCS1 (nCS), XSPIM_P1_NCS2, XSPIM_P1_IO[7:0] (Data[7:0]), and XSPIM_P1_IO[15:8]. High speed interface 2 connects to Octal memory 1 and Octal memory 2 via signals: XSPIM_P2_CLK (clk), XSPIM_P2_NCLK (nclk), XSPIM_P2_DQS0 (Data strobe), XSPIM_P2_NCS1 (nCS), XSPIM_P2_NCS2, XSPIM_P2_IO[7:0] (Data[7:0]). Octal memory 1 and 2 are grouped as 'Two-memory packages or multi-chip package (MCP)'. Alternate functions signals are also indicated.

Block diagram of XSPI I/O manager showing multiplexed mode to Port 2. The diagram illustrates the internal architecture of the XSPI I/O manager, including AHB, Control registers, Arbiter, I/O matrix (P1, P2), and High speed interfaces (1, 2). It shows connections to XSPI1, XSPI2, and XSPI3, and external memory blocks (Octal memory 1, 2, 3) with their respective signal lines like CLK, nCLK, DQS, nCS, and Data[7:0].

MS55962V2

Note: It is possible to connect a 16-bit memory on Port 1, whereas Port 2 uses multiplexing mode on two octal memories.

29.5.7 XSPI1 and XSPI2 drive a single external memory

This is similar to XSPIs multiplexed mode to Port 1, but in this case only one external memory is present. Both CSSEL controls must target the same NCS (NCS1 in Figure 224).

Figure 224. XSPI1 and XSPI2 drive a single external memory (octal mode)

Block diagram of XSPI I/O manager showing XSPI1, XSPI2, XSPI3, I/O matrix, and high-speed interfaces connected to Octal memory 1 and Octal memory 2.

The diagram illustrates the XSPI I/O manager architecture. On the left, three XSPI blocks (XSPI1, XSPI2, XSPI3) are connected to an internal I/O matrix. The I/O matrix contains an 'Arbiter' and 'Static and dynamic muxing' logic. Control registers and AHB interface are at the top. The I/O matrix has two ports, P1 and P2, which connect to 'High speed interface 1' and 'High speed interface 2' respectively. These interfaces are connected to 'Octal memory 1' and 'Octal memory 2'. The connections for Octal memory 1 include XSPIM_P1_CLK (clk), XSPIM_P1_NCLK (nclk), XSPIM_P1_DQS0 (Data strobe), XSPIM_P1_NCS1 (nCS), XSPIM_P1_NCS2, and XSPIM_P1_IO[7:0] (Data[7:0]). Similarly, Octal memory 2 connections include XSPIM_P2_CLK (clk), XSPIM_P2_NCLK (nclk), XSPIM_P2_DQS0 (Data strobe), XSPIM_P2_NCS1 (nCS), XSPIM_P2_NCS2, and XSPIM_P2_IO[7:0] (Data[7:0]). A 'High speed interface' block at the bottom receives configuration signals. 'Alternate functions signals' are shown entering the high-speed interfaces. The diagram is labeled MS55964V2.

Block diagram of XSPI I/O manager showing XSPI1, XSPI2, XSPI3, I/O matrix, and high-speed interfaces connected to Octal memory 1 and Octal memory 2.

Note: This use case is valid even when Port 2 is used instead of Port 1, and also possible with XSPI1 and XSPI2 interfacing a 16-bit memory (connecting XSPIM_P1_DQS1 to the memory).

29.5.8 A single XSPI drives two external memories

This is a subset of direct mode and corresponds to semi-dynamic switching. There are two target memories, but the arbiter is not used. The software must set the XSPI1 chip selector (bit 24 of the XSPI_CR register) each time the target memory changes.

The baseline use case boots on flash (memory1) and then switches to SRAM (memory2) for the rest of the application.

Figure 225. Single XSPI driving two external memories Block diagram showing single XSPI driving two external memories via XSPI I/O manager (XSPIM), connecting to a Multichip package (MCP) containing Octal memory 1 and Octal memory 2.

The diagram illustrates the internal architecture of the XSPI I/O manager and its connection to external memories. The XSPI I/O manager is divided into two main sections: the AHB interface and the I/O matrix.

The diagram also shows the connection between the XSPI1 bus signals and the I/O matrix, and the connection between the configuration signals and the High speed interface. The reference number MS55965V3 is located at the bottom right of the diagram.

Block diagram showing single XSPI driving two external memories via XSPI I/O manager (XSPIM), connecting to a Multichip package (MCP) containing Octal memory 1 and Octal memory 2.

This use case shows a configuration using XSPI1 on Port 1. It is also valid if the instance is XSPI2 instead of XSPI1, but with MODE = 1. The use case is also valid when Port 2 is used instead of Port 1, by configuring MODE bit according to the instance (XSPI1 or XSPI2) driving the two external memories.

29.6 XSPIM registers

29.6.1 XSPIM control register (XSPIM_CR)

Address offset: 0x0000

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.REQ2ACK_TIME[7:0]
rwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.CSSEL_OVR_O2CSSEL_OVR_O1CSSEL_OVR_ENRes.Res.MODEMUXEN
rwrwrwrwrw

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:16 REQ2ACK_TIME[7:0]: REQ to ACK time

In Multiplexed mode (MUXEN = 1), this field defines the time between two transactions.
The value is the number of XSPI clock cycles - 1

Bits 15:7 Reserved, must be kept at reset value.

Bit 6 CSSEL_OVR_O2: Chip select selector override setting for XSPI2

0: XSPI2 can only use NCS1 (accesses using NCS2 are ignored)
1: XSPI2 can only use NCS2 (accesses using NCS1 are ignored)

Bit 5 CSSEL_OVR_O1: Chip select selector override setting for XSPI1

0: XSPI1 can only use NCS1 (accesses using NCS2 are ignored)
1: XSPI1 can only use NCS2 (accesses using NCS1 are ignored)

Bit 4 CSSEL_OVR_EN: Chip select selector override enable

0: CSSEL_OVR_O1 and CSSEL_OVR_O2 bit values are ignored, the chip select signals from OCTOSPIs or XSPIs are transmitted unconditionally
1: CSSEL_OVR_O1 and CSSEL_OVR_O2 bit values are taken into account

Bits 3:2 Reserved, must be kept at reset value.

Bit 1 MODE: XSPI multiplexing mode

0: if MUXEN = 0 direct mode, if MUXEN = 1 arbitration mode to output Port 1
1: if MUXEN = 0 swapped mode, if MUXEN = 1 arbitration mode to output Port 2

Bit 0 MUXEN: Multiplexed mode enable

This bit enables the multiplexing of the two XSPIs.
0: No multiplexing, hence no arbitration
1: XSPI1 and XSPI2 are multiplexed over the same bus

29.6.2 XSPIM register map

Table 205. XSPIM register map and reset values

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x0000XSPIM_CRRes.Res.Res.Res.Res.Res.Res.Res.REQ2ACK_TIME[7:0]Res.Res.Res.Res.Res.Res.Res.Res.Res.CSSEL_OVR_O2CSSEL_OVR_O1CSSEL_OVR_ENRes.Res.MODEMUXEN
Reset value0000000000000

Refer to Section 2.3: Memory organization for the register boundary addresses.

ST logo
ST logo