39. Octo-SPI I/O manager (OCTOSPIM)

39.1 Introduction

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

39.2 OCTOSPIM main features

Table 319. OCTOSPIM implementation

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

39.3 OCTOSPIM functional description

39.3.1 OCTOSPIM block diagram

The block diagram of the OCTOSPI I/O manager is shown in Figure 259.

Figure 259. OCTOSPIM block diagram

OCTOSPIM block diagram showing the internal architecture: AHB interface, Control register, Static muxing, Dynamic muxing, Arbiter, and I/O matrix connected to Port 1 and Port n (ports connected to pins OCTOSPIM_P1_* and OCTOSPIM_Pn_*). OCTOSPI1 and OCTOSPI2 provide bus signals, ACK, REQ, CS, CSSEL.
OCTOSPIM block diagram showing the internal architecture: AHB interface, Control register, Static muxing, Dynamic muxing, Arbiter, and I/O matrix connected to Port 1 and Port n (ports connected to pins OCTOSPIM_P1_* and OCTOSPIM_Pn_*). OCTOSPI1 and OCTOSPI2 provide bus signals, ACK, REQ, CS, CSSEL.

1. The number of ports (n) is 2.

39.3.2 OCTOSPIM input/output pins

Table 320. OCTOSPIM input/output pins

Pin name(1)Signal typeDescription
OCTOSPIM_Px_NCLKOutputOCTOSPI inverted clock to support 1.8 V HyperBus protocol
OCTOSPIM_Px_CLKOCTOSPI clock
OCTOSPIM_Px_IOn (n = 0 to 7)Input/outputOCTOSPI data pins
OCTOSPIM_Px_NCS1,2OutputChip select for the memories
OCTOSPIM_Px_DQSInput/outputData strobe/write mask signal from/to the memory

1. x = 1 to 2.

39.3.3 OCTOSPIM matrix

The OCTOSPI 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 OCTOSPI1 with data of OCTOSPI2).

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, the OCTOSPI1 and OCTOSPI2 signals are mapped, respectively, on Port 1 and on Port 2.

The OCTOSPIM configuration can be changed only when all OCTOSPIs are disabled.

39.3.4 OCTOSPIM multiplexed mode

When this mode is set, the OCTOSPIs 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 of the configuration register OCTOSPIM_CR.

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

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

Each OCTOSPI 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 OCTOSPI owning the bus. The default value of OCTOSPIM_CR.CSSEL is 0 for OCTOSPI1 and 1 for OCTOSPI2. Only OCTOSPIIn_IOs, OCTOSPIIn_DQS and OCTOSPIIn_CLK / OCTOSPIIn_NCLK are multiplexed.

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

Due to arbitration and bus sharing, the auto polling interval time of the OCTOSPI, when used, may increase.

Minimum switching duration

The minimum number of cycles needed to switch from an OCTOSPI to another can be configured.

This internal timer guarantees a latency between the falling edge of the REQ signal of the active OCTOSPI (the active one releases the bus), and the rising edge of the ACK signal to the requesting OCTOSPI (the bus is granted to the requesting one).

The REQ2ACK_TIME field of the configuration register OCTOSPIM_CR defines the duration.

39.4 Use cases description

Table 321 summarizes the use cases corresponding to IO manager modes.

Table 321. Use cases

IO manager modeMUXENModeReference
Direct00Section 39.4.1
Swapped01Section 39.4.2

Table 321. Use cases (continued)

IO manager modeMUXENModeReference
Multiplexed to Port110Section 39.4.3
Multiplexed to Port211Section 39.4.4
Two OCTOSPIs drive one external memory10 or 1, depending upon the port connected to the memorySection 39.4.5
One OCTOSPI drives two external memories00 with CS selection command from OCTOSPI1 or 2.Section 39.4.6

39.4.1 Two OCTOSPIs direct mode

This is the baseline mode: each OCTOSPI drives independently the corresponding port. There is no multiplexing.

Alternate function signals can be routed on NCS2 pins (these signals are not used for the OCTOSPI bus), nclk clocks are requested in case of 1.8 V HyperBus memory type.

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

Figure 260. OCTOSPI direct mode

Block diagram of OCTOSPI direct mode showing the internal structure of the OCTOSPI I/O manager and its connection to two OCTOSPI controllers and two Octal memories.

The diagram illustrates the OCTOSPI direct mode architecture. The OCTOSPI I/O manager is the central component, containing an AHB interface, a Control register, and an I/O matrix with Port 1 and Port 2. An Arbiter and Dynamic muxing logic are also present. The manager is connected to two OCTOSPI controllers (OCTOSPI1 and OCTOSPI2) via their respective bus signals. OCTOSPI1 provides signals like ACK1, REQ1, CS1, and CSSEL1. OCTOSPI2 provides REQ2, ACK2, CS2, and CSSEL2. The I/O matrix routes signals to two Octal memories. Port 1 connects to Octal memory 1 with signals: OCTOSPIM_P1_CLK (clk), OCTOSPIM_P1_NCLK (nclk), OCTOSPIM_P1_DQS (Data strobe), OCTOSPIM_P1_NCS1 (nCS), OCTOSPIM_P1_NCS2, and OCTOSPIM_P1_IO[7:0] (Data[7:0]). Port 2 connects to Octal memory 2 with similar signals: OCTOSPIM_P2_CLK (clk), OCTOSPIM_P2_NCLK (nclk), OCTOSPIM_P2_DQS (Data strobe), OCTOSPIM_P2_NCS1 (nCS), OCTOSPIM_P2_NCS2, and OCTOSPIM_P2_IO[7:0] (Data[7:0]). Static muxing is used for clock and strobe signals, while dynamic muxing is used for data and chip select signals.

Block diagram of OCTOSPI direct mode showing the internal structure of the OCTOSPI I/O manager and its connection to two OCTOSPI controllers and two Octal memories.

39.4.2 OCTOSPI swapped mode

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

Figure 261. OCTOSPI swapped mode

Block diagram of OCTOSPI swapped mode showing the internal structure of the OCTOSPI I/O manager and its connection to two external Octal SPI memories.

The diagram illustrates the OCTOSPI swapped mode architecture. The OCTOSPI I/O manager is the central component, containing an AHB interface, a Control register, and a P1CR register. It interfaces with two OCTOSPI blocks (OCTOSPI1 and OCTOSPI2) via bus signals. OCTOSPI1 provides signals: OCTOSPI1 bus signals, ACK1, REQ1, CS1, and CSSEL1. OCTOSPI2 provides signals: OCTOSPI2 bus signals, REQ2, ACK2, CS2, and CSSEL2. Inside the manager, an Arbiter selects between the two OCTOSPI blocks based on requests and status. The output of the arbiter goes through dynamic muxing to an I/O matrix. The I/O matrix has two ports: Port 1 and Port 2. Port 1 is connected to external signals: OCTOSPIM_P1_CLK, OCTOSPIM_P1_NCLK, OCTOSPIM_P1_DQS, OCTOSPIM_P1_NCS1, OCTOSPIM_P1_NCS2, and OCTOSPIM_P1_IO[7:0]. Port 2 is connected to external signals: OCTOSPIM_P2_CLK, OCTOSPIM_P2_NCLK, OCTOSPIM_P2_DQS, OCTOSPIM_P2_NCS1, OCTOSPIM_P2_NCS2, and OCTOSPIM_P2_IO[7:0]. The external signals are connected to two Octal SPI memories: Octal SPI memory 1 and Octal SPI memory 2. The Octal SPI memories provide signals: clk, nclk, Data strobe, nCS, and Data[7:0].

Block diagram of OCTOSPI swapped mode showing the internal structure of the OCTOSPI I/O manager and its connection to two external Octal SPI memories.

39.4.3 Two OCTOSPIs 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 OCTOSPIM_CR[1:0].

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

The external memories can be two 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 OCTOSPI currently owning the bus.

Figure 262. OCTOSPI multiplexed mode to Port 1

Block diagram of OCTOSPI multiplexed mode to Port 1 showing OCTOSPI1 and OCTOSPI2 connected via dynamic/static muxing and I/O matrix to Port 1, interfacing to a Multichip package (MCP) with Octal memory 1 and Octal memory 2.
Block diagram of OCTOSPI multiplexed mode to Port 1 showing OCTOSPI1 and OCTOSPI2 connected via dynamic/static muxing and I/O matrix to Port 1, interfacing to a Multichip package (MCP) with Octal memory 1 and Octal memory 2.

39.4.4 Two OCTOSPIs multiplexed mode to Port 2 accessing two external memories

This is similar to OCTOSPI multiplexed mode to Port 1, but target is Port 2. This mode is selected by bits OCTOSPIM_CR[2:1].

Figure 263. OCTOSPI multiplexed mode to Port 2

Block diagram of OCTOSPI multiplexed mode to Port 2 showing OCTOSPI1 and OCTOSPI2 connected via dynamic/static muxing and I/O matrix to Port 2, interfacing to a Multichip package (MCP) with Octal memory 1 and Octal memory 2.
Block diagram of OCTOSPI multiplexed mode to Port 2 showing OCTOSPI1 and OCTOSPI2 connected via dynamic/static muxing and I/O matrix to Port 2, interfacing to a Multichip package (MCP) with Octal memory 1 and Octal memory 2.

39.4.5 OCTOSPI1 and OCTOSPI2 drive a single external memory

This is similar to OCTOSPIs 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 264).

Figure 264. OCTOSPI1 and OCTOSPI2 drive a single external memory

Block diagram illustrating OCTOSPI1 and OCTOSPI2 driving a single external memory via OCTOSPI I/O manager (OCTOSPIM)
Block diagram illustrating OCTOSPI1 and OCTOSPI2 driving a single external memory via OCTOSPI I/O manager (OCTOSPIM)

This use case is valid even when Port 2 is used instead of Port 1.

39.4.6 A single OCTOSPI 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 has to set the OCTOSPI1 chip select selector (bit 24 of OCTOSPI_CR register) each time the target memory changes.

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

Figure 265. Single OCTOSPI driving two external memories

Block diagram of a single OCTOSPI driving two external memories. The diagram shows the OCTOSPI I/O manager containing an AHB interface, control registers (P1CR, PnCR), an arbiter, and an I/O matrix. It connects to an OCTOSPI1 block and two Octal memories (memory 1 and memory 2) within a Multichip package (MCP).

The diagram illustrates the architecture of a single OCTOSPI driving two external memories. The OCTOSPI I/O manager is the central component, containing an AHB interface, control registers (P1CR, PnCR), an arbiter, and an I/O matrix. The AHB interface connects to the AHB bus. The control registers (P1CR, PnCR) are connected to the I/O matrix. The arbiter receives OCTOSPI1 bus signals (ACK1, REQ1, CS1, CSSEL1) and provides dynamic muxing to the I/O matrix. The I/O matrix provides static muxing to the I/O matrix. The I/O matrix connects to the OCTOSPI1 block and the two Octal memories (memory 1 and memory 2) within a Multichip package (MCP). The OCTOSPI1 block provides bus signals (ACK1, REQ1, CS1, CSSEL1) to the arbiter. The two Octal memories (memory 1 and memory 2) are connected to the I/O matrix via OCTOSPI1_P1_CLK, OCTOSPI1_P1_NCLK, OCTOSPI1_P1_DQS, OCTOSPI1_P1_NCS1, OCTOSPI1_P1_NCS2, and OCTOSPI1_P1_IO[7:0] signals.

Block diagram of a single OCTOSPI driving two external memories. The diagram shows the OCTOSPI I/O manager containing an AHB interface, control registers (P1CR, PnCR), an arbiter, and an I/O matrix. It connects to an OCTOSPI1 block and two Octal memories (memory 1 and memory 2) within a Multichip package (MCP).

This use case is valid even when OCTOSPI2 is used instead of OCTOSPI1.

39.5 OCTOSPIM registers

39.5.1 OCTOSPIM control register (OCTOSPIM_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 OCTOSPI clock cycles - 1

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

Bit 6 CSSEL_OVR_O2: Chip select selector override setting for OCTOSPI2

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

Bit 5 CSSEL_OVR_O1: Chip select selector override setting for OCTOSPI1

0: the chip select signal from OCTOSPI1 is sent to NCS1
1: the chip select signal from OCTOSPI1 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 OCTOSPI1 and OCTOSPI2

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

Bit 1 MODE: OCTOSPIM 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 OCTOSPIs.
0: No multiplexing, hence no arbitration
1: OCTOSPI1 and OCTOSPI2 are multiplexed over the same bus.

ST logo
ST logo

39.5.2 OCTOSPIM hardware configuration register (OCTOSPIM_HWCFGR)

Address offset: 0x03F0

Reset value: 0x0000 0002

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NUM_PORT[3:0]
rrrr

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

Bits 3:0 NUM_PORT[3:0]: Number of ports

This field returns the number of ports in the OCTOSPI I/O manager implementation

39.5.3 OCTOSPIM version register (OCTOSPIM_VERR)

Address offset: 0x03F4

Reset value: 0x0000 00XX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.MAJVER[3:0]MINVER[3:0]
rrrrrrrr

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

Bits 7:4 MAJVER[3:0]: OCTOSPIM major version

Bits 3:0 MINVER[3:0]: OCTOSPIM minor version

39.5.4 OCTOSPIM identification (OCTOSPIM_IDR)

Address offset: 0x03F8

Reset value: 0x0014 1041

31302928272625242322212019181716
ID[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
ID[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 ID[31:0]: OCTOSPIM identification

39.5.5 OCTOSPIM size identification register (OCTOSPIM_SIDR)

Address offset: 0x03FC

Reset value: 0xA3C5 DD01

31302928272625242322212019181716
SID[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
SID[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 SID[31:0]: Size identifier

This field returns the size of the memory region allocated to registers. The address decoding range is 1 Kbyte.

39.5.6 OCTOSPIM register map

Table 322. OCTOSPIM register map and reset values

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x0000OCTOSPIM_CRRes.Res.Res.Res.Res.Res.Res.Res.REQ2ACK_TIME[7:0]Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CSSEL_OVR_O2CSSEL_OVR_O1CSSEL_OVR_ENRes.Res.MODEMUXEN
Reset value0000000000000
0x03F0OCTOSPIM_HWCGRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NUM_PORT [3:0]
Reset value0010

Table 322. OCTOSPIM register map and reset values (continued)

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x03F4OCTOSPIM_VERRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MAJVER[3:0]MINVER[3:0]
Reset valueXXXXXXXX
0x03F8OCTOSPIM_IDRID[31:0]
Reset value00000000000101000001000001000001
0x03FCOCTOSPIM_SIDRSID[31:0]
Reset value10100011110001011101110100000001

Refer to Section 2.4 on page 228 for the register boundary addresses.