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
- • Supports up to two single/dual/quad/octal SPI interfaces
- • Supports up to two ports for pin assignment
Table 319. OCTOSPIM implementation
| OCTOSPI feature | Available on the devices |
|---|---|
| Supports up to two single/dual/quad interfaces | X |
| Fully I/O multiplexing capability | X |
| Supports time-multiplexed mode | X |
| Supports high-speed interface | - |
| Chip select selection if OCTOSPI provides dual chip select | X |
| 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

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 type | Description |
|---|---|---|
| OCTOSPIM_Px_NCLK | Output | OCTOSPI inverted clock to support 1.8 V HyperBus protocol |
| OCTOSPIM_Px_CLK | OCTOSPI clock | |
| OCTOSPIM_Px_IOn (n = 0 to 7) | Input/output | OCTOSPI data pins |
| OCTOSPIM_Px_NCS1,2 | Output | Chip select for the memories |
| OCTOSPIM_Px_DQS | Input/output | Data 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:
- • OCTOSPI1 mapped to Port 1, with OCTOSPI2 mapped to Port 2 (direct mode)
- • OCTOSPI1 mapped to Port 2, with OCTOSPI2 mapped to Port 1 (swapped mode)
- • OCTOSPI1 and OCTOSPI2 both mapped to Port 1, with arbitration (multiplexed mode)
- • OCTOSPI1 and OCTOSPI2 both mapped to Port 2, with arbitration (multiplexed mode)
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 mode | MUXEN | Mode | Reference |
|---|---|---|---|
| Direct | 0 | 0 | Section 39.4.1 |
| Swapped | 0 | 1 | Section 39.4.2 |
Table 321. Use cases (continued)
| IO manager mode | MUXEN | Mode | Reference |
|---|---|---|---|
| Multiplexed to Port1 | 1 | 0 | Section 39.4.3 |
| Multiplexed to Port2 | 1 | 1 | Section 39.4.4 |
| Two OCTOSPIs drive one external memory | 1 | 0 or 1, depending upon the port connected to the memory | Section 39.4.5 |
| One OCTOSPI drives two external memories | 0 | 0 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

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

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

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

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

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

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.
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
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | REQ2ACK_TIME[7:0] | |||||||
| rw | rw | rw | rw | rw | rw | rw | rw | ||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | CSSEL_OVR_O2 | CSSEL_OVR_O1 | CSSEL_OVR_EN | Res. | Res. | MODE | MUXEN |
| rw | rw | rw | rw | rw | |||||||||||
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.

39.5.2 OCTOSPIM hardware configuration register (OCTOSPIM_HWCFGR)
Address offset: 0x03F0
Reset value: 0x0000 0002
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | NUM_PORT[3:0] | |||
| r | r | r | r | ||||||||||||
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
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | MAJVER[3:0] | MINVER[3:0] | ||||||
| r | r | r | r | r | r | r | r | ||||||||
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
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| ID[31:16] | |||||||||||||||
| r | r | r | r | r | r | r | r | r | r | r | r | r | r | r | r |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| ID[15:0] | |||||||||||||||
| r | r | r | r | r | r | r | r | r | r | r | r | r | r | r | r |
Bits 31:0 ID[31:0]: OCTOSPIM identification
39.5.5 OCTOSPIM size identification register (OCTOSPIM_SIDR)
Address offset: 0x03FC
Reset value: 0xA3C5 DD01
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| SID[31:16] | |||||||||||||||
| r | r | r | r | r | r | r | r | r | r | r | r | r | r | r | r |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| SID[15:0] | |||||||||||||||
| r | r | r | r | r | r | r | r | r | r | r | r | r | r | r | r |
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
| Offset | Register name | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x0000 | OCTOSPIM_CR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | REQ2ACK_TIME[7:0] | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | CSSEL_OVR_O2 | CSSEL_OVR_O1 | CSSEL_OVR_EN | Res. | Res. | MODE | MUXEN | ||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||||||||||||||||
| 0x03F0 | OCTOSPIM_HWCGR | 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. | Res. | NUM_PORT [3:0] | |||
| Reset value | 0 | 0 | 1 | 0 | |||||||||||||||||||||||||||||
Table 322. OCTOSPIM register map and reset values (continued)
| Offset | Register name | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x03F4 | OCTOSPIM_VERR | Res. | 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 value | X | X | X | X | X | X | X | X | |||||||||||||||||||||||||
| 0x03F8 | OCTOSPIM_IDR | ID[31:0] | |||||||||||||||||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | |
| 0x03FC | OCTOSPIM_SIDR | SID[31:0] | |||||||||||||||||||||||||||||||
| Reset value | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | |
Refer to Section 2.4 on page 228 for the register boundary addresses.