25. XSPI I/O manager (XSPIM)

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

25.2 XSPIM main features

25.3 XSPIM implementation

Table 216 describes the XSPIM implementation.

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

25.4 XSPIM functional description

25.4.1 XSPIM block diagram

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

Figure 215. XSPIM block diagram Figure 215. XSPIM block diagram. Shows XSPI1 and XSPI2 connected to XSPI I/O manager. The manager connects via AHB interface to AHB bus, includes control register, arbiter, static muxing, time muxing, and I/O matrix with Port 1 and Port 2 routing to High speed interface (PHY), connecting to pins XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0,1, XSPIM_P1_NCS1,2, XSPIM_P1_IO[15:0] and XSPIM_P2_CLK, XSPIM_P2_NCLK, XSPIM_P2_DQS0, XSPIM_P2_NCS1,2, XSPIM_P2_IO[7:0].
Figure 215. XSPIM block diagram. Shows XSPI1 and XSPI2 connected to XSPI I/O manager. The manager connects via AHB interface to AHB bus, includes control register, arbiter, static muxing, time muxing, and I/O matrix with Port 1 and Port 2 routing to High speed interface (PHY), connecting to pins XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0,1, XSPIM_P1_NCS1,2, XSPIM_P1_IO[15:0] and XSPIM_P2_CLK, XSPIM_P2_NCLK, XSPIM_P2_DQS0, XSPIM_P2_NCS1,2, XSPIM_P2_IO[7:0].

25.4.2 XSPIM input/output pins

Table 217. XSPIM input/output pins
Pin name(1)Signal typeDescription
XSPIM_Px_NCLKOutputXSPI inverted clock to support 1.8 V HyperBus protocol
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.

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

25.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 one NCS signal together with a CSSEL control signal. The CSSEL signal selects which of the two outputs (NCS1, NCS2) is active. In multiplexed modes the active CSSEL signal is the one of the XSPI owning the bus. The default value of XSPIM_CR.CSSEL is 0 for XSPI1 and 1 for XSPI2. Only XSPIMn_IOs, XSPIMn_DQS and XSPIMn_CLK / XSPIMn_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.

25.5 Use cases description

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

Table 218. Use cases

IO manager modeMUXENModeReference
Direct00Section 25.5.1
Section 25.5.2
Swapped01Section 25.5.4
Multiplexed to Port110Section 25.5.5
Multiplexed to Port211Section 25.5.6
Two XSPIs drive one external memory10 or 1, depending upon the port connected to the memory.Section 25.5.7
One XSPI drives two external memories00 with CS selection command from XSPI1 or 2.Section 25.5.8

25.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 216. XSPI direct octal mode

Block diagram of XSPI direct octal mode showing the internal structure of the XSPI I/O manager and its connection to external Octal memories.

The diagram illustrates the XSPI I/O manager architecture in direct octal mode. The XSPI I/O manager is a central block containing an AHB interface, a Control register, an Arbiter, and an I/O matrix. It is connected to two XSPI blocks (XSPI1 and XSPI2) via bus signals. XSPI1 provides signals: XSPI1 bus signals, ACK1, REQ1, CS1, and CSSEL1. XSPI2 provides signals: CS2, CSSEL2, REQ2, and ACK2. The Arbiter within the manager handles these signals, with static and dynamic muxing leading to the I/O matrix. The I/O matrix connects to two High speed interfaces (High speed interface 1 and High speed interface 2). These interfaces output signals to external Octal memories. High speed interface 1 connects to Octal memory 1 with signals: XSPIM_P1_CLK (clk), XSPIM_P1_NCLK (nclk), XSPIM_P1_DQS0 (Data strobe), XSPIM_P1_NCS1 (nCS), and XSPIM_P1_IO[7:0] (Data[7:0]). High speed interface 2 connects to Octal memory 2 with signals: XSPIM_P2_CLK (clk), XSPIM_P2_NCLK (nclk), XSPIM_P2_DQS0 (Data strobe), XSPIM_P2_NCS2 (nCS), and XSPIM_P2_IO[7:0] (Data[7:0]). Configuration signals from XSPI1 and XSPI2 are used for configuration signal selection. Alternate functions signals are also shown entering the high-speed interfaces.

Block diagram of XSPI direct octal mode showing the internal structure of the XSPI I/O manager and its connection to external Octal memories.

25.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 217. XSPI direct 16-bit mode

Block diagram of XSPI direct 16-bit mode showing the XSPI I/O manager, AHB, XSPI1, XSPI2, and high-speed interfaces connected to 16-bit and octal memories.

This diagram illustrates the XSPI direct 16-bit mode architecture. The XSPI I/O manager block contains Control registers, an Arbiter, and an I/O matrix with ports P1 and P2. It is connected to the AHB bus and two external interfaces, XSPI1 and XSPI2. The I/O matrix includes Static and dynamic muxing and Port selection logic. Configuration signals selection and Configuration signals are also shown. The manager connects to two High speed interface blocks (High speed interface 1 and High speed interface 2) via Alternate functions signals. High speed interface 1 connects to 16-bit memory 1 with signals: XSPIM1_CLK (clk), XSPIM1_NCLK (nclk), XSPIM1_DQS0 (Data strobe), XSPIM1_DQS1 (Data strobe), XSPIM1_NCS1 (nCS), XSPIM1_NCS2, and XSPIM1_IO[15:0] (Data[15:0]). High speed interface 2 connects to Octal memory 2 with signals: XSPIM2_CLK (clk), XSPIM2_NCLK (nclk), XSPIM2_DQS0 (Data strobe), XSPIM2_NCS1 (nCS), XSPIM2_NCS2, and XSPIM2_IO[7:0] (Data[7:0]).

Block diagram of XSPI direct 16-bit mode showing the XSPI I/O manager, AHB, XSPI1, XSPI2, and high-speed interfaces connected to 16-bit and octal memories.

MS55954V3

25.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 218. XSPI dual-octal mode

Block diagram of XSPI dual-octal mode showing the XSPI I/O manager, AHB, XSPI, and a high-speed interface connected to two octal memories within a multichip package.

This diagram illustrates the XSPI dual-octal mode architecture. The XSPI I/O manager block contains Control registers, an Arbiter, and an I/O matrix with ports P1 and P2. It is connected to the AHB bus and a single external interface, XSPI. The I/O matrix includes Static and dynamic muxing and Port selection logic. Configuration signals are also shown. The manager connects to a single High speed interface block via Alternate functions signals. This interface connects to two Octal memory blocks (Octal memory 1 and Octal memory 2) within a Multichip package (MCP). Octal memory 1 is connected via signals: 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]). Octal memory 2 is connected via signals: XSPIM_P1_DQS1 (Data strobe), XSPIM_P1_NCS1 (nCS), and XSPIM_P1_IO[15:8] (Data[7:0]).

Block diagram of XSPI dual-octal mode showing the XSPI I/O manager, AHB, XSPI, and a high-speed interface connected to two octal memories within a multichip package.

25.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 219. XSPI swapped (octal) mode

Block diagram of XSPI swapped (octal) mode showing the internal structure of the XSPI I/O manager and its connection to external octal memories.

The diagram illustrates the XSPI I/O manager in swapped (octal) mode. The XSPI I/O manager block contains an AHB interface connected to the AHB bus, a Control register, and an I/O matrix. Inside the I/O manager, there is an Arbiter that receives bus signals from XSPI1 (ACK1, REQ1, CS1, CSSEL1) and XSPI2 (REQ2, ACK2, CS2, CSSEL2). The Arbiter's output goes through Dynamic muxing and Static muxing to the I/O matrix. Configuration signal selection and configuration signals are also shown. The I/O matrix connects to two High speed interfaces. High speed interface 1 connects to Octal memory 1 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 2 via similar 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]). Alternate functions signals are also indicated.

Block diagram of XSPI swapped (octal) mode showing the internal structure of the XSPI I/O manager and its connection to external octal memories.

MS55958V3

25.5.5 Two XSPIs multiplexed mode to Port 1 accessing two external memories

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 220. XSPI multiplexed mode to Port 1

Block diagram of XSPI multiplexed mode to Port 1. The diagram shows the XSPI I/O manager containing an AHB interface, control register, arbiter, dynamic muxing, static muxing, and I/O matrix. It interfaces with XSPI1 and XSPI2 bus signals and connects to two high-speed interfaces (1 and 2) which then interface with Octal memory 1 and Octal memory 2 in a Multichip package (MCP).

The diagram illustrates the XSPI I/O manager architecture for multiplexed mode to Port 1. The manager includes an AHB interface connected to an external AHB bus, a control register, and an arbiter. The arbiter manages access from XSPI1 and XSPI2 bus signals, which include signals like ACK1, REQ1, CS1, CSSEL1, CS2, CSSEL2, REQ2, and ACK2. The arbiter's output goes through dynamic muxing and static muxing to an I/O matrix. The I/O matrix connects to two high-speed interfaces. High-speed interface 1 provides 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]. High-speed interface 2 provides: XSPIM_P2_CLK, XSPIM_P2_NCLK, XSPIM_P2_DQS0, XSPIM_P2_NCS1, XSPIM_P2_NCS2, and XSPIM_P2_IO[7:0]. These interfaces connect to Octal memory 1 and Octal memory 2 within a Multichip package (MCP). Each memory has clk, nclk, Data strobe, nCS, and Data[7:0] pins. Configuration signals and alternate functions signals are also shown.

Block diagram of XSPI multiplexed mode to Port 1. The diagram shows the XSPI I/O manager containing an AHB interface, control register, arbiter, dynamic muxing, static muxing, and I/O matrix. It interfaces with XSPI1 and XSPI2 bus signals and connects to two high-speed interfaces (1 and 2) which then interface with Octal memory 1 and Octal memory 2 in a Multichip package (MCP).

MS55959V3

25.5.6 Two XSPIs multiplexed mode to Port 2 accessing two external memories

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 221. XSPI multiplexed (octal and dual-octal) mode to Port 2

Block diagram of XSPI multiplexed (octal and dual-octal) mode to Port 2. The diagram is similar to Figure 220 but shows the high-speed interfaces connecting to Port 2 of the external memories.

This diagram is similar to Figure 220, showing the XSPI I/O manager with its internal components (AHB interface, control register, arbiter, dynamic/static muxing, I/O matrix) and its connection to XSPI1 and XSPI2 bus signals. The key difference is in the high-speed interfaces. High-speed interface 1 connects to Port 1 of Octal memory 1, and High-speed interface 2 connects to Port 2 of Octal memory 2. The signals for Octal memory 1 are: clk, nclk, Data strobe, nCS, and Data[7:0]. The signals for Octal memory 2 are: clk, nclk, Data strobe, nCS, and Data[7:0]. The high-speed interface signals are: XSPIM_P1_CLK, XSPIM_P1_NCLK, XSPIM_P1_DQS0, XSPIM_P1_DQS1, XSPIM_P1_NCS1, XSPIM_P1_NCS2, XSPIM_P1_IO[15:0] for Port 1; and XSPIM_P2_CLK, XSPIM_P2_NCLK, XSPIM_P2_DQS0, XSPIM_P2_NCS1, XSPIM_P2_NCS2, XSPIM_P2_IO[7:0] for Port 2.

Block diagram of XSPI multiplexed (octal and dual-octal) mode to Port 2. The diagram is similar to Figure 220 but shows the high-speed interfaces connecting to Port 2 of the external memories.

MS55961V4

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

25.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 222).

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

Block diagram of XSPI I/O manager showing XSPI1 and XSPI2 interfaces, arbiter, static and dynamic muxing, I/O matrix, and high-speed interfaces connecting to an octal memory.

The diagram illustrates the internal architecture of the XSPI I/O manager for driving a single external memory in octal mode.

Block diagram of XSPI I/O manager showing XSPI1 and XSPI2 interfaces, arbiter, static and dynamic muxing, I/O matrix, and high-speed interfaces connecting to an octal memory.

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

25.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 223. Single XSPI driving two external memories

Block diagram of a single XSPI driving two external memories via an XSPI I/O manager.

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 is labeled with the reference number MS55965V3.

Block diagram of a single XSPI driving two external memories via an XSPI I/O manager.

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.

25.6 XSPIM registers

25.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: the chip select signal from XSPI2 is sent to NCS1
1: the chip select signal from XSPI2 is sent to NCS2

Bit 5 CSSEL_OVR_O1: Chip select selector override setting for XSPI1

0: the chip select signal from XSPI1 is sent to NCS1
1: the chip select signal from XSPI1 is sent to NCS2

Bit 4 CSSEL_OVR_EN: Chip select selector override enable

0: override not enabled
1: CSSEL_OVR_O1 and CSSEL_OVR_O2 bit values overwrite the CSSEL signal values coming from XSPI1 and XSPI2

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

25.6.2 XSPIM register map

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