25. Octo-SPI interface (OCTOSPI)

25.1 Introduction

The OCTOSPI supports most external serial memories such as serial PSRAMs, serial NAND and serial NOR Flash memories, HyperRAM™ and HyperFlash™ memories, with the following functional modes:

The OCTOSPI supports the following protocols with associated frame formats:

25.2 OCTOSPI main features

25.3 OCTOSPI implementation

Table 209. OCTOSPI implementation

OCTOSPI featureOCTOSPI1/2
HyperBus standard compliantX
Xcella standard compliantX
XSPI (JEDEC251ES) standard compliantX
AMBA® AXI compliant data interfaceX
Asynchronous AXI clock versus kernel clockX
Functional modes: Indirect, Automatic status-polling, and Memory-mappedX
Read and write support in Memory-mapped modeX
Dual-quad configurationX
SDR (single-data rate) and DTR (double-transfer rate)X
Data strobe (DS,DQS)X
Fully programmable opcodeX
Fully programmable frame formatX
Integrated FIFO for reception and transmissionX
8-, 16-, and 32-bit data accessesX
Interrupt on FIFO threshold, timeout, operation complete, and access errorX
Compliant with dual-OCTOSPI arbiter (communication regulation)X
Extended CSHT timeoutX
Memory-mapped writeX
Refresh counterX

25.4 OCTOSPI functional description

25.4.1 OCTOSPI block diagram

Figure 141. OCTOSPI block diagram in octal configuration

OCTOSPI block diagram in octal configuration showing internal components (Registers/control, Clock management, Data FIFO, Shift register) connected to an STM32 microcontroller and an Octo-SPI memory via various pins like NCLK, CLK, IO0-IO7, NCS, and DQS.

This block diagram illustrates the internal architecture of the OCTOSPI interface in octal configuration. On the left, the OCTOSPI block contains several functional units: 'Registers/control' connected to the AHB bus, 'Clock management' connected to the STM32 microcontroller, 'Data FIFO' connected to the AXI bus and receiving 'octospi_ker_ck' clock signals, and a 'Shift register'. The 'Registers/control' and 'Shift register' are also connected to the AXI bus. DMA signals (width 5) and Interrupts (width 6) are shown entering the OCTOSPI block. The 'Shift register' is connected to the 'OCTOSPIM_P1' port of the STM32 microcontroller. This port is connected to an 'Octo-SPI memory' through the following pins: OCTOSPIM_P1_NCLK (dashed line to NCLK), OCTOSPIM_P1_CLK (solid line to CLK), OCTOSPIM_P1_IO0 through OCTOSPIM_P1_IO7 (solid lines to IO0 through IO7), OCTOSPIM_P1_NCS (solid line to NCS), and OCTOSPIM_P1_DQS (dashed line to DQS). A legend at the bottom indicates that dashed lines represent signals connected or not depending on the board configuration. The reference code MSV66940V2 is present in the bottom right corner.

OCTOSPI block diagram in octal configuration showing internal components (Registers/control, Clock management, Data FIFO, Shift register) connected to an STM32 microcontroller and an Octo-SPI memory via various pins like NCLK, CLK, IO0-IO7, NCS, and DQS.

Figure 142. OCTOSPI block diagram in quad configuration

OCTOSPI block diagram in quad configuration showing internal components connected to an STM32 microcontroller and a Quad-SPI memory via pins like CLK, Q0/SI, Q1/SQ, Q2/WP, Q3/HOLD, and NCS.

This block diagram illustrates the internal architecture of the OCTOSPI interface in quad configuration. The internal components are identical to the octal configuration: 'Registers/control' (connected to AHB), 'Clock management' (connected to STM32), 'Data FIFO' (connected to AXI and receiving 'octospi_ker_ck'), and a 'Shift register' (connected to AXI and the 'OCTOSPIM_P1' port of the STM32). DMA signals (width 5) and Interrupts (width 6) are also shown. The 'OCTOSPIM_P1' port is connected to a 'Quad-SPI memory' through the following pins: OCTOSPIM_P1_CLK (solid line to CLK), OCTOSPIM_P1_IO0 (solid line to Q0/SI), OCTOSPIM_P1_IO1 (solid line to Q1/SQ), OCTOSPIM_P1_IO2 (solid line to Q2/WP), OCTOSPIM_P1_IO3 (solid line to Q3/HOLD), and OCTOSPIM_P1_NCS (solid line to NCS). The reference code MSV66941V2 is present in the bottom right corner.

OCTOSPI block diagram in quad configuration showing internal components connected to an STM32 microcontroller and a Quad-SPI memory via pins like CLK, Q0/SI, Q1/SQ, Q2/WP, Q3/HOLD, and NCS.

Figure 143. OCTOSPI block diagram in dual-quad configuration

Figure 143. OCTOSPI block diagram in dual-quad configuration. The diagram shows the internal architecture of the OCTOSPI interface within an STM32 microcontroller, connected to two Quad-SPI memory devices. The internal components include an AHB interface, AXI interface, Registers/control, Clock management, Data FIFO, and a Shift register. The OCTOSPI port (OCTOSPIM port1) connects to the external Quad-SPI memory 1 and Quad-SPI memory 2. The connections are: OCTOSPIM_P1_CLK to CLK, OCTOSPIM_P1_IO0 to Q0/SI, OCTOSPIM_P1_IO1 to Q1/SQ, OCTOSPIM_P1_IO2 to Q2/WP, OCTOSPIM_P1_IO3 to Q3/HOLD, and OCTOSPIM_P1_NCS to NCS for both memory devices. The Data FIFO is connected to the AXI interface and the Shift register. The Shift register is connected to the OCTOSPIM port. The Registers/control and Clock management are connected to the AHB interface and the Shift register. The octospi_ker_ck signal is input to the OCTOSPI block. DMA signals and Interrupts are also input to the OCTOSPI block. The diagram is labeled MSv66942V2.
Figure 143. OCTOSPI block diagram in dual-quad configuration. The diagram shows the internal architecture of the OCTOSPI interface within an STM32 microcontroller, connected to two Quad-SPI memory devices. The internal components include an AHB interface, AXI interface, Registers/control, Clock management, Data FIFO, and a Shift register. The OCTOSPI port (OCTOSPIM port1) connects to the external Quad-SPI memory 1 and Quad-SPI memory 2. The connections are: OCTOSPIM_P1_CLK to CLK, OCTOSPIM_P1_IO0 to Q0/SI, OCTOSPIM_P1_IO1 to Q1/SQ, OCTOSPIM_P1_IO2 to Q2/WP, OCTOSPIM_P1_IO3 to Q3/HOLD, and OCTOSPIM_P1_NCS to NCS for both memory devices. The Data FIFO is connected to the AXI interface and the Shift register. The Shift register is connected to the OCTOSPIM port. The Registers/control and Clock management are connected to the AHB interface and the Shift register. The octospi_ker_ck signal is input to the OCTOSPI block. DMA signals and Interrupts are also input to the OCTOSPI block. The diagram is labeled MSv66942V2.

25.4.2 OCTOSPI interface to memory modes

The OCTOSPI supports the following protocols:

The OCTOSPI uses from 6 to 12 signals to interface with a memory, depending on the functional mode:

25.4.3 OCTOSPI Regular-command protocol

When in Regular-command protocol, the OCTOSPI communicates with the external device using commands. Each command can include the following phases:

Any of these phases can be configured to be skipped but, in case of single-phase command, the only use case supported is instruction-phase-only.

The NCS falls before the start of each command and rises again after each command finishes.

In Memory-mapped mode, both read and write operations are supported: as a consequence, some of the configuration registers are duplicated to specify write operations (read operations are configured using regular registers).

Figure 144. SDR read command in octal configuration

Timing diagram for SDR read command in octal configuration. The diagram shows three signals: NCS (active-low chip select), CLK (clock), and IO[7:0] (data lines). The sequence starts with NCS falling. The instruction phase consists of two bytes: ECh and 13h. The address phase consists of four bytes: A[31:24], A[23:16], A[15:8], and A[7:0]. The dummy phase consists of one byte, labeled 'Pre-drive'. The data phase consists of four bytes: D0, D1, D2, and D3. The diagram is labeled MSv43488V1.
Timing diagram for SDR read command in octal configuration. The diagram shows three signals: NCS (active-low chip select), CLK (clock), and IO[7:0] (data lines). The sequence starts with NCS falling. The instruction phase consists of two bytes: ECh and 13h. The address phase consists of four bytes: A[31:24], A[23:16], A[15:8], and A[7:0]. The dummy phase consists of one byte, labeled 'Pre-drive'. The data phase consists of four bytes: D0, D1, D2, and D3. The diagram is labeled MSv43488V1.

The specific Regular-command protocol features are configured through the registers in the 0x0100-0x01FC offset range.

Instruction phase

During this phase, a 1- to 4-byte instruction is sent to the external device specifying the type of operation to be performed. The size of the instruction to be sent is configured in ISIZE[1:0] of OCTOSPI_CCR and the instruction is programmed in INSTRUCTION[31:0] of OCTOSPI_IR.

The instruction phase can optionally send:

This can be configured using IMODE[2:0] of OCTOSPI_CCR.

The instruction can be sent in DTR (double-transfer rate) mode on each rising and falling edge of the clock, by setting IDTR in OCTOSPI_CCR.

When IMODE[2:0] = 000 in OCTOSPI_CCR, the instruction phase is skipped, and the command sequence starts with the address phase, if present.

In Memory-mapped mode, the instruction used for the write operation is specified in OCTOSPI_WIR and the instruction format is specified in OCTOSPI_WCCR. The instruction used for the read operation and the instruction format are specified in OCTOSPI_IR and OCTOSPI_CCR.

Address phase

In the address phase, 1 to 4 bytes are sent to the external device, to indicate the address of the operation. The number of address bytes to be sent is configured in ADSIZE[1:0] of OCTOSPI_CCR.

In Indirect and Automatic status-polling modes, the address bytes to be sent are specified in ADDRESS[31:0] of OCTOSPI_AR. In Memory-mapped mode, the address is given directly via the AXI (from any master in the system).

The address phase can send:

This can be configured using ADMODE[2:0] of OCTOSPI_CCR.

The address can be sent in DTR mode (on each rising and falling edge of the clock) setting ADDTR of OCTOSPI_CCR.

When ADMODE[2:0] = 000, the address phase is skipped and the command sequence proceeds directly to the next phase, if any.

In Memory-mapped mode, the address format for the write operation is specified in OCTOSPI_WCCR. The address format for the read operation is specified in OCTOSPI_CCR.

Alternate-bytes phase

In the alternate-bytes phase, 1 to 4 bytes are sent to the external device, generally to control the mode of operation. The number of alternate bytes to be sent is configured in ABSIZE[1:0] of OCTOSPI_CCR. The bytes to be sent are specified in OCTOSPI_ABR.

The alternate-byte phase can send:

This can be configured using ABMODE[2:0] of OCTOSPI_CCR.

The alternate bytes can be sent in DTR mode (on each rising and falling edge of the clock) setting ABDTR of OCTOSPI_CCR.

When ABMODE[2:0] = 000, the alternate-bytes phase is skipped and the command sequence proceeds directly to the next phase, if any.

There may be times when only a single nibble needs to be sent during the alternate-byte phase rather than a full byte, such as when the dual-SPI mode is used and only two cycles are used for the alternate bytes.

In this case, the firmware can use the quad-SPI mode (ABMODE[2:0] = 011) and send a byte with bits 7 and 3 of ALTERNATE[31:0] set to 1 (keeping the IO3 line high), and bits 6 and 2 set to 0 (keeping the IO2 line low), in OCTOSPI_IR.

The upper two bits of the nibble to be sent are then placed in bits 4:3 of ALTERNATE[31:0] while the lower two bits are placed in bits 1:0. For example, if the nibble 2 (0010) is to be sent over IO0/IO1, then ALTERNATE[31:0] must be set to 0x8A (1000_1010).

In Memory-mapped mode, the alternate bytes used for the write operation are specified in OCTOSPI_WABR and the alternate byte format is specified in OCTOSPI_WCCR. The alternate bytes used for read operation and the alternate byte format are specified in OCTOSPI_ABR and OCTOSPI_CCR.

Dummy-cycle phase

In the dummy-cycle phase, 1 to 31 cycles are given without any data being sent or received, in order to give the external device, the time to prepare for the data phase when the higher clock frequencies are used. The number of cycles given during this phase is specified in DCYC[4:0] of OCTOSPI_TCR. In both SDR and DTR modes, the duration is specified as a number of full CLK cycles.

When DCYC[4:0] = 00000, the dummy-cycle phase is skipped, and the command sequence proceeds directly to the data phase, if present.

In order to assure enough “turn-around” time for changing the data signals from the output mode to the input mode, there must be at least one dummy cycle when using the dual-SPI, the quad-SPI or the octal-SPI mode, to receive data from the external device.

In Memory-mapped mode, the dummy cycles for the write operations are specified in OCTOSPI_WTCR. The dummy cycles for the read operation are specified in OCTOSPI_TCR.

Data phase

During the data phase, any number of bytes can be sent to or received from the external device.

In Indirect mode, the number of bytes to be sent/received is specified in OCTOSPI_DLR. In this mode, the data to be sent to the external device must be written to OCTOSPI_DR, while in Indirect-read mode the data received from the external device is obtained by reading OCTOSPI_DR.

In Automatic status-polling mode, the number of bytes to be received is specified in OCTOSPI_DLR and the data received from the external device can be obtained by reading OCTOSPI_DR.

In Memory-mapped mode, the data read or written, is sent or received directly over the AXI to the Cortex core or to a DMA.

The data phase can send/receive:

This can be configured using DMODE[2:0] of OCTOSPI_CCR.

The data can be sent or received in DTR mode (on each rising and falling edge of the clock) setting DDTR of OCTOSPI_CCR.

When DMODE[2:0] = 000, the data phase is skipped, and the command sequence finishes immediately by raising the NCS. This configuration must be used only in Indirect-write mode.

In Memory-mapped mode, the data format for the write operation is specified in OCTOSPI_WCCR. The data format for the read operation is specified in OCTOSPI_CCR.

DQS usage

The DQS signal can be used for data strobing during the read transactions when the device toggles the DQS aligned with the data.

The DQS management can be enabled by setting DQSE of OCTOSPI_CCR.

Timing diagram for DTR read in octal-SPI mode with DQS (Macronix mode). The diagram shows four signals: NCS (active low), CLK (clock), DQS (data strobe), and IO[7:0] (data lines). The sequence starts with NCS going low, followed by CLK. IO[7:0] outputs an EWh (Erase/Write Hex) and 11h (Address). The address is split into four bytes: A[31:24], A[23:16], A[15:8], and A[7:0]. A dummy phase follows, represented by a shaded area. Then, data is received in two word units: D1, D0, D3, and D2. DQS is shown as a pulse train during the data phase. The diagram is labeled MSv43489V1.

Figure 145. DTR read in octal-SPI mode with DQS (Macronix mode) example

Timing diagram for DTR read in octal-SPI mode with DQS (Macronix mode). The diagram shows four signals: NCS (active low), CLK (clock), DQS (data strobe), and IO[7:0] (data lines). The sequence starts with NCS going low, followed by CLK. IO[7:0] outputs an EWh (Erase/Write Hex) and 11h (Address). The address is split into four bytes: A[31:24], A[23:16], A[15:8], and A[7:0]. A dummy phase follows, represented by a shaded area. Then, data is received in two word units: D1, D0, D3, and D2. DQS is shown as a pulse train during the data phase. The diagram is labeled MSv43489V1.

25.4.4 OCTOSPI Regular-command protocol signal interface

Single-SPI mode

The legacy SPI mode allows just a single bit to be sent/received serially. In this mode, the data is sent to the external device over the SO signal (whose I/Os are shared with IO0). The data received from the external device arrives via SI (whose I/Os are shared with IO1).

The different phases can each be configured separately to use this single-SPI mode by setting to 001 the IMODE, ADMODE, ABMODE, and DMODE fields in OCTOSPI_CCR and OCTOSPI_WCCR.

In each phase configured in single-SPI mode:

This is the case even for the dummy phase if DMODE[2:0] = 001.

Dual-SPI mode

In dual-SPI mode, two bits are sent/received simultaneously over the IO0/IO1 signals.

The different phases can each be configured separately to use dual-SPI mode by setting to 010 the IMODE, ADMODE, ABMODE, and DMODE fields in OCTOSPI_CCR and OCTOSPI_WCCR.

In each phase configured in dual-SPI mode:

In the dummy phase when DMODE[2:0] = 010, IO0/IO1 are always high-impedance.

Quad-SPI mode

In quad-SPI mode, four bits are sent/received simultaneously over the IO0/IO1/IO2/IO3 signals.

The different phases can each be configured separately to use the quad-SPI mode by setting to 011 the IMODE, ADMODE, ABMODE, and DMODE fields in OCTOSPI_CCR and OCTOSPI_WCCR.

In each phase configured in quad-SPI mode:

In the dummy phase when DMODE[2:0] = 011, IO0 to IO3 are all high-impedance.

IO2 and IO3 are used only in quad-SPI mode. If none of the phases are configured to use the quad-SPI mode, then the pins corresponding to IO2 and IO3 can be used for other functions even while the OCTOSPI is active.

Octal-SPI mode

In regular octal-SPI mode, the eight bits are sent/received simultaneously over the IO[0:7] signals.

The different phases can each be configured separately to use the octal-SPI mode by setting to 100 the IMODE, ADMODE, ABMODE, and DMODE fields in OCTOSPI_CCR and OCTOSPI_WCCR.

In each phase that is configured in octal-SPI mode, IO[0:7] are all at high-impedance (input) during the data phase for read operations, and outputs in all other cases.

In the dummy phase when DMODE[2:0] = 100, IO[0:7] are all high-impedance.

IO[4:7] are used only in Octal-SPI mode. If none of the phases are configured to use octal-SPI mode, then the pins corresponding to IO[4:7] can be used for other functions even while the OCTOSPI is active.

Single-data rate (SDR) mode

By default, all the phases operate in single-data rate (SDR) mode.

In SDR mode, when the OCTOSPI drives the IO0/SO, IO1 to IO7 signals, these signals transition only with the falling edge of CLK.

When receiving data in SDR mode, the OCTOSPI assumes that the external devices also send the data using CLK falling edge. By default (when SSHIFT = 0 in OCTOSPI_TCR), the signals are sampled using the following (rising) edge of CLK.

Figure 146. SDR write command in octo-SPI mode example

Timing diagram for SDR write command in octo-SPI mode. It shows three signals: NCS (active low), CLK (square wave), and IO[7:0] (data bus). The sequence starts with a preamble (hatched area), followed by instruction 02h, alternate byte FDh, address A[31:24], A[23:16], A[15:8], A[7:0], data D0, D1, a break symbol, data D254, D255, and another preamble. The label MSv43490V1 is in the bottom right.
Timing diagram for SDR write command in octo-SPI mode. It shows three signals: NCS (active low), CLK (square wave), and IO[7:0] (data bus). The sequence starts with a preamble (hatched area), followed by instruction 02h, alternate byte FDh, address A[31:24], A[23:16], A[15:8], A[7:0], data D0, D1, a break symbol, data D254, D255, and another preamble. The label MSv43490V1 is in the bottom right.

Note: Due to internal synchronization, up to six extra dummy clock cycles may be generated by the Octo-SPI interface after the last data is read.

Double-transfer rate (DTR) mode

Each of the instruction, address, alternate-byte and data phases can be configured to operate in DTR mode setting IDTR, ADDTR, ABDTR, and DDTR in OCTOSPI_CCR.

In Memory-mapped mode, the DTR mode for each phase of the write operations is specified in OCTOSPI_WCCR. The DTR mode for each phase of the read operations is specified in OCTOSPI_CCR.

In DTR mode, when the OCTOSPI drives the IO0/SO and IO1to IO7 signals in the instruction, address, and alternate-byte phases, a bit is sent or received on each of the falling and rising edges of CLK.

When receiving data in DTR mode, the OCTOSPI assumes that the external devices also send the data using both CLK rising and falling edges. When DDTR = 1 in OCTOSPI_CCR, the software must clear SSHIFT in OCTOSPI_TCR. Thus, the signals are sampled one half of a CLK cycle later (on the following, opposite edge).

In DTR mode, it is recommended to set DHQC of OCTOSPI_TCR, to shift the outputs by a quarter of cycle and avoid to hold issues on the memory side.

Note: DHQC must not be set when the prescaler value is 0, as this action leads to unpredictable behavior.

Figure 147. DTR write in octal-SPI mode (Macronix mode) example

Timing diagram for DTR write in octal-SPI mode (Macronix mode). It shows three signals: NCS (active low), CLK (square wave), and IO[7:0] (data bus). The sequence starts with a preamble (hatched area), followed by instruction 02h, alternate byte FDh, address A[31:24], A[23:16], A[15:8], A[7:0], data D1, D0, a break symbol, data D255, D254, and another preamble. Two 'Word Unit' labels with double-headed arrows indicate the data transfer period between the break symbols. The label MSv43491V1 is in the bottom right.
Timing diagram for DTR write in octal-SPI mode (Macronix mode). It shows three signals: NCS (active low), CLK (square wave), and IO[7:0] (data bus). The sequence starts with a preamble (hatched area), followed by instruction 02h, alternate byte FDh, address A[31:24], A[23:16], A[15:8], A[7:0], data D1, D0, a break symbol, data D255, D254, and another preamble. Two 'Word Unit' labels with double-headed arrows indicate the data transfer period between the break symbols. The label MSv43491V1 is in the bottom right.

Note: Due to internal synchronization, up to six extra dummy clock cycles may be generated by the Octo-SPI interface after the last data is read.

Dual-quad configuration

When DMM = 1 in OCTOSPI_CR, the OCTOSPI is in dual-memory configuration: if DMODE = 100, two external Quad-SPI devices (device A and device B) are used in order to

send/receive eight bits (or 16 bits in DTR mode) every cycle, effectively doubling the throughput.

Each device (A or B) uses the same CLK and NCS signals, but each has separate IO0 to IO3 signals.

The dual-quad configuration can be used in conjunction with the single-SPI, dual-SPI, and quad-SPI modes, as well as with either the SDR or DTR mode.

The device size, as specified in DEVSIZE[4:0] of OCTOSPI_DCR1, must reflect the total external device capacity, that is the double of the size of one individual component.

If address X is even, then the byte that the OCTOSPI gives for address X is the byte at the address X/2 of device A, and the byte that the OCTOSPI gives for address X + 1 is the byte at the address X/2 of device B. In other words, the bytes at even addresses are all stored in device A and the bytes at odd addresses are all stored in device B.

When reading the status registers of the devices in dual-quad configuration, twice as many bytes must be read compared to the same read in Regular-command protocol: if each device gives eight valid bits after the instruction for fetching the status register, then the OCTOSPI must be configured with a data length of 2 bytes (16 bits), and the OCTOSPI receives one byte from each device.

If each device gives a status of 16 bits, then the OCTOSPI must be configured to read 4 bytes to get all the status bits of both devices in dual-quad configuration. The least-significant byte of the result (in the data register) is the least-significant byte of device A status register. The next byte is the least-significant byte of device B status register. Then, the third byte of the data register is the device A second byte. The forth byte is the device B second byte (if devices have 16-bit status registers).

An even number of bytes must always be accessed in dual-quad configuration. For this reason, bit 0 of DL[31:0] in OCTOSPI_DLR is stuck at 1 when DMM = 1.

In dual-quad configuration, the behavior of device A interface signals is basically the same as in normal mode. Device B interface signals have exactly the same waveforms as device A ones during the instruction, address, alternate-byte, and dummy-cycle phases. In other words, each device always receives the same instruction and the same address.

Then, during the data phase, the AIOx and the BIOx buses both transfer data in parallel, but the data that is sent to (or received from) device A is distinct than the one from device B.

25.4.5 HyperBus protocol

The OCTOSPI can communicate with the external device using the HyperBus protocol.

The HyperBus uses 11 to 12 pins depending on the operating voltage:

The HyperBus does not require any command specification nor any alternate bytes. As a consequence, a separate register set is used to define the timing of the transaction.

The HyperBus frame is composed of the following phases:

The NCS falls before the start of a transaction and rises again after each transaction finishes.

Figure 148. Example of HyperBus read operation

Timing diagram for HyperBus read operation showing NCS, CK, RWDS, and DQ[7:0] signals. The diagram illustrates the Command-Address phase (48 bits: 47:40, 39:32, 31:24, 23:16, 15:8, 7:0) followed by the Data phase (Dn A, Dn B, Dn+1 A, Dn+1 B). Key timing parameters include t_RWR (Read write recovery), t_ACC (Initial access), and Latency count. The Host drives DQ[7:0] and memory drives RWDS. RWDS and data are edge aligned. Memory drives DQ[7:0] and RWDS. MSv43492V1
Timing diagram for HyperBus read operation showing NCS, CK, RWDS, and DQ[7:0] signals. The diagram illustrates the Command-Address phase (48 bits: 47:40, 39:32, 31:24, 23:16, 15:8, 7:0) followed by the Data phase (Dn A, Dn B, Dn+1 A, Dn+1 B). Key timing parameters include t_RWR (Read write recovery), t_ACC (Initial access), and Latency count. The Host drives DQ[7:0] and memory drives RWDS. RWDS and data are edge aligned. Memory drives DQ[7:0] and RWDS. MSv43492V1

Note: Due to internal synchronization, up to six extra dummy clock cycles may be generated by the Octo-SPI interface after the last data is read.

The specific HyperBus features are configured through the registers in the 0x0200-0x02FC offset range.

Command/address phase

During this initial phase, the OCTOSPI sends 48 bits over IO[7:0] to specify the operations to be performed with the external device.

Table 210. Command/address phase description

CA bitBit nameDescription
47R/W#Identifies the transaction as a read or a write.
46Address spaceIndicates if the transaction accesses the memory or the register space.
45Burst typeIndicates if the burst is linear or wrapped.
44-16Row and upper column addressSelects the row and the upper column addresses.
15-3Reserved-
2-0Lower column addressSelects the starting 16-bit word within the half page.

The address space is configured through the memory type MTYP[2:0] of OCTOSPI_DCR1.

The total size of the device is configured in DEVSIZE[4:0] of OCTOSPI_DCR1. In case of multi-chip product (MCP), the device size is the sum of all the sizes of all the MCP dies.

Read/write operation with initial latency

The HyperBus read and write operations need to respect two timings:

During the read operation, the RWDS is used by the device, in two ways (see Figure 148 ):

During the write operation the RWDS is used:

Figure 149. HyperBus write operation with initial latency

Timing diagram for HyperBus write operation with initial latency. The diagram shows four signals: NCS (active low), CK (clock), RWDS (read/write data strobe), and DQ[7:0] (data bus). The operation starts with NCS going low. The first phase is the Command-Address phase, where DQ[7:0] carries values 47:40, 39:32, 31:24, 23:16, 15:8, and 7:0. RWDS is driven by the memory device. The second phase is the Data phase, where DQ[7:0] carries data blocks Dn A, Dn B, Dn+1 A, and Dn+1 B. RWDS is driven by the host. Timing parameters shown are t_RWR (Read Write Recovery), t_ACC (Access), and Latency count. A note indicates that High = 2x Latency count and Low = 1x Latency count for RWDS. Another note states that CK and data are center aligned. The diagram is labeled MSV43494V1.

MSV43494V1

Timing diagram for HyperBus write operation with initial latency. The diagram shows four signals: NCS (active low), CK (clock), RWDS (read/write data strobe), and DQ[7:0] (data bus). The operation starts with NCS going low. The first phase is the Command-Address phase, where DQ[7:0] carries values 47:40, 39:32, 31:24, 23:16, 15:8, and 7:0. RWDS is driven by the memory device. The second phase is the Data phase, where DQ[7:0] carries data blocks Dn A, Dn B, Dn+1 A, and Dn+1 B. RWDS is driven by the host. Timing parameters shown are t_RWR (Read Write Recovery), t_ACC (Access), and Latency count. A note indicates that High = 2x Latency count and Low = 1x Latency count for RWDS. Another note states that CK and data are center aligned. The diagram is labeled MSV43494V1.

Read/write operation with additional latency

If the device needs an additional latency (during refresh period of a SDRAM for example), RWDS must be tied to one during one of the RWDS signals, during the command/address phase.

An additional \( t_{ACC} \) duration is added by the OCTOSPI to meet the device request.

Figure 150. HyperBus read operation with additional latency

Timing diagram for HyperBus read operation with additional latency. The diagram shows four signals: NCS (active low), CK (clock), RWDS (read/write data strobe), and DQ[7:0] (data bus). The sequence starts with a Command-Address phase on DQ[7:0] (values 47:40, 39:32, 31:24, 23:16, 15:8, 7:0). NCS goes low. RWDS is driven by memory. After the command, there is a read write recovery time (t_RWR). Then, an 'Additional latency' period is shown. This is followed by 'Latency count 1' and 'Latency count 2' on the CK signal. The RWDS signal is high for 2x latency count and low for 1x latency count. The access time (t_ACC) is measured from the start of the additional latency to the start of the data. Data is driven by memory on DQ[7:0] (values Dn A, Dn B, Dn+1 A, Dn+1 B). RWDS and data are edge aligned. Host drives DQ[7:0] and memory drives RWDS. Reference MSv43495V1.
Timing diagram for HyperBus read operation with additional latency. The diagram shows four signals: NCS (active low), CK (clock), RWDS (read/write data strobe), and DQ[7:0] (data bus). The sequence starts with a Command-Address phase on DQ[7:0] (values 47:40, 39:32, 31:24, 23:16, 15:8, 7:0). NCS goes low. RWDS is driven by memory. After the command, there is a read write recovery time (t_RWR). Then, an 'Additional latency' period is shown. This is followed by 'Latency count 1' and 'Latency count 2' on the CK signal. The RWDS signal is high for 2x latency count and low for 1x latency count. The access time (t_ACC) is measured from the start of the additional latency to the start of the data. Data is driven by memory on DQ[7:0] (values Dn A, Dn B, Dn+1 A, Dn+1 B). RWDS and data are edge aligned. Host drives DQ[7:0] and memory drives RWDS. Reference MSv43495V1.

Figure 151. HyperBus write operation with additional latency

Timing diagram for HyperBus write operation with additional latency. The diagram shows four signals: NCS (active low), CK (clock), RWDS (read/write data strobe), and DQ[7:0] (data bus). The sequence starts with a Command-Address phase on DQ[7:0] (values 47:40, 39:32, 31:24, 23:16, 15:8, 7:0). NCS goes low. RWDS is driven by memory. After the command, there is a read write recovery time (t_RWR). Then, an 'Additional latency' period is shown. This is followed by 'Latency count 1' and 'Latency count 2' on the CK signal. The RWDS signal is high for 2x latency count and low for 1x latency count. The initial access time (t_ACC) is measured from the start of the additional latency to the start of the data. Data is driven by host on DQ[7:0] (values Dn A, Dn B, Dn+1 A, Dn+1 B). CK and data are center aligned. Host drives DQ[7:0] and RWDS. Reference MSv43496V1.
Timing diagram for HyperBus write operation with additional latency. The diagram shows four signals: NCS (active low), CK (clock), RWDS (read/write data strobe), and DQ[7:0] (data bus). The sequence starts with a Command-Address phase on DQ[7:0] (values 47:40, 39:32, 31:24, 23:16, 15:8, 7:0). NCS goes low. RWDS is driven by memory. After the command, there is a read write recovery time (t_RWR). Then, an 'Additional latency' period is shown. This is followed by 'Latency count 1' and 'Latency count 2' on the CK signal. The RWDS signal is high for 2x latency count and low for 1x latency count. The initial access time (t_ACC) is measured from the start of the additional latency to the start of the data. Data is driven by host on DQ[7:0] (values Dn A, Dn B, Dn+1 A, Dn+1 B). CK and data are center aligned. Host drives DQ[7:0] and RWDS. Reference MSv43496V1.

Fixed-latency mode

Some devices or some applications may not want to operate with a variable latency time as described above.

The latency can be forced to \( 2 \times t_{ACC} \) by setting LM of OCTOSPI_HLCR.

In this OCTOSPI latency mode, the state of the RWDS signal is not taken into account by the OCTOSPI and an additional latency is always added, leading to a fixed \( 2 \times t_{ACC} \) latency time.

Write operation with no latency

Some devices can also require a zero latency for the write operations. This write-zero latency can be forced by setting WZL in OCTOSPI_HLCR.

Figure 152. HyperBus write operation with no latency

Timing diagram for HyperBus write operation with no latency. The diagram shows four signals: NCS (active low), CK (clock), RWDS (write data strobe), and DQ[7:0] (data bus). NCS is low during the entire operation. CK is a periodic square wave. RWDS is driven by memory but ignored by the master. DQ[7:0] shows a sequence of data: 47:40, 39:32, 31:24, 23:16, 15:8, 7:0, 15:8, 7:0. The first six are labeled 'Command-Address' and the last two are labeled 'Data'. The diagram is labeled MSv43497V1.
Timing diagram for HyperBus write operation with no latency. The diagram shows four signals: NCS (active low), CK (clock), RWDS (write data strobe), and DQ[7:0] (data bus). NCS is low during the entire operation. CK is a periodic square wave. RWDS is driven by memory but ignored by the master. DQ[7:0] shows a sequence of data: 47:40, 39:32, 31:24, 23:16, 15:8, 7:0, 15:8, 7:0. The first six are labeled 'Command-Address' and the last two are labeled 'Data'. The diagram is labeled MSv43497V1.

Latency on page-crossing during the read operations

An additional latency can be needed by some devices for the read operation when crossing pages.

The initial latency must be respected for any page access, as a consequence, when the first access is close to the page boundary, a latency is automatically added at the page crossing to respect the \( t_{ACC} \) time.

Figure 153. HyperBus read operation page crossing with latency

Timing diagram for HyperBus read operation page crossing with latency. The diagram shows four signals: NCS (active low), CK (clock), RDS (read data strobe), and DQ[7:0] (data bus). NCS is low during the operation. CK is a periodic square wave. RDS is driven by memory. DQ[7:0] shows data: A0, 02, 46, 8A, 80, 07 (labeled 'Read from Address = 123457h'), followed by a '12 clock initial latency' period. Then '9 words data' are shown: dd, dd, dd, dd, dd, dd, dd, dd, dd. These are associated with addresses: Address 123457, Address 123458, Address 12345D, Address 12345E, Address 12345F, Address 123460, Address 123461. A '3 clock initial page crossing latency' is indicated between the first and second groups of data. The diagram is labeled MSv43498V2.
Timing diagram for HyperBus read operation page crossing with latency. The diagram shows four signals: NCS (active low), CK (clock), RDS (read data strobe), and DQ[7:0] (data bus). NCS is low during the operation. CK is a periodic square wave. RDS is driven by memory. DQ[7:0] shows data: A0, 02, 46, 8A, 80, 07 (labeled 'Read from Address = 123457h'), followed by a '12 clock initial latency' period. Then '9 words data' are shown: dd, dd, dd, dd, dd, dd, dd, dd, dd. These are associated with addresses: Address 123457, Address 123458, Address 12345D, Address 12345E, Address 12345F, Address 123460, Address 123461. A '3 clock initial page crossing latency' is indicated between the first and second groups of data. The diagram is labeled MSv43498V2.

25.4.6 Specific features

The OCTOSPI supports some specific features, such as:

Wrap support

The OCTOSPI supports an hybrid wrap as defined by the HyperBus protocol. An hybrid wrap is also supported in the Regular-command protocol.

In hybrid wrap, the transaction can continue after the initial wrap with an incremental access.

The wrap size supported by the target memory is configured by WRAPSIZE in OCTOSPI_DCR2.

Wrap is supported only in memory-read direction and only for data size = 8 bytes. Wrapped reads are supported for both HyperBus and Regular-command protocols. To enable wrapped-read accesses, the dedicated registers OCTOSPI_WPxxx must be programmed according to the wrapped-read access characteristics. The dedicated OCTOSPI_WPxxx registers apply for both HyperBus and Regular-command protocols.

If the target memory is not supporting the hybrid wrap, WRAPSIZE must be set to 0.

NCS boundary and refresh

Two processes can be activated to regulate the OCTOSPI transactions:

The NCS boundary feature limits a transaction to a boundary of aligned addresses. The size of the address to be aligned with, is configured in CSBOUND[4:0] of OCTOSPI_DCR3 and it is equal to \( 2^{\text{CSBOUND}} \) .

As an example, if CSBOUND[4:0] = 0x4, the boundary is set to \( 2^4 = 16 \) bytes. As a consequence, the NCS is released each time that the LSB address is equal to 0xF and each time that a new transaction is issued to address the next data.

If CSBOUND[4:0] = 0, the feature is disabled and a minimum value of 3 is recommended.

The NCS boundary feature cannot be used for Flash memory devices in write mode since a command is necessary to program another page of the Flash memory.

The refresh feature limits the duration of the transactions to the value programmed in REFRESH[31:0] of OCTOSPI_DCR4. The duration is expressed in number of cycles. This allows an external RAM to perform its internal refresh operation regularly.

The refresh value must be greater than the minimal transaction size in terms of number of cycles including the command/address/alternate/dummy phases.

If NCS boundary and refresh are enabled at the same time, the NCS is released on the first condition met.

Communication regulation

The communication regulation feature limits the maximum length of a transaction to the value programmed in MAXTRAN[7:0] of OCTOSPI_DCR3.

If the number of clock cycles reach the MAXTRAN + 1 value, and if the second OCTOSPI requests an access, the NCS is released and a new transaction is issued to address the next data. If the second OCTOSPI does not request an access, the transaction is not stopped and the NCS is not released.

If MAXTRAN[7:0] = 0, no limitation occurs.

The MAXTRAN[7:0] value must be greater than the minimal transaction size in terms of number of cycles including the command, address, alternate, and dummy phases.

Note: The communication regulation feature cannot be used in write mode for the Flash memory devices that require extra command to re-enable the write operation after the NCS is active again.

If NCS boundary, refresh and communication regulation are enabled at the same time, the NCS is released on the first condition met.

Re-starting after an interrupted transfer

When a read or write operation is interrupted by a timeout or communication regulation feature, the Octo-SPI interface, as soon as possible after getting back the port ownership, re-issues the initial command sequence together with the address following the last address actually accessed before interruption. The transfer initially set goes on and ends seamlessly.

25.4.7 OCTOSPI operating modes introduction

The OCTOSPI has the following operating modes regardless of the low-level protocol used (either Regular-command or HyperBus):

25.4.8 OCTOSPI Indirect mode

In Indirect mode, the commands are started by writing to the OCTOSPI registers and the data is transferred by writing or reading the data register, in a similar way to other communication peripherals.

When FMODE[1:0] = 0 in OCTOSPI_CR, the OCTOSPI is in Indirect-write mode: bytes are sent to the external device during the data phase. Data is provided by writing to OCTOSPI_DR.

When FMODE[1:0] = 01, the OCTOSPI is in Indirect-read mode: bytes are received from the external device during the data phase. Data is recovered by reading OCTOSPI_DR.

In Indirect mode, when the OCTOSPI is configured in DTR mode over eight lanes with DQS disabled, the given starting address and the data length must be even.

Note: The OCTOSPI_AR register must be updated even if the start address is the same as the start address of the previous indirect access

The number of bytes to be read/written is specified in OCTOSPI_DLR:

When the programmed number of bytes to be transmitted or received is reached, TCF bit is set in OCTOSPI_SR and an interrupt is generated if TCIE = 1 in OCTOSPI_CR. In the case of an undefined number of data, TCF is set when the limit of the external SPI memory is reached, according to the device size defined in OCTOSPI_DCR1.

Triggering the start of a transfer in Regular-command protocol

Depending on the OCTOSPI configuration, there are three different ways to trigger the start of a transfer in Indirect mode when using Regular-command protocol. In general, the start of transfer is triggered as soon as the software gives the last information that is necessary for the command. More specifically in Indirect mode, a transfer starts when one of the following sequence of events occurs:

A write to OCTOSPI_ABR never triggers the communication start. If alternate bytes are required, they must have been programmed before.

As soon as a command is started, the BUSY bit is automatically set in OCTOSPI_SR.

Triggering the start of a transfer in HyperBus protocol

Depending on the OCTOSPI configuration, there are different ways to trigger the start of a command in Indirect mode. In general, it is triggered as soon as the firmware gives the last information that is necessary for the transfer to start, and more specifically, a communication in Indirect mode is triggered by one of the following register settings, when it is the last one to be executed:

Note: In case of HyperBus, a (dummy) write to OCTOSPI_IR is required to trigger the transfer, as for Regular-command protocol.

As soon as a transfer is started, the BUSY bit (OCTOSPI_SR[5]) is automatically set.

FIFO and data management

Data in Indirect mode passes through a 32-byte FIFO that is internal to the OCTOSPI. FLEVEL in OCTOSPI_SR indicates how many bytes are currently being held in the FIFO.

In Indirect-write mode (FMODE[1:0] = 00), the software adds data to the FIFO when it writes in OCTOSPI_DR. A word write adds 4 bytes to the FIFO, a half-word write adds 2 bytes, and a byte write adds only 1 byte. If the software adds too many bytes to the FIFO (more than indicated in DL[31:0]), the extra bytes are flushed from the FIFO at the end of the write operation (when TCF is set).

The byte/half-word accesses to OCTOSPI_DR must be done only to the least significant byte/halfword of the 32-bit register.

FTHRES is used to define a FIFO threshold after which point the FIFO threshold flag, FTF, gets set. In Indirect-read mode, FTF is set when the number of valid bytes to be read from the FIFO is above the threshold. FTF is also set if there is any data left in the FIFO after the last byte is read from the external device, regardless of FTHRES setting. In Indirect-write mode, the FTF is set when the number of empty bytes in the FIFO is above the threshold.

If FTIE = 1, there is an interrupt when the FTF is set. If DMAEN = 1, a DMA transfer is initiated when the FTF is set. The FTF is cleared by hardware as soon as the threshold condition is no longer true (after enough data has been transferred by the CPU or DMA).

The last data read in RX FIFO remains valid as long as there is no request for the next line. This means that, when the application reads several times in a row at the same location, the data is provided from the RX FIFO and not read again from the distant memory.

25.4.9 OCTOSPI Automatic status-polling mode

In Automatic status-polling mode, the OCTOSPI periodically starts a command to read a defined number of status bytes (up to four). The received bytes can be masked to isolate some status bits and an interrupt can be generated when the selected bits have a defined value.

The access to the device begins in the same manner as in Indirect-read mode. BUSY in OCTOSPI_SR goes high at this point and stays high even between the periodic accesses.

The content of MASK[31:0] in OCTOSPI_PSMAR is used to mask the data from the external device in Automatic status-polling mode:

If PMM = 0 in OCTOSPI_CR, the AND-match mode is activated: SMF is set in OCTOSPI_SR only when there is a match on all of the unmasked bits.

If PMM = 1 in OCTOSPI_CR, the OR-match mode is activated: SMF gets set if there is a match on any of the unmasked bits.

An interrupt is called when SMF = 1 if SMIE = 1.

If APMS is set in OCTOSPI_CR, the operation stops and BUSY goes to 0 as soon as a match is detected. Otherwise, BUSY stays at 1 and the periodic accesses continue until there is an abort or until the OCTOSPI is disabled (EN = 0).

OCTOSPI_DR contains the latest received status bytes (FIFO deactivated). The content of this register is not affected by the masking used in the matching logic. FTF in OCTOSPI_SR is set as soon as a new reading of the status is complete. FTF is cleared as soon as the data is read.

In Automatic status-polling mode, variable latency is not supported. As a consequence, the memory must be configured in fixed latency.

25.4.10 OCTOSPI Memory-mapped mode

When configured in Memory-mapped mode, the external SPI device is seen as an internal memory.

Note: No more than 256 Mbytes can be addressed even if the external device capacity is larger.

If an access is made to an address outside of the range defined by DEVSIZE[4:0] but still within the 256 Mbytes range, then an AXI error is given. The effect of this error depends on the AXI master that attempted the access:

Byte, half-word, and word access types are all supported.

A support for execute in place (XIP) operation is implemented, where the OCTOSPI continues to load the bytes to the addresses following the most recent access. If subsequent accesses are continuous to the bytes that follow, then these operations ends up quickly since their results were pre-fetched.

By default, the OCTOSPI never stops its prefetch operation, it either keeps the previous read operation active with the NCS maintained low or it relaunches a new transfer, even if no access to the external device occurs for a long time.

Since external devices tend to consume more when the NCS is held low, the application may want to activate the timeout counter (TCEN = 1 in OCTOSPI_CR): the NCS is released after a period defined by TIMEOUT[15:0] in OCTOSPI_LPTR, when x cycles have elapsed without an access since the clock is inactive.

BUSY goes high as soon as the first memory-mapped access occurs. Because of the prefetch operations, BUSY does not fall until there is an abort, or the peripheral is disabled.

25.4.11 OCTOSPI configuration introduction

The OCTOSPI configuration is done in three steps:

  1. 1. OCTOSPI system configuration
  2. 2. OCTOSPI device configuration
  3. 3. OCTOSPI mode configuration

25.4.12 OCTOSPI system configuration

The OCTOSPI is configured using OCTOSPI_CR. The user must program:

In case of an interrupt usage, the respective enable bit can also be set during this phase.

If the timeout counter is used, the timeout value is programmed in OCTOSPI_LPTR.

The DMA channel must not be enabled during the OCTOSPI configuration: it must be enabled only when the operation is fully configured, to avoid any unexpected request generation.

The DMA and OCTOSPI must be configured in a coherent manner regarding data length: FTHRES value must reflect the DMA burst size.

25.4.13 OCTOSPI device configuration

The parameters related to the external device targeted are configured through OCTOSPI_DCR1 and OCTOSPI_DCR2. The user must program:

MTYP[2:0] defines the memory type to be used for 8-line modes:

DEVSIZE[4:0] defines the size of external memory using the following formula:

\[ \text{Number of bytes in the device} = 2^{[\text{DEVSIZE}+1]} \]

where DEVSIZE+1 is the number of address bits required to address the external device. The external device capacity can go up to 4 Gbytes (addressed using 32 bits) in Indirect mode, but the addressable space in Memory-mapped mode is limited to 256 Mbytes.

If DMM = 1, DEVSIZE[4:0] indicates the total capacity of the two devices together.

When the OCTOSPI executes two commands, one immediately after the other, it raises the chip-select signal (NCS) high between the two commands for only one CLK cycle by default.

If the external device requires more time between commands, the chip-select high time CSHT[5:0] can be used to specify the minimum number of CLK cycles for which the NCS must remain high.

CKMODE indicates the level that the CLK takes between commands (when NCS = 1).

In HyperBus protocol, the device timing ( \( t_{ACC} \) and \( t_{RWR} \) ) and the Latency mode must be configured in OCTOSPI_HLCR.

25.4.14 OCTOSPI Regular-command mode configuration

Indirect mode configuration

When FMODE[1:0] = 00, the Indirect-write mode is selected and data can be sent to the external device. When FMODE[1:0] = 01, the Indirect-read mode is selected and data can be read from the external device.

When the OCTOSPI is used in Indirect mode, the frames are constructed in the following way:

  1. 1. Specify a number of data bytes to read or write in OCTOSPI_DLR.
  2. 2. Specify the frame timing in OCTOSPI_TCR.
  3. 3. Specify the frame format in OCTOSPI_CCR.
  4. 4. Specify the instruction in OCTOSPI_IR.
  5. 5. Specify the optional alternate byte to be sent right after the address phase in OCTOSPI_ABR.
  6. 6. Specify the targeted address in OCTOSPI_AR.
  7. 7. Enable the DMA channel if needed.
  8. 8. Read/write the data from/to the FIFO through OCTOSPI_DR (if no DMA usage).

If neither the address register (OCTOSPI_AR) nor the data register (OCTOSPI_DR) need to be updated for a particular command, then the command sequence starts as soon as OCTOSPI_IR is written. This is the case when both ADMODE[2:0] and DMODE[2:0] equal 000, or if just ADMODE[2:0] = 000 when in Indirect-read mode (FMODE[1:0] = 01).

When an address is required (ADMODE[2:0] ≠ 000) and the data register does not need to be written (FMODE[1:0] = 01 or DMODE[2:0] = 000), the command sequence starts as soon as the address is updated with a write to OCTOSPI_AR.

In case of data transmission (FMODE[1:0] = 00 and DMODE[2:0] ≠ 000), the communication start is triggered by a write in the FIFO through OCTOSPI_DR.

Automatic status-polling mode configuration

The Automatic status-polling mode is enabled by setting FMODE[1:0] = 10. In this mode, the programmed frame is sent and the data is retrieved periodically.

The maximum amount of data read in each frame is 4 bytes. If more data is requested in OCTOSPI_DLR, it is ignored and only 4 bytes are read. The periodicity is specified in OCTOSPI_PIR.

Once the status data has been retrieved, the following can be processed:

The received value can be masked with the value stored in OCTOSPI_PSMKR, and can be ORed or ANDed with the value stored in OCTOSPI_PSMAR.

In case of a match, SMF is set and an interrupt is generated if enabled; The OCTOSPI can be automatically stopped if AMPS is set. In any case, the latest retrieved value is available in OCTOSPI_DR.

When the OCTOSPI is used in Automatic status-polling mode, the frames are constructed in the following way:

  1. 1. Specify the input mask in OCTOSPI_PSMKR.
  2. 2. Specify the comparison value in OCTOSPI_PSMAR.
  3. 3. Specify the read period in OCTOSPI_PIR.
  4. 4. Specify a number of data bytes to read in OCTOSPI_DLR.
  5. 5. Specify the frame timing in OCTOSPI_TCR.
  6. 6. Specify the frame format in OCTOSPI_CCR.
  7. 7. Specify the instruction in OCTOSPI_IR.
  8. 8. Specify the optional alternate byte to be sent right after the address phase in OCTOSPI_ABR.
  9. 9. Specify the optional targeted address in OCTOSPI_AR.

If the address register (OCTOSPI_AR) does not need to be updated for a particular command, then the command sequence starts as soon as OCTOSPI_CCR is written. This is the case when ADMODE[2:0] = 000.

When an address is required (ADMODE[2:0] ≠ 000), the command sequence starts as soon as the address is updated with a write to OCTOSPI_AR.

Memory-mapped mode configuration

In Memory-mapped mode, the external device is seen as an internal memory but with some latency during accesses. Read and write operations are allowed to the external device in this mode.

It is not recommended to program the Flash memory using memory-mapped writes, as the internal flags for erase or programming status have to be polled.

Memory-mapped mode is entered by setting FMODE[1:0] = 11 in OCTOSPI_CR.

The programmed instruction and frame are sent when an AXI master accesses the memory mapped space.

The FIFO is used as a prefetch buffer to anticipate any linear reads. Any access to OCTOSPI_DR in this mode returns zero.

The data length register (OCTOSPI_DLR) has no meaning in Memory-mapped mode.

When the OCTOSPI is used in Memory-mapped mode, the frames are constructed in the following way:

  1. 1. Specify the frame timing in OCTOSPI_TCR for read operation.
  2. 2. Specify the frame format in OCTOSPI_CCR for read operation.
  3. 3. Specify the instruction in OCTOSPI_IR.
  4. 4. Specify the optional alternate byte to be sent right after the address phase in OCTOSPI_ABR for read operation.
  5. 5. Specify the frame timing in OCTOSPI_WTCR for write operation.
  6. 6. Specify the frame format in OCTOSPI_WCCR for write operation.
  7. 7. Specify the instruction in OCTOSPI_WIR.
  8. 8. Specify the optional alternate byte to be sent right after the address phase in OCTOSPI_WABR for read operation.

All the configuration operations must be completed (ensured by checking BUSY = 0) before the first access to the memory area: any register write operation when BUSY = 1 have no effect and is not signaled with an error response. On the first access, the OCTOSPI becomes busy, and no further configuration is allowed.

OCTOSPI delayed data sampling when no DQS is used

By default, when no DQS is used, the OCTOSPI samples the data driven by the external device one half of a CLK cycle after the external device drives the signal.

In case of any external signal delays, it may be useful to sample the data later. Using SSHIFT in OCTOSPI_TCR, the sampling of the data can be shifted by half of a CLK cycle.

The firmware must clear SSHIFT when the data phase is configured in DTR mode (DDTR = 1).

OCTOSPI delayed data sampling when DQS is used

When external DQS is used as a sampling clock, it can be shifted in time to compensate the data propagation delay. This shift is performed by an external delay block located outside the OCTOSPI. The control of this feature depends on the device implementation (see the product reference manual for more details).

In configurations where delay does not need to be compensated, the external delay block can be bypassed by setting DLYBYP in OCTOSPI_DCR1.

Sending the instruction only once (SIOO)

A Flash memory can provide a mode where an instruction must be sent only with the first command sequence, while subsequent commands start directly with the address. The user can take advantage of this type of features using SIOO in OCTOSPI_CCR.

SIOO is valid for Memory-mapped mode only. If this bit is set, the instruction is sent only for the first command following a write to OCTOSPI_CCR.

Subsequent command sequences skip the instruction phase, until there is a write to OCTOSPI_CCR. SIOO has no effect when IMODE[1:0] = 00 (no instruction).

SIOO mode is not supported when any of the communication regulation, NCS boundary or refresh features are used.

25.4.15 OCTOSPI HyperBus protocol configuration

Indirect mode configuration

When FMODE[1:0] = 00, the Indirect-write mode is selected and data can be sent to the external device. When FMODE[1:0] = 01, the Indirect-read mode is selected where data can be read from the external device.

When the OCTOSPI is used in Indirect mode, the frames are constructed in the following way:

  1. 1. Specify a number of data bytes to read or write in OCTOSPI_DLR.
  2. 2. Specify the targeted address in OCTOSPI_AR.
  3. 3. Make a write operation in OCTOSPI_IR and enable the DMA channel if needed.
  4. 4. Read/write the data from/to the FIFO through OCTOSPI_DR (if no DMA usage).

In Indirect-read mode, the command sequence starts as soon as the address is updated with a write to OCTOSPI_AR.

In Indirect-write mode, the communication start is triggered by a write in the FIFO through OCTOSPI_DR.

Automatic status-polling mode configuration

The Automatic status-polling mode is enabled setting FMODE[1:0] = 10. In this mode, the programmed frame is sent and the data is retrieved periodically.

The maximum amount of data read in each frame is 4 bytes. If more data is requested in OCTOSPI_DLR, it is ignored and only 4 bytes are read. The periodicity is specified in OCTOSPI_PIR.

Once the status data has been retrieved, it can be internally processed to:

The received value can be masked with the value stored in OCTOSPI_PSMKR and can be ORed or ANDed with the value stored in OCTOSPI_PSMAR.

In case of a match, SMF is set and an interrupt is generated if enabled. The OCTOSPI can be automatically stopped if AMPS is set.

In any case, the latest retrieved value is available in OCTOSPI_DR.

When the OCTOSPI is used in Automatic status-polling mode, the frames are constructed in the following way:

  1. 1. Specify the input mask in OCTOSPI_PSMKR.
  2. 2. Specify the comparison value in OCTOSPI_PSMAR.
  3. 3. Specify the read period in OCTOSPI_PIR.
  4. 4. Specify a number of data bytes to read in OCTOSPI_DLR.
  5. 5. Specify the targeted address in OCTOSPI_AR.

The command sequence starts as soon as the address is updated with a write to OCTOSPI_AR.

Memory-mapped mode configuration

In Memory-mapped mode, the external device is seen as an internal memory but with some latency during the accesses. Read and write operations are allowed to the external device in this mode.

The Memory-mapped mode is entered by setting FMODE[1:0] = 11. The programmed instruction and frame is sent when an AXI master accesses the memory mapped space.

The FIFO is used as a prefetch buffer to anticipate any linear reads. Any access to OCTOSPI_DR in this mode returns zero.

The data length register (OCTOSPI_DLR) has no meaning in Memory-mapped mode.

All the configuration operation must be completed prior to the first access to the memory area. On the first access, the OCTOSPI becomes busy, and no configuration is allowed.

25.4.16 OCTOSPI error management

A error can be generated in the following cases:

The OCTOSPI generates an AXI slave error in the following situations:

25.4.17 OCTOSPI BUSY and ABORT

Once the OCTOSPI starts an operation with the external device, BUSY is automatically set in OCTOSPI_SR.

In Indirect mode, BUSY is reset once the OCTOSPI has completed the requested command sequence and the FIFO is empty.

In Automatic status-polling mode, BUSY goes low only after the last periodic access is complete, due to a match when APMS = 1 or due to an abort.

After the first access in Memory-mapped mode, BUSY goes low only on an abort.

Any operation can be aborted by setting ABORT in OCTOSPI_CR. Once the abort is completed, BUSY and ABORT are automatically reset, and the FIFO is flushed.

Before setting ABORT, the software must ensure that all the current transactions are finished using the synchronization barriers.

Note: Some devices may misbehave if a write operation to a status register is aborted.

25.4.18 OCTOSPI reconfiguration or deactivation

Prior to any OCTOSPI reconfiguration, the software must ensure that all the transactions are completed:

25.4.19 NCS behavior

By default, NCS is high, deselecting the external device. NCS falls before an operation begins and rises as soon as it finishes.

When CKMODE = 0 (clock mode 0: CLK stays low when no operation is in progress), NCS falls one CLK cycle before an operation first rising CLK edge, and NCS rises one CLK cycle after the operation final rising CLK edge (see the figure below).

Figure 154. NCS when CKMODE = 0 (T = CLK period)

Timing diagram for NCS behavior in CKMODE = 0. The diagram shows two signals: NCS (top) and SCLK (bottom). NCS is initially high. SCLK is initially low and then becomes a periodic square wave. The first rising edge of SCLK marks the start of an operation. NCS falls one CLK cycle before this first rising edge. The operation continues for several CLK cycles. The final rising edge of SCLK marks the end of the operation. NCS rises one CLK cycle after this final rising edge. The period of the SCLK signal is labeled T. The diagram is labeled MSV44100V1 in the bottom right corner.
Timing diagram for NCS behavior in CKMODE = 0. The diagram shows two signals: NCS (top) and SCLK (bottom). NCS is initially high. SCLK is initially low and then becomes a periodic square wave. The first rising edge of SCLK marks the start of an operation. NCS falls one CLK cycle before this first rising edge. The operation continues for several CLK cycles. The final rising edge of SCLK marks the end of the operation. NCS rises one CLK cycle after this final rising edge. The period of the SCLK signal is labeled T. The diagram is labeled MSV44100V1 in the bottom right corner.

When CKMODE = 1 (clock mode 3: CLK goes high when no operation is in progress) and when in SDR mode, NCS falls one CLK cycle before an operation first rising CLK edge, and NCS rises one CLK cycle after the operation final rising CLK edge (see the figure below).

Figure 155. NCS when CKMODE = 1 in SDR mode (T = CLK period)

Timing diagram for NCS behavior in CKMODE = 1 in SDR mode. The diagram shows two signals: NCS (top) and SCLK (bottom). NCS is initially high. SCLK is initially high and then becomes a periodic square wave. The first rising edge of SCLK marks the start of an operation. NCS falls one CLK cycle before this first rising edge. The operation continues for several CLK cycles. The final rising edge of SCLK marks the end of the operation. NCS rises one CLK cycle after this final rising edge. The period of the SCLK signal is labeled T. The diagram is labeled MSV44101V1 in the bottom right corner.
Timing diagram for NCS behavior in CKMODE = 1 in SDR mode. The diagram shows two signals: NCS (top) and SCLK (bottom). NCS is initially high. SCLK is initially high and then becomes a periodic square wave. The first rising edge of SCLK marks the start of an operation. NCS falls one CLK cycle before this first rising edge. The operation continues for several CLK cycles. The final rising edge of SCLK marks the end of the operation. NCS rises one CLK cycle after this final rising edge. The period of the SCLK signal is labeled T. The diagram is labeled MSV44101V1 in the bottom right corner.

When the CKMODE = 1 (clock mode 3) and DDTR = 1 (data DTR mode), NCS falls one CLK cycle before an operation first rising CLK edge, and NCS rises one CLK cycle after the operation final active rising CLK edge (see the figure below). Because the DTR operations

must finish with a falling edge, CLK is low when NCS rises, and CLK rises back up one half of a CLK cycle afterwards.

Figure 156. NCS when CKMODE = 1 in DTR mode (T = CLK period)

Timing diagram for Figure 156 showing NCS and SCLK signals. NCS is high initially, then goes low. SCLK is a square wave. The first falling edge of SCLK after NCS goes low is marked. The period between this falling edge and the next rising edge of SCLK is labeled T. After the last falling edge of SCLK, NCS goes high. The time from this last falling edge to the rising edge of NCS is labeled T. The time from the rising edge of NCS to the next rising edge of SCLK is labeled T/2. The diagram is labeled MSv44102V1.
Timing diagram for Figure 156 showing NCS and SCLK signals. NCS is high initially, then goes low. SCLK is a square wave. The first falling edge of SCLK after NCS goes low is marked. The period between this falling edge and the next rising edge of SCLK is labeled T. After the last falling edge of SCLK, NCS goes high. The time from this last falling edge to the rising edge of NCS is labeled T. The time from the rising edge of NCS to the next rising edge of SCLK is labeled T/2. The diagram is labeled MSv44102V1.

When the FIFO stays full during a read operation, or if the FIFO stays empty during a write operation, the operation stalls and CLK stays low until the software services the FIFO. If an abort occurs when an operation is stalled, NCS rises just after the abort is requested and then CLK rises one half of a CLK cycle later (see the figure below).

Figure 157. NCS when CKMODE = 1 with an abort (T = CLK period)

Timing diagram for Figure 157 showing NCS, SCLK, and Abort signals. NCS is high initially, then goes low. SCLK is a square wave. The first falling edge of SCLK after NCS goes low is marked. The period between this falling edge and the next rising edge of SCLK is labeled T. After the last falling edge of SCLK, the operation stalls, and SCLK stays low. This period is labeled 'Clock stalled'. When the Abort signal goes high, NCS goes high. The time from the rising edge of the Abort signal to the rising edge of NCS is labeled T. The time from the rising edge of NCS to the next rising edge of SCLK (which occurs after the stall) is labeled T/2. The diagram is labeled MSv44103V1.
Timing diagram for Figure 157 showing NCS, SCLK, and Abort signals. NCS is high initially, then goes low. SCLK is a square wave. The first falling edge of SCLK after NCS goes low is marked. The period between this falling edge and the next rising edge of SCLK is labeled T. After the last falling edge of SCLK, the operation stalls, and SCLK stays low. This period is labeled 'Clock stalled'. When the Abort signal goes high, NCS goes high. The time from the rising edge of the Abort signal to the rising edge of NCS is labeled T. The time from the rising edge of NCS to the next rising edge of SCLK (which occurs after the stall) is labeled T/2. The diagram is labeled MSv44103V1.

25.5 Address alignment and data number

The following table summarizes the effect of the address alignment and programmed data number depending on the use case.

Table 211. Address alignment cases

Memory typeTransaction typeConstraint on address (1)Impact if constraint on address not respectedConstraint on number of bytes (1)Impact if constraint on bytes not respected
Single, dual, quad Flash or SRAM (DMM = 0)IND (2) readNoneNoneNoneNone
MM (3) read
IND write
MM write

Table 211. Address alignment cases (continued)

Memory typeTransaction typeConstraint on address (1)Impact if constraint on address not respectedConstraint on number of bytes (1)Impact if constraint on bytes not respected
Single, dual, quad Flash or SRAM (DMM = 1)IND readEvenADDR[0] is set to 0.EvenDLR[0] is set to 1.
MM readNoneNoneNoneNone
IND writeEvenADDR[0] is set to 0.EvenDLR[0] is set to 1.
MM writeEvenSlave errorEvenLast byte is lost.
Octal Flash in SDR modeIND readNoneNoneNoneNone
MM read
IND write
MM write
Octal Flash or RAM in DTR mode without RDS nor WDM (4)IND readEvenADDR[0] is set to 0.EvenDLR[0] is set to 1.
MM readNoneNoneNoneNone
IND writeEvenADDR[0] is set to 0.EvenDLR[0] is set to 1.
MM writeEvenSlave errorEvenLast byte is lost.
Octal Flash or RAM in DTR mode with RDS or WDMIND readEvenADDR[0] is set to 0.EvenDLR[0] is set to 1.
MM readNoneNoneNoneNone
IND write
MM writeNoneNoneNoneNone
HyperBusIND readEvenADDR[0] is set to 0.EvenDLR[0] is set to 1.
MM readNoneNoneNoneNone
IND write
MM write

1. To be respected by the software.

2. IND = Indirect mode.

3. MM = Memory-mapped mode

4. RDS = read data strobe, WDM = write data mask.

25.6 OCTOSPI interrupts

An interrupt can be produced on the following events:

Separate interrupt enable bits are available to provide more flexibility.

Table 212. OCTOSPI interrupt requests

Interrupt eventEvent flagEnable control bit
TimeoutTOFTOIE
Status matchSMFSMIE
FIFO thresholdFTFFTIE
Transfer completeTCFTCIE
Transfer errorTEFTEIE

25.7 OCTOSPI registers

25.7.1 OCTOSPI control register (OCTOSPI_CR)

Address offset: 0x0000

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.FMODE[1:0]Res.Res.Res.Res.PMMAPMSRes.TOIESMIEFTIETCIETEIE
rwrwrwrwrwrwrwrwrw

1514131211109876543210
Res.Res.Res.FTHRES[4:0]FSELDMMRes.Res.TCENDMAENABORTEN
rwrwrwrwrwrwrwrwrwrwrw

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

Bits 29:28 FMODE[1:0] : Functional mode

This field defines the OCTOSPI functional mode of operation.

00: Indirect-write mode

01: Indirect-read mode

10: Automatic status-polling mode

11: Memory-mapped mode

If DMAEN = 1 already, then the DMA controller for the corresponding channel must be disabled before changing the FMODE[1:0] value. If FMODE[1:0] and FTHRES[4:0] are wrongly updated while DMAEN = 1, the DMA request signal automatically goes to inactive state.

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

Bit 23 PMM : Polling match mode

This bit indicates which method must be used to determine a match during the Automatic status-polling mode.

0: AND-match mode, SMF is set if all the unmasked bits received from the device match the corresponding bits in the match register.

1: OR-match mode, SMF is set if any of the unmasked bits received from the device matches its corresponding bit in the match register.

Bit 22 APMS : Automatic status-polling mode stop

This bit determines if the Automatic status-polling mode is stopped after a match.

0: Automatic status-polling mode is stopped only by abort or by disabling the OCTOSPI.

1: Automatic status-polling mode stops as soon as there is a match.

Bit 21 Reserved, must be kept at reset value.

Bit 20 TOIE : Timeout interrupt enable

This bit enables the timeout interrupt.

0: Interrupt disabled

1: Interrupt enabled

Bit 19 SMIE : Status match interrupt enable

This bit enables the status match interrupt.

0: Interrupt disabled

1: Interrupt enabled

Bit 18 FTIE : FIFO threshold interrupt enable

This bit enables the FIFO threshold interrupt.

0: Interrupt disabled

1: Interrupt enabled

Bit 17 TCIE : Transfer complete interrupt enable

This bit enables the transfer complete interrupt.

0: Interrupt disabled

1: Interrupt enabled

Bit 16 TEIE : Transfer error interrupt enable

This bit enables the transfer error interrupt.

0: Interrupt disabled

1: Interrupt enabled

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

Bits 12:8 FTHRES[4:0] : FIFO threshold level

This field defines, in Indirect mode, the threshold number of bytes in the FIFO that causes the FIFO threshold flag FTF in OCTOSPI_SR, to be set.

00000: FTF is set if there are one or more free bytes available to be written to in the FIFO in Indirect-write mode, or if there are one or more valid bytes can be read from the FIFO in Indirect-read mode.

00001: FTF is set if there are two or more free bytes available to be written to in the FIFO in Indirect-write mode, or if there are two or more valid bytes can be read from the FIFO in Indirect-read mode.

...

11111: FTF is set if there are 32 free bytes available to be written to in the FIFO in Indirect-write mode, or if there are 32 valid bytes can be read from the FIFO in Indirect-read mode.

Note: If DMAEN = 1, the DMA controller for the corresponding channel must be disabled before changing the FTHRES[4:0] value.

Bit 7 FSEL : Flash select

This bit selects the Flash memory to be addressed in single-, dual-, quad-SPI mode in single-memory configuration (when DMM = 0).

0: FLASH 1 selected (data exchanged over IO[3:0])

1: FLASH 2 selected (data exchanged over IO[7:4])

This bit is ignored when DMM = 1 or when octal-SPI mode is selected.

Bit 6 DMM : Dual-memory configuration

This bit activates the dual-memory configuration, where two external devices are used simultaneously to double the throughput and the capacity

0: Dual-quad configuration disabled

1: Dual-quad configuration enabled

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

Bit 3 TCEN : Timeout counter enable

This bit is valid only when the Memory-mapped mode (FMODE[1:0] = 11) is selected. This bit enables the timeout counter.

0: Timeout counter is disabled, and thus the chip-select (NCS) remains active indefinitely after an access in Memory-mapped mode.

1: Timeout counter is enabled, and thus the chip-select is released in the Memory-mapped mode after TIMEOUT[15:0] cycles of external device inactivity.

Bit 2 DMAEN : DMA enable

In Indirect mode, the DMA can be used to input or output data via OCTOSPI_DR. DMA transfers are initiated when FTF is set.

0: DMA disabled for Indirect mode

1: DMA enabled for Indirect mode

Note: Resetting the DMAEN bit while a DMA transfer is ongoing, breaks the handshake with the DMA. Do not write this bit during DMA operation.

Bit 1 ABORT : Abort request

This bit aborts the ongoing command sequence. It is automatically reset once the abort is completed. This bit stops the current transfer.

0: No abort requested

1: Abort requested

Note: This bit is always read as 0.

Bit 0 EN : Enable

This bit enables the OCTOSPI.

0: OCTOSPI disabled

1: OCTOSPI enabled

Note: The DMA request can be aborted without having received the ACK in case this EN bit is cleared during the operation.

In case this bit is set to 0 during a DMA transfer, the REQ signal to DMA returns to inactive state without waiting for the ACK signal from DMA to be active.

25.7.2 OCTOSPI device configuration register 1 (OCTOSPI_DCR1)

Address offset: 0x0008

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.Res.Res.Res.MTYP[2:0]Res.Res.Res.DEVSIZE[4:0]
rwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.CSHT[5:0]Res.Res.Res.Res.DLY BYPRes.FRCKCKMO DE
rwrwrwrwrwrwrwrwrw

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

Bits 26:24 MTYP[2:0] : Memory type

This bit indicates the type of memory to be supported.

000: Micron mode, D0/D1 ordering in DTR 8-data-bit mode. Regular-command protocol in single-, dual-, quad- and octal-SPI modes.

Note: In this mode, DQS signal polarity is inverted with respect to the memory clock signal. This is the default value and care must be taken to change MTYP[2:0] for memories different from Micron.

001: Macronix mode, D1/D0 ordering in DTR 8-data-bit mode. Regular-command protocol in single-, dual-, quad- and octal-SPI modes.

010: Standard mode

011: Macronix RAM mode, D1/D0 ordering in DTR 8-data-bit mode. Regular-command protocol in single-, dual-, quad- and octal-SPI modes with dedicated address mapping.

100: HyperBus memory mode, the protocol follows the HyperBus specification. 8-data-bit DTR mode must be selected.

101: HyperBus register mode, addressing register space. The memory-mapped accesses in this mode must be non-cacheable, or Indirect read/write modes must be used.

Others: Reserved

Bits 23:21 Reserved, must be kept at reset value.

Bits 20:16 DEVSIZE[4:0] : Device size

This field defines the size of the external device using the following formula:

Number of bytes in device = \( 2^{[\text{DEVSIZE}+1]} \) .

DEVSIZE+1 is effectively the number of address bits required to address the external device.

The device capacity can be up to 4 Gbytes (addressed using 32-bits) in Indirect mode, but the addressable space in Memory-mapped mode is limited to 256 Mbytes.

In Regular-command protocol, if DMM = 1, DEVSIZE[4:0] indicates the capacity of one of the two external devices.

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

Bits 13:8 CSHT[5:0] : Chip-select high time

CSHT + 1 defines the minimum number of CLK cycles where the chip-select (NCS) must remain high between commands issued to the external device.

0x0: NCS stays high for at least 1 cycle between external device commands.

0x1: NCS stays high for at least 2 cycles between external device commands.

...

0x3F: NCS stays high for at least 64 cycles between external device commands.

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

Bit 3 DLYBYP : Delay block bypass

0: The internal sampling clock (called feedback clock) or the DQS data strobe external signal is delayed by the delay block (for more details on this block, refer to the dedicated section of the reference manual as it is not part of the OCTOSPI peripheral).

1: The delay block is bypassed, so the internal sampling clock or the DQS data strobe external signal is not affected by the delay block. The delay is shorter than when the delay block is not bypassed, even with the delay value set to minimum value in delay block.

Bit 2 Reserved, must be kept at reset value.

Bit 1 FRCK : Free running clock

This bit configures the free running clock.

0: CLK is not free running.

1: CLK is free running (always provided).

Note: Free running clock mode is intended for delay calibration only. No memory or other device access is possible when FRCK is set.

Bit 0 CKMODE : Clock mode 0/mode 3

This bit indicates the level taken by the CLK between commands (when NCS = 1).

0: CLK must stay low while NCS is high (chip-select released). This is referred to as clock mode 0.

1: CLK must stay high while NCS is high (chip-select released). This is referred to as clock mode 3.

25.7.3 OCTOSPI device configuration register 2 (OCTOSPI_DCR2)

Address offset: 0x000C

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.WRAPSIZE[2:0]
rwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.PRESCALER[7:0]
rwrwrwrwrwrwrwrw

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

Bits 18:16 WRAPSIZE[2:0] : Wrap size

This field indicates the wrap size to which the memory is configured. For memories which have a separate command for wrapped instructions, this field indicates the wrap-size associated with the command held in the OCTOSPI1_WPIR register.

000: Wrapped reads are not supported by the memory.

001: Reserved

010: External memory supports wrap size of 16 bytes.

011: External memory supports wrap size of 32 bytes.

100: External memory supports wrap size of 64 bytes.

101: External memory supports wrap size of 128 bytes.

110-111: Reserved

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

Bits 7:0 PRESCALER[7:0] : Clock prescaler

This field defines the scalar factor for generating the CLK based on the kernel clock (value + 1).

0: \( F_{CLK} = F_{KERNEL} \) , kernel clock used directly as OCTOSPI CLK (prescaler bypassed). In this case, if the DTR mode is used, it is mandatory to provide to the OCTOSPI a kernel clock that has 50% duty-cycle.

1: \( F_{CLK} = F_{KERNEL}/2 \)

2: \( F_{CLK} = F_{KERNEL}/3 \)

...

255: \( F_{CLK} = F_{KERNEL}/256 \)

For odd clock division factors, the CLK duty cycle is not 50 %. The clock signal remains low one cycle longer than it stays high.

25.7.4 OCTOSPI device configuration register 3 (OCTOSPI_DCR3)

Address offset: 0x0010

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CSBOUND[4:0]
rwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.MAXTRAN[7:0]
rwrwrwrwrwrwrwrw

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

Bits 20:16 CSBOUND[4:0] : NCS boundary

This field enables the transaction boundary feature. When active, a minimum value of 3 is recommended.

The NCS is released on each boundary of \( 2^{CSBOUND} \) bytes.

0: NCS boundary disabled

others: NCS boundary set to \( 2^{CSBOUND} \) bytes

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

Bits 7:0 MAXTRAN[7:0] : Maximum transfer

This field enables the communication regulation feature.

The NCS is released every \( MAXTRAN+1 \) clock cycles when the other OCTOSPI request the access to the bus.

0: Maximum communication disabled

others: Maximum communication is set to \( MAXTRAN + 1 \) bytes.

25.7.5 OCTOSPI device configuration register 4 (OCTOSPI_DCR4)

Address offset: 0x0014

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
REFRESH[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
REFRESH[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 REFRESH[31:0] : Refresh rate

This field enables the refresh rate feature.

The NCS is released every REFRESH + 1 clock cycles for writes, and REFRESH + 4 clock cycles for reads.

Note: These two values can be extended with few clock cycles when refresh occurs during a byte transmission in single-, dual- or quad-SPI mode, because the byte transmission must be completed.

0: Refresh disabled

others: Maximum communication length is set to REFRESH + 1 clock cycles.

Note: REFRESH count is based on the divided clock period: if OCTOSPI_DCR2 PRESCALER field is changed, the REFRESH field must be updated accordingly.

25.7.6 OCTOSPI status register (OCTOSPI_SR)

Address offset: 0x0020

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.FLEVEL[5:0]Res.Res.BUSYTOFSMFFTFTCFTEF
rrrrrrrrrrrr

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

Bits 13:8 FLEVEL[5:0] : FIFO level

This field gives the number of valid bytes that are being held in the FIFO. FLEVEL = 0 when the FIFO is empty, and 32 when it is full.

In Automatic status-polling mode, FLEVEL is zero.

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

Bit 5 BUSY : Busy

This bit is set when an operation is ongoing. It is cleared automatically when the operation with the external device is finished and the FIFO is empty.

Bit 4 TOF : Timeout flag

This bit is set when timeout occurs. It is cleared by writing 1 to CTOF.

Bit 3 SMF : Status match flag

This bit is set in Automatic status-polling mode when the unmasked received data matches the corresponding bits in the match register (OCTOSPI_PSMAR). It is cleared by writing 1 to CSMF.

Bit 2 FTF : FIFO threshold flag

In Indirect mode, this bit is set when the FIFO threshold has been reached, or if there is any data left in the FIFO after the reads from the external device are complete. It is cleared automatically as soon as the threshold condition is no longer true. In Automatic status-polling mode, this bit is set every time the status register is read, and the bit is cleared when the data register is read.

Bit 1 TCF : Transfer complete flag

This bit is set in Indirect mode when the programmed number of data has been transferred or in any mode when the transfer has been aborted. It is cleared by writing 1 to CTCF.

Bit 0 TEF : Transfer error flag

This bit is set in Indirect mode when an invalid address is being accessed in Indirect mode. It is cleared by writing 1 to CTEF.

25.7.7 OCTOSPI flag clear register (OCTOSPI_FCR)

Address offset: 0x0024

Reset value: 0x0000 0000

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.CTOFCSMFRes.CTCFCTEF
wwww

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

Bit 4 CTOF : Clear timeout flag

Writing 1 clears the TOF flag in the OCTOSPI_SR register.

Bit 3 CSMF : Clear status match flag

Writing 1 clears the SMF flag in the OCTOSPI_SR register.

Bit 2 Reserved, must be kept at reset value.

Bit 1 CTCF : Clear transfer complete flag

Writing 1 clears the TCF flag in the OCTOSPI_SR register.

Bit 0 CTEF : Clear transfer error flag

Writing 1 clears the TEF flag in the OCTOSPI_SR register.

25.7.8 OCTOSPI data length register (OCTOSPI_DLR)

Address offset: 0x0040

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
DL[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
DL[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 DL[31: 0] : Data length

Number of data to be retrieved (value+1) in Indirect and Automatic status-polling modes. A value not greater than three (indicating 4 bytes) must be used for Automatic status-polling mode.

All 1's in Indirect mode means undefined length, where OCTOSPI continues until the end of the memory, as defined by DEVSIZE.

0x0000_0000: 1 byte is to be transferred.

0x0000_0001: 2 bytes are to be transferred.

0x0000_0002: 3 bytes are to be transferred.

0x0000_0003: 4 bytes are to be transferred.

...

0xFFFF_FFFD: 4,294,967,294 (4G-2) bytes are to be transferred.

0xFFFF_FFFE: 4,294,967,295 (4G-1) bytes are to be transferred.

0xFFFF_FFFF: undefined length; all bytes, until the end of the external device, (as defined by DEVSIZE) are to be transferred. Continue reading indefinitely if DEVSIZE = 0x1F.

DL[0] is stuck at 1 in dual-memory configuration (DMM = 1) even when 0 is written to this bit, thus assuring that each access transfers an even number of bytes.

This field has no effect in Memory-mapped mode.

25.7.9 OCTOSPI address register (OCTOSPI_AR)

Address offset: 0x0048

Reset value: 0x0000 0000

31302928272625242322212019181716
ADDRESS[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ADDRESS[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 ADDRESS[31:0] : Address

Address to be sent to the external device. In HyperBus protocol, this field must be even as this protocol is 16-bit word oriented. In dual-memory configuration, AR[0] is forced to 1. Writes to this field are ignored when BUSY = 1 or when FMODE = 11 (Memory-mapped mode).

25.7.10 OCTOSPI data register (OCTOSPI_DR)

Address offset: 0x0050

Reset value: 0x0000 0000

31302928272625242322212019181716
DATA[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
DATA[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 DATA[31: 0] : Data

Data to be sent/received to/from the external SPI device

In Indirect-write mode, data written to this register is stored on the FIFO before it is sent to the external device during the data phase. If the FIFO is too full, a write operation is stalled until the FIFO has enough space to accept the amount of data being written.

In Indirect-read mode, reading this register gives (via the FIFO) the data that was received from the external device. If the FIFO does not have as many bytes as requested by the read operation and if BUSY = 1, the read operation is stalled until enough data is present or until the transfer is complete, whichever happens first.

In Automatic status-polling mode, this register contains the last data read from the external device (without masking).

Word, half-word, and byte accesses to this register are supported. In Indirect-write mode, a byte write adds 1 byte to the FIFO, a half-word write 2 bytes, and a word write 4 bytes.

Similarly, in Indirect-read mode, a byte read removes 1 byte from the FIFO, a half-word read 2 bytes, and a word read 4 bytes. Accesses in Indirect mode must be aligned to the bottom of this register: A byte read must read DATA[7:0] and a half-word read must read DATA[15:0].

25.7.11 OCTOSPI polling status mask register (OCTOSPI_PSMKR)

Address offset: 0x0080

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
MASK[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
MASK[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 MASK[31:0] : Status mask

Mask to be applied to the status bytes received in Automatic status-polling mode

For bit n:

0: Bit n of the data received in Automatic status-polling mode is masked and its value is not considered in the matching logic.

1: Bit n of the data received in Automatic status-polling mode is unmasked and its value is considered in the matching logic.

25.7.12 OCTOSPI polling status match register (OCTOSPI_PSMAR)

Address offset: 0x0088

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
MATCH[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
MATCH[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 MATCH[31: 0] : Status match

Value to be compared with the masked status register to get a match

25.7.13 OCTOSPI polling interval register (OCTOSPI_PIR)

Address offset: 0x0090

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
INTERVAL[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 15:0 INTERVAL[15: 0] : Polling interval

Number of CLK cycle between a read during the Automatic status-polling phases

25.7.14 OCTOSPI communication configuration register (OCTOSPI_CCR)

Address offset: 0x0100

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
SIOORes.DQSERes.DDTRDMODE[2:0]Res.Res.ABSIZE[1:0]ABDTRABMODE[2:0]
rwrwrwrwrwrwrwrwrwrwrwrw

1514131211109876543210
Res.Res.ADSIZE[1:0]AD
DTR
ADMODE[2:0]Res.Res.ISIZE[1:0]IDTRIMODE[2:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 SIOO : Send instruction only once mode

This bit has no effect when IMODE = 00 (see Sending the instruction only once (SIOO) ).

0: Send instruction on every transaction

1: Send instruction only for the first command

Bit 30 Reserved, must be kept at reset value.

Bit 29 DQSE : DQS enable

This bit enables the data strobe management.

0: DQS disabled

1: DQS enabled

Bit 28 Reserved, must be kept at reset value.

Bit 27 DDTR : Data double transfer rate

This bit sets the DTR mode for the data phase.

0: DTR mode disabled for data phase

1: DTR mode enabled for data phase

Bits 26:24 DMODE[2:0] : Data mode

This field defines the data phase mode of operation.

000: No data

001: Data on a single line

010: Data on two lines

011: Data on four lines

100: Data on eight lines

101-111: Reserved

Bits 23:22 Reserved, must be kept at reset value.

Bits 21:20 ABSIZE[1:0] : Alternate bytes size

This bit defines alternate bytes size.

00: 8-bit alternate bytes

01: 16-bit alternate bytes

10: 24-bit alternate bytes

11: 32-bit alternate bytes

Bit 19 ABDTR : Alternate bytes double transfer rate

This bit sets the DTR mode for the alternate bytes phase.

0: DTR mode disabled for alternate bytes phase

1: DTR mode enabled for alternate bytes phase

This field can be written only when BUSY = 0.

Bits 18:16 ABMODE[2:0] : Alternate-byte mode

This field defines the alternate-byte phase mode of operation.

000: No alternate bytes

001: Alternate bytes on a single line

010: Alternate bytes on two lines

011: Alternate bytes on four lines

100: Alternate bytes on eight lines

101-111: Reserved

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

Bits 13:12 ADSIZE[1:0] : Address size

This field defines address size.

00: 8-bit address

01: 16-bit address

10: 24-bit address

11: 32-bit address

Bit 11 ADDTR : Address double transfer rate

This bit sets the DTR mode for the address phase.

0: DTR mode disabled for address phase

1: DTR mode enabled for address phase

Bits 10:8 ADMODE[2:0] : Address mode

This field defines the address phase mode of operation.

000: No address

001: Address on a single line

010: Address on two lines

011: Address on four lines

100: Address on eight lines

101-111: Reserved

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

Bits 5:4 ISIZE[1:0] : Instruction size

This bit defines instruction size.

00: 8-bit instruction

01: 16-bit instruction

10: 24-bit instruction

11: 32-bit instruction

Bit 3 IDTR : Instruction double transfer rate

This bit sets the DTR mode for the instruction phase.

0: DTR mode disabled for instruction phase

1: DTR mode enabled for instruction phase

Bits 2:0 IMODE[2:0] : Instruction mode

This field defines the instruction phase mode of operation.

000: No instruction

001: Instruction on a single line

010: Instruction on two lines

011: Instruction on four lines

100: Instruction on eight lines

101-111: Reserved

25.7.15 OCTOSPI timing configuration register (OCTOSPI_TCR)

Address offset: 0x0108

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.S
SHIFT
Res.DHQCRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DCYC[4:0]
rwrwrwrwrw

Bit 31 Reserved, must be kept at reset value.

Bit 30 SSHIFT : Sample shift

By default, the OCTOSPI samples data 1/2 of a CLK cycle after the data is driven by the external device.

This bit allows the data to be sampled later in order to consider the external signal delays.

0: No shift

1: 1/2 cycle shift

The software must ensure that SSHIFT = 0 when the data phase is configured in DTR mode (when DDTR = 1.)

Bit 29 Reserved, must be kept at reset value.

Bit 28 DHQC : Delay hold quarter cycle

0: No delay hold

1: 1/4 cycle hold

Bits 27:5 Reserved, must be kept at reset value.

Bits 4:0 DCYC[4:0] : Number of dummy cycles

This field defines the duration of the dummy phase.

In both SDR and DTR modes, it specifies a number of CLK cycles (0-31).

It is recommended to have at least six dummy cycles when using memories with DQS activated.

25.7.16 OCTOSPI instruction register (OCTOSPI_IR)

Address offset: 0x0110

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
INSTRUCTION[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
INSTRUCTION[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 INSTRUCTION[31:0] : Instruction

Instruction to be sent to the external SPI device

25.7.17 OCTOSPI alternate bytes register (OCTOSPI_ABR)

Address offset: 0x0120

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
ALTERNATE[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ALTERNATE[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 ALTERNATE[31: 0] : Alternate bytes

Optional data to be sent to the external SPI device right after the address.

25.7.18 OCTOSPI low-power timeout register (OCTOSPI_LPTR)

Address offset: 0x00130

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
TIMEOUT[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 15:0 TIMEOUT[15: 0] : Timeout period

After each access in Memory-mapped mode, the OCTOSPI prefetches the subsequent bytes and hold them in the FIFO.

This field indicates how many CLK cycles the OCTOSPI waits after the clock becomes inactive and until it raises the NCS, putting the external device in a lower-consumption state.

25.7.19 OCTOSPI wrap communication configuration register (OCTOSPI_WPCCR)

Address offset: 0x0140

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.DQSERes.DDTRDMODE[2:0]Res.Res.ABSIZE[1:0]ABDTRABMODE[2:0]
rwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.ADSIZE[1:0]AD DTRADMODE[2:0]Res.Res.ISIZE[1:0]IDTRIMODE[2:0]
rwrwrwrwrwrwrwrwrwrwrwrw

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

Bit 29 DQSE : DQS enable

This bit enables the data strobe management.

0: DQS disabled

1: DQS enabled

Bit 28 Reserved, must be kept at reset value.

Bit 27 DDTR : Data double transfer rate

This bit sets the DTR mode for the data phase.

0: DTR mode disabled for data phase

1: DTR mode enabled for data phase

Bits 26:24 DMODE[2:0] : Data mode

This field defines the data phase mode of operation.

000: No data

001: Data on a single line

010: Data on two lines

011: Data on four lines

100: Data on eight lines

101-111: Reserved

Bits 23:22 Reserved, must be kept at reset value.

Bits 21:20 ABSIZE[1:0] : Alternate bytes size

This bit defines alternate bytes size.

00: 8-bit alternate bytes

01: 16-bit alternate bytes

10: 24-bit alternate bytes

11: 32-bit alternate bytes

Bit 19 ABDTR : Alternate bytes double transfer rate

This bit sets the DTR mode for the alternate bytes phase.

0: DTR mode disabled for alternate bytes phase

1: DTR mode enabled for alternate bytes phase

Bits 18:16 ABMODE[2:0] : Alternate-byte mode

This field defines the alternate byte phase mode of operation.

000: No alternate bytes

001: Alternate bytes on a single line

010: Alternate bytes on two lines

011: Alternate bytes on four lines

100: Alternate bytes on eight lines

101-111: Reserved

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

Bits 13:12 ADSIZE[1:0] : Address size

This field defines address size.

00: 8-bit address

01: 16-bit address

10: 24-bit address

11: 32-bit address

Bit 11 ADDTR : Address double transfer rate

This bit sets the DTR mode for the address phase.

0: DTR mode disabled for address phase

1: DTR mode enabled for address phase

Bits 10:8 ADMODE[2:0] : Address mode

This field defines the address phase mode of operation.

000: No address

001: Address on a single line

010: Address on two lines

011: Address on four lines

100: Address on eight lines

101-111: Reserved

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

Bits 5:4 ISIZE[1:0] : Instruction size

This field defines instruction size.

Bit 3 IDTR : Instruction double transfer rate

This bit sets the DTR mode for the instruction phase.

Bits 2:0 IMODE[2:0] : Instruction mode

This field defines the instruction phase mode of operation.

25.7.20 OCTOSPI wrap timing configuration register (OCTOSPI_WPTCR)

Address offset: 0x0148

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.S
SHIFT
Res.DHQCRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DCYC[4:0]
rwrwrwrwrw

Bit 31 Reserved, must be kept at reset value.

Bit 30 SSHIFT : Sample shift

By default, the OCTOSPI samples data 1/2 of a CLK cycle after the data is driven by the external device.

This bit allows the data to be sampled later in order to consider the external signal delays.

The firmware must assure that SSHIFT=0 when the data phase is configured in DTR mode (when DDTR = 1).

Bit 29 Reserved, must be kept at reset value.

Bit 28 DHQC : Delay hold quarter cycle

Add a quarter cycle delay on the outputs in DTR communication to match hold requirement.

0: No quarter cycle delay

1: Quarter cycle delay inserted

Bits 27:5 Reserved, must be kept at reset value.

Bits 4:0 DCYC[4:0] : Number of dummy cycles

This field defines the duration of the dummy phase.

In both SDR and DTR modes, it specifies a number of CLK cycles (0-31). It is recommended to have at least 5 dummy cycles when using memories with DQS activated.

25.7.21 OCTOSPI wrap instruction register (OCTOSPI_WPIR)

Address offset: 0x0150

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
INSTRUCTION[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
INSTRUCTION[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 INSTRUCTION[31: 0] : Instruction

Instruction to be sent to the external SPI device

25.7.22 OCTOSPI wrap alternate bytes register (OCTOSPI_WPABR)

Address offset: 0x0160

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
ALTERNATE[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ALTERNATE[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 ALTERNATE[31: 0] : Alternate bytes

Optional data to be sent to the external SPI device right after the address

25.7.23 OCTOSPI write communication configuration register (OCTOSPI_WCCR)

Address offset: 0x0180

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.DQSERes.DDTRDMODE[2:0]Res.Res.ABSIZE[1:0]ABDTRABMODE[2:0]
rwrwrwrwrwrwrwrwrwrwrw

1514131211109876543210
Res.Res.ADSIZE[1:0]ADDT
R
ADMODE[2:0]Res.Res.ISIZE[1:0]IDTRIMODE[2:0]
rwrwrwrwrwrwrwrwrwrwrwrw

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

Bit 29 DQSE : DQS enable

This bit enables the data strobe management.

0: DQS disabled

1: DQS enabled

Bit 28 Reserved, must be kept at reset value.

Bit 27 DDTR : data double transfer rate

This bit sets the DTR mode for the data phase.

0: DTR mode disabled for data phase

1: DTR mode enabled for data phase

Bits 26:24 DMODE[2:0] : Data mode

This field defines the data phase mode of operation.

000: No data

001: Data on a single line

010: Data on two lines

011: Data on four lines

100: Data on eight lines

101-111: Reserved

Bits 23:22 Reserved, must be kept at reset value.

Bits 21:20 ABSIZE[1:0] : Alternate bytes size

This field defines alternate bytes size:

00: 8-bit alternate bytes

01: 16-bit alternate bytes

10: 24-bit alternate bytes

11: 32-bit alternate bytes

Bit 19 ABDTR : Alternate bytes double transfer rate

This bit sets the DTR mode for the alternate-bytes phase.

0: DTR mode disabled for alternate-bytes phase

1: DTR mode enabled for alternate-bytes phase

Bits 18:16 ABMODE[2:0] : Alternate-byte mode

This field defines the alternate-byte phase mode of operation.

000: No alternate bytes

001: Alternate bytes on a single line

010: Alternate bytes on two lines

011: Alternate bytes on four lines

100: Alternate bytes on eight lines

101-111: Reserved

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

Bits 13:12 ADSIZE[1:0] : Address size

This field defines address size.

00: 8-bit address

01: 16-bit address

10: 24-bit address

11: 32-bit address

Bit 11 ADDTR : Address double transfer rate

This bit sets the DTR mode for the address phase.

0: DTR mode disabled for address phase

1: DTR mode enabled for address phase

Bits 10:8 ADMODE[2:0] : Address mode

This field defines the address phase mode of operation.

000: No address

001: Address on a single line

010: Address on two lines

011: Address on four lines

100: Address on eight lines

101-111: Reserved

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

Bits 5:4 ISIZE[1:0] : Instruction size

This bit defines instruction size:

00: 8-bit instruction

01: 16-bit instruction

10: 24-bit instruction

11: 32-bit instruction

Bit 3 IDTR : Instruction double transfer rate

This bit sets the DTR mode for the instruction phase.

0: DTR mode disabled for instruction phase

1: DTR mode enabled for instruction phase

Bits 2:0 IMODE[2:0] : Instruction mode

This field defines the instruction phase mode of operation.

000: No instruction

001: Instruction on a single line

010: Instruction on two lines

011: Instruction on four lines

100: Instruction on eight lines

101-111: Reserved

25.7.24 OCTOSPI write timing configuration register (OCTOSPI_WTCR)

Address offset: 0x0188

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

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.DCYC[4:0]
rwrwrwrwrw

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

Bits 4:0 DCYC[4:0] : Number of dummy cycles

This field defines the duration of the dummy phase.

In both SDR and DTR modes, it specifies a number of CLK cycles (0-31). It is recommended to have at least 5 dummy cycles when using memories with DQS activated.

25.7.25 OCTOSPI write instruction register (OCTOSPI_WIR)

Address offset: 0x0190

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
INSTRUCTION[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
INSTRUCTION[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 INSTRUCTION[31:0] : Instruction

Instruction to be sent to the external SPI device

25.7.26 OCTOSPI write alternate bytes register (OCTOSPI_WABR)

Address offset: 0x01A0

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
ALTERNATE[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
ALTERNATE[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 ALTERNATE[31: 0] : Alternate bytes

Optional data to be sent to the external SPI device right after the address

25.7.27 OCTOSPI HyperBus latency configuration register (OCTOSPI_HLCR)

Address offset: 0x0200

Reset value: 0x0000 0000

This register can be modified only when BUSY = 0.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.TRWR[7:0]
rwrwrwrwrwrwrwrw
1514131211109876543210
TACC[7:0]Res.Res.Res.Res.Res.Res.WZLLM
rwrwrwrwrwrwrwrwrwrw

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

Bits 23:16 TRWR[7:0] : Read write recovery time

Device read write recovery time expressed in number of communication clock cycles

Bits 15:8 TACC[7: 0] : Access time

Device access time expressed in number of communication clock cycles

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

Bit 1 WZL : Write zero latency

This bit enables zero latency on write operations.

0: Latency on write accesses

1: No latency on write accesses

Bit 0 LM : Latency mode

This bit selects the Latency mode.

0: Variable initial latency

1: Fixed latency

25.7.28 OCTOSPI register map

Table 213. OCTOSPI register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
0x0000OCTOSPI_CRRes.Res.FMD0E[1:0]Res.Res.Res.Res.PMMAPMSRes.TOIESMIEFTIETCIETEIERes.Res.Res.FTHRES[4:0]FSELDMMRes.Res.TCENDMAENABORTEN
Reset value00000000000000000000
0x0004ReservedReserved
0x0008OCTOSPI_DCR1Res.Res.Res.Res.Res.MTYP [2:0]Res.Res.Res.DEVSIZE[4:0]Res.Res.CSHT[5:0]Res.Res.Res.DLYBYPRes.FRCKCKMODE
Reset value00000000000000000
0x000COCTOSPI_DCR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.WRAPSIZE [2:0]Res.Res.Res.Res.Res.Res.Res.Res.PRESCALER[7:0]
Reset value00000000000
0x0010OCTOSPI_DCR3Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CSBOUND[4:0]Res.Res.Res.Res.Res.Res.Res.Res.MAXTRAN[7:0]
Reset value0000000000000
0x0014OCTOSPI_DCR4REFRESH[31:0]
Reset value00000000000000000000000000000000
0x0018-0x001CReservedReserved
0x0020OCTOSPI_SRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.FLEVEL[5:0]Res.Res.BUSYTOFSMFFTFTCFTEF
Reset value000000000000
0x0024OCTOSPI_FCRRes.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.CTOFCSMFRes.CTCFCTEF
Reset value0000
0x0028-0x003CReservedReserved
0x0040OCTOSPI_DLRDL[31:0]
Reset value00000000000000000000000000000000

Table 213. OCTOSPI register map and reset values (continued)

OffsetRegister313029282726252423222120191817161514131211109876543210
0x0044ReservedReserved
0x0048OCTOSPI_ARADDRESS[31:0]
Reset value00000000000000000000000000000000
0x004CReservedReserved
0x0050OCTOSPI_DRDATA[31:0]
Reset value00000000000000000000000000000000
0x0054-0x007CReservedReserved
0x0080OCTOSPI_PSMKRMASK[31:0]
Reset value00000000000000000000000000000000
0x0084ReservedReserved
0x0088OCTOSPI_PSMARMATCH[31:0]
Reset value00000000000000000000000000000000
0x008CReservedReserved
0x0090OCTOSPI_PIRResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResINTERVAL[15:0]
Reset value0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x0094-0x00FCReservedReserved
0x0100OCTOSPI_CCRSIOOResDQSEResDDTRDMODE [2:0]ResResResResABSIZE [1:0]ABDTRABMODE [2:0]ResResResADSIZE [1:0]ADDTRADMODE [2:0]ResResResISIZE[1:0]IDTRIMODE [2:0]ResResResResResRes
Reset value0000 0 00 000 00 000 00 000 0
0x0104ReservedReserved
0x0108OCTOSPI_TCRResSSHIFTResDHQCResResResResResResResResResResResResResResResResResResResResResResResResResResResDCYC[4:0]
Reset value000 0 0 0 0
0x010CReservedReserved
0x0110OCTOSPI_IRINSTRUCTION[31:0]
Reset value00000000000000000000000000000000
0x0114-0x011CReservedReserved
0x0120OCTOSPI_ABRALTERNATE[31:0]
Reset value00000000000000000000000000000000
0x0124-0x012CReservedReserved
0x0130OCTOSPI_LPTRResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResTIMEOUT[15:0]
Reset value0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x0134-0x013CReservedReserved

Table 213. OCTOSPI register map and reset values (continued)

OffsetRegister313029282726252423222120191817161514131211109876543210
0x0140OCTOSPI_WPCCRResResDQSEResDDTRDMODE [2:0]ResResABSIZE [1:0]ABDTRABMODE [2:0]ResResResADSIZE [1:0]ADDTRADMODE [2:0]ResResISIZE [1:0]IDTRIMODE [2:0]
Reset value000000000000000000000000
0x0144ReservedReserved
0x0148OCTOSPI_WPTCRResSSHIFTResDHQCResResResResResResResResResResResResResResResResResResResResResResResResDCYC[4:0]
Reset value000000
0x014CReservedReserved
0x0150OCTOSPI_WPIRINSTRUCTION[31:0]
Reset value00000000000000000000000000000000
0x0154-0x015CReservedReserved
0x0160OCTOSPI_WPABRALTERNATE[31:0]
Reset value00000000000000000000000000000000
0x0164-0x017CReservedReserved
0x0180OCTOSPI_WCCRResResDQSEResDDTRDMODE [2:0]ResResABSIZE [1:0]ABDTRABMODE [2:0]ResResResADSIZE [1:0]ADDTRADMODE [2:0]ResResISIZE [1:0]IDTRIMODE [2:0]
Reset value000000000000000000000000
0x0184ReservedReserved
0x0188OCTOSPI_WTCRResResResResResResResResResResResResResResResResResResResResResResResResResResResResDCYC[4:0]
Reset value0000
0x018CReservedReserved
0x0190OCTOSPI_WIRINSTRUCTION[31:0]
Reset value00000000000000000000000000000000
0x0194-0x019CReservedReserved
0x01A0OCTOSPI_WABRALTERNATE[31:0]
Reset value00000000000000000000000000000000
0x01A4-0x01FCReservedReserved
0x0200OCTOSPI_HLCRResResResResResResResResTRWR[7:0]TACC[7:0]ResResResResResResWZLLM
Reset value000000000000000000

Refer to Section 2.3 for the register boundary addresses.