AXI Quad SPI datasheet
AXI Quad SPI datasheet
Chapter 1: Overview
Legacy Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
AXI4 Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Core Internal Submodules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Feature Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Unsupported Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Licensing and Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Appendix B: Upgrading
Migrating to the Vivado Design Suite. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Upgrading in the Vivado Design Suite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Appendix C: Debugging
Finding Help on Xilinx.com . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Vivado Design Suite Debug Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Hardware Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Interface Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Overview
The top-level block diagram for the AXI Quad SPI core when configured with the AXI4-Lite
interface option is shown in Figure 1-1.
X-Ref Target - Figure 1-1
ext_spi_clk
sck_t
Interrupt SPI Clk sck_i
Controller CMD Compare Generator
IPIER and
IPISR Behavior
DGIER Signals ss_o
ss_t
ss_i
The choice of either AXI4-Lite or AXI4 interface is based on the Enable Performance Mode
option in the Vivado® Integrated Design Environment (IDE) (see Chapter 4). Performance
mode is disabled by default which selects the AXI4-Lite interface. The core always operates
as a slave IP when the AXI4 interface is selected.
Legacy Mode
Legacy mode is selected when the Enable Performance Mode option in the Vivado
Integrated Design Environment (IDE) is disabled. Legacy mode uses the AXI4-Lite interface
and is fully backward compatible with all the older versions of the AXI Quad SPI core in
terms of functionality, register bit placement, and register access.
The AXI Quad SPI core, when configured in standard SPI mode, is a full-duplex synchronous
channel that supports a four-wire interface (receive, transmit, clock, and slave-select)
between a master and a selected slave. When configured in Dual/Quad SPI mode, this core
supports additional pins for interfacing with external memory. These additional pins are
used while transmitting the command, address, and data based on the control register
settings and command used.
The core supports the manual slave select mode as the default mode of operation for slave
select mode. This mode allows manual control of the slave select line with the data written
to the slave select register, thereby allowing transfers of an arbitrary number of elements
without toggling the slave select line between elements. However, before starting a new
transfer, the slave select line must be toggled.
The other mode related to slave select is automatic slave select mode. In this mode, the
slave select line is toggled automatically after each element transfer (when FIFO is
disabled). This mode, which is supported only in standard SPI mode, is described in more
detail in SPI Protocol Slave Select Assertion Modes in Chapter 3.
The core functionality is divided into standard SPI mode and dual and quad SPI mode. The
functionality for each mode differs in the way the slave memory works.
• Mode
• Enable STARTUPEn Primitive
Note: The STARTUPE2 primitive is applicable for 7 series devices. The STARTUPE3 primitive is
applicable for Ultrascale™ devices.
• Transaction Width
• No. of Slaves
• Frequency Ratio
• Enable FIFO
The properties of the core in standard SPI mode, including or excluding a FIFO, are
described as:
• The choice of inclusion of FIFO is based on the Enable FIFO parameter. FIFO Depth
parameter is linked to Enable FIFO parameter. FIFO Depth limits the transmit and
receive FIFO depth to 16 or 256 when FIFO is enabled. When FIFO is not enabled, the
value of FIFO depth parameter is considered to be 0. A FIFO depth of 256 should be
used because this is the most suitable depth in relation to the flash memory page size.
• The valid values for the FIFO Depth option in this mode are 16 or 256 when FIFO is
enabled through Enable FIFO parameter.
When Enable FIFO is 0 and no FIFO is included in the core. Data transmission occurs
through the single transmit and receive register. When FIFO Depth is 16 or 256, the
transmit or receive FIFO is included in the design with a depth of 16 or 256 elements. The
width of the transmit and receive FIFO is configured with the Transaction Width option.
The AXI Quad SPI core supports continuous transfer mode. When configured as master, the
transfer continues until the data is available in the transmit register/FIFO. This capability is
provided in both manual and automatic slave select modes. As an example, during the page
read command, the command, address, and number of data beats in the DTR must be set
equal to the same number of data bytes intended to be read by the SPI memory.
When the core is configured as a slave, if the slave select line (SPISEL) goes High (inactive
state) during the data element transfer, the current transfer is aborted. If the slave select
line goes Low, the aborted data element is transmitted again. The slave mode of the core is
allowed only in the standard SPI mode.
• Mode
• Slave Device
• Enable STARTUPEn Primitive
Note: The STARTUPE2 primitive is applicable for 7 series devices. The STARTUPE3 primitive is
applicable for UltraScale™ devices.
• Transaction Width
• No. of Slaves
• FIFO Depth
• The depth of the FIFO is based on the FIFO Depth option which has valid values of 16
or 256.
• The width of the FIFO is 8-bits because the page size of the SPI slave memories is
always 8-bits.
• For standard SPI mode instructions, the IO0 and IO1 pins are unidirectional [the same
as the master out slave in (MOSI) and master in slave out (MISO) pins].
• For dual mode SPI instructions, the IO0 and IO1 pins are bidirectional — depending on
the type of command and memory chosen.
The quad SPI mode is selected when the Mode option is set to Quad. The behavior of the
ports in quad SPI mode is:
• For standard mode SPI instructions, the IO0 and IO1 pins are unidirectional and
function the same as in standard SPI mode.
• For dual mode SPI instructions, the IO0 and IO1 pins are unidirectional or bidirectional
depending on the type of instruction and memory selected by setting the control
register bits. The IO2 and IO3-bits are 3-state.
• For quad mode SPI instructions, the IO0, IO1, IO2, and IO3 pins are unidirectional or
bidirectional depending on the type of memory used while transmitting the command,
address, and data.
When the Mode option is Dual or Quad, the core is forced to operate in dual or quad SPI
mode, respectively, while the core continues to support the standard SPI commands and
interface. The internal command logic guides the core I/O behavior depending on the
command loaded in the DTR FIFO (SPI DTR). The Mode option settings also determine the
I/O pin availability.
The core can communicate with both off-chip and on-chip masters and slaves. The number
of slaves is limited to 32 by the size of the slave select register. However, the number of
slaves and masters affects the achievable performance in terms of frequency and resource
utilization. All of the SPI core and interrupt registers are 32-bits wide. The core supports
only 32-bit access to all SPI and interrupt register modules.
AXI4 Interface
The AXI4 interface is included when the Enable Performance Mode option is selected. In
this mode, the core can be operated in enhanced mode (Enable XIP Mode is not selected)
or XIP mode (Enable XIP Mode is selected). In performance mode, the AXI4 interface is
used for burst transactions at the DTR and DRR locations.
Enhanced Mode
In this mode, the AXI4-Lite interface for the core is replaced with the AXI4 interface. This
mode also supports standard, dual and quad modes depending on the Mode option
setting. The target slave memory can be chosen by setting the Slave Device option to
Mixed, Winbond, Micron, Macronix, or Spansion. All of the registers are mapped to the
same offset as with the AXI4-Lite interface. The AXI4 interface is allowed to do burst
transactions at the data transmit register and data receive register only. All other registers
should be single access only. This should be noted while designing the application for the
core.
The DTR and DRR FIFOs are configurable to 16 or 256 beat depth. The core supports the
same functionality as the AXI4-Lite interface. The added advantage for this mode is burst
capability at the DTR and DRR locations, reducing the overhead of reading and writing data
to and from the core at the AXI4 interface side.
XIP Mode
In XIP mode, the core has an AXI4-Lite as well as an AXI4 interface (see Figure 1-2). The
AXI4-Lite interface is chosen for accessing the configuration register and the status register.
The AXI4 interface is used only for reading. The AXI4 interface supports only the read
channel. No write transactions are allowed. The AXI4-Lite interface can access the
configuration register to change the clock polarity (CPOL) or clock phase (CPHA)
configuration. In XIP mode, IP support the following two modes:
• High Performance Mode: In this mode, IP supports more than 64 beat transactions,
provided read data ready should always high.
• Normal Mode: In this mode, IP supports maximum of 64 beat transactions.
XIP-CR
XIP-SR CDC
Lite io0_t
Interface SPI Mode 0 io0_i
Logic
io1_o
io1_t
io1_i
INCR and WRAP SPI Mode 1
Address Gen and 2 Logic io2_o
AXI4
Memory spisel
Mapped
Interface RDATA
RX FIFO Wr_En SPI sck_o
Data STARTUP
Transmit
Merging DataLogic Block
Logic 8-bit
32-bit Rx sck_t
RLAST AXI Data
Length SPI Clk sck_i
Counter Generator
ss_o
ss_t
ss_i
X12680
In this mode, the core considers the SPI as read-only memory. The three read commands
are provided with the configuration mode which is used while reading the SPI flash
memory. The core functionality is verified by assigning the same frequency to both the
AXI4-Lite and AXI4 interface. The three main read commands which are built into the core
are fast read (0x0Bh), DIOFR (0xBBh) and QIOFR (0xEBh).
SPI Module
The SPI module consists of a shift register, a parameterized baud rate generator (BRG), and
a control unit. It provides the SPI interface, including the control logic and initialization
logic. In standard SPI mode, this module is the center of the SPI operation.
Optional FIFOs
When enabled by the parameter Enable FIFO, the transmit FIFO and receive FIFO are
implemented on both the transmit and receive paths. The width of the transmit FIFO and
receive FIFO are the same and depend on the Transaction Width parameter. The FIFOs can
be enabled or disabled with depth variable at 16 or 256 when enabled in Standard SPI
mode. In dual and quad SPI modes, the FIFO depth is 16 or 256 locations (bytes).
STARTUPEn Module
The STARTUPE2 primitive is applicable for 7 series devices. The STARTUPE3 primitive is
applicable for UltraScale devices.
For more information, refer to the 7-Series FPGAs Configuration User Guide (UG470)[Ref 17].
For more information, refer to the UltraScale Architecture Libraries Guide (UG974) [Ref 1].
Feature Summary
• Legacy mode — AXI4-Lite interface based design
° AXI interface
- Supports AXI4-Lite interface — legacy mode
- All registers in the core should be accessed as 32-bit access and only through a
single length AXI4-Lite transaction
° AXI4 interface
- Supports AXI4 interface
Frequency Ratio
No. of Slaves
Slave Device
FIFO Depth
Core Operation
Mode
2, 4, 8, Nx16 for
0, 16, 256 Standard 1-32 (any) (either)
N = 1, 2, 3,...,128(1)
Legacy mode
16, 256 Dual 2 (2) 1-32 (any) (either)
16, 256 Quad 2 (2) 1-32 (any) (either)
2, 4, 8, Nx16 for
x 0, 16, 256 Standard 1-32 (any) (either)
N = 1, 2, 3,...,128(1)
Enhanced mode
x 16, 256 Dual 2 (2) 1-32 (any) (either)
x 16, 256 Quad 2 (2) 1-32 (any) (either)
x x 64 Standard 2(2) 1 (3) (any) (either)
(2) 1 (3)
XIP mode x x 64 Dual 2 (any) (either)
x x 64 Quad 2 (2) 1 (3) (any) (either)
Notes:
1. In standard mode the ext_spi_clk can be the same as the axi_aclk or axi4_aclk, but it should not be less than the
AXI CLK or AXI4 ACLK. This mode is specifically for slow operating devices that work on the SPI protocol. Examples of these
devices are EEPROMs and SPI interface-based DACs.
2. In XIP Mode or Dual/Quad variants of Legacy/Enhanced mode, set ext_spi_clk to double the intended SPI clock. The
Frequency Ratio parameter divides this clock by 2 to generate the SPI clock. Most of the SPI flash memory commands
operate at a higher SPI clock rate with the exception of some commands which operate at a lesser frequency. It is your
responsibility to configure the core with the correct ext_spi_clk and Frequency Ratio parameter and use the appropriate
commands. If slower operating commands are executed on higher SPI clock ratios, the core does not generate an error and
passes these commands to the external flash memory, but at the same time, the operation of the flash memory is not
guaranteed.
3. In XIP mode, No. of Slaves is always equal to 1 and this parameter cannot be updated.
4. The STARTUPE2 primitive is applicable for 7 series devices. The STARTUPE3 primitive is applicable for UltraScale and later
devices.
Unsupported Features
These features relate to the AXI4 interface and are not supported by the core.
Information about this and other Xilinx LogiCORE IP modules is available at the
Xilinx Intellectual Property page. For information on pricing and availability of other Xilinx
LogiCORE IP modules and tools, contact your local Xilinx sales representative.
Product Specification
Standards
The AXI Quad SPI core connects the AXI4 and AXI4-Lite interfaces to SPI slave devices that
support the standard, dual or quad SPI protocol instruction set. The core provides a serial
interface to SPI slave devices such as SPI serial flash memory from Winbond, Micron,
Spansion, and Macronix. The dual/quad SPI is an enhancement to the standard SPI protocol
(described in the Motorola M68HC11 data sheet). See Specification Exceptions for
differences between the core protocol and the Motorola M68HC11-Rev. 4.0 reference
manual.
Performance
For full details about performance and resource utilization, visit the Performance and
Resource Utilization web page.
The performance characterization of this core was compiled using the margin system
methodology. The details of the margin system characterization methodology are described
in the Vivado Design Suite User Guide: Designing With IP (UG896) [Ref 2].
Note: Performance for Zynq®-7000 SoC and UltraScale™ devices is similar to 7 series devices.
• Virtex®-7
• Kintex®-7
• Artix®-7
The maximum frequencies for the AXI Quad SPI core are shown in Table 2-1.
Note: For xip and standard modes, ext_spi_clk may be limited to 60 MHz.
Note: UltraScale™ device frequency numbers are expected to be similar to 7 series numbers.
Note: The frequencies mentioned in the above table are specific to legacy SPI x 1 mode. They vary
if we change the mode and other settings.
Resource Utilization
For full details about performance and resource utilization, visit the Performance and
Resource Utilization web page.
Port Descriptions
Table 2-2: I/O Signals
Signal name Interface Signal type Init status Description
AXI Clock. This signal in available only
s_axi_aclk Clock I -
in legacy and XIP modes.
AXI Reset. This signal in available only
s_axi_aresetn Reset I -
in legacy and XIP modes.
AXI4 Clock. This signal in available only
s_axi4_aclk(1) Clock I -
in enhanced and XIP modes.
AXI4 Reset. This signal in available only
s_axi4_aresetn(2) Reset I -
in enhanced and XIP modes.
This clock is used for the SPI interface.
Notes:
1. AXI clock is expected to be faster than ext_spi_clk.
2. When ext_spi_clk is too slow, it is advised to use FIFO depth 256. (Frequency ratio is in the range of 50 to 100.)
3. These signals are applicable only in dual quad mode.
Table 2-3 shows the set of registers applicable whether or not Enable Performance Mode
is selected and Enable XIP Mode is not selected. Some AXI Quad SPI core registers should
be accessed individually. These registers are configurable and accessible through either the
AXI4-Lite interface or the AXI4 interface (enhanced mode). All registers are accessed as
32-bit. If non-existent registers are accessed, they return an OKAY response. The reading of
these registers returns 0, and write does not have any affect.
Address Space Offset Register Name Access Type Default Value Description
(hex)
SPI data receive register. A
6Ch SPI DRR Read N/A(1)
single register or a FIFO
No slave is SPI Slave select register
70h SPISSR R/W selected
0xFFFF
SPI Transmit FIFO Transmit FIFO occupancy
74h Read 0x0
Occupancy Register(2) register
SPI Receive FIFO Receive FIFO occupancy
78h Read 0x0
Occupancy Register(2) register
Interrupt Control Grouping
Device global interrupt enable
1Ch DGIER R/W 0x0
register
20h IPISR R/TOW (3) 0x0 IP interrupt status register
28h IPIER R/W 0x0 IP interrupt enable register
Notes:
1. The power-on reset data in the SPI DRR is unknown or all zeros. This register should not be considered for power-on reset
conditions.
2. Exists only when FIFO Depth is set to 16 or 256.
3. TOW = Toggle on write. Writing a 1 to a bit position within the register causes the corresponding bit position in the register
to toggle.
Register Details
Software Reset Register
The Software Reset Register (SRR) permits resetting the core independently of other cores
in the system.
IMPORTANT: To activate the software-generated reset, the value of 0x0000_000a must be written to
the Software Reset Register.
Writing 0x0000_000a to the SRR resets the core register for four AXI clock cycles. Any
other write access generates undefined results and results in an error. The bit assignment in
the software reset register is shown in Figure 2-1 and described in Table 2-4. Any attempt to
read this register returns undefined data.
X-Ref Target - Figure 2-1
31 0
Reset
;
Table 2-4: Software Reset Register Description (Core Base Address + 0x40)
Core Reset
Bits Name Access Value Description
Master
Transaction
Inhibit Rx FIFO
Reset Master
Reserved CPHA LOOP
31 10 9 8 7 6 5 4 3 2 1 0
Manual Slave
Select Assertion CPOL
Enable
X14420
Table 2-5: SPI Control Register Description (Core Base Address + 0x60)
Table 2-5: SPI Control Register Description (Core Base Address + 0x60) (Cont’d)
Table 2-5: SPI Control Register Description (Core Base Address + 0x60) (Cont’d)
Notes:
1. Setting of this bit (LSB First) is allowed only in Standard SPI mode. Dual/quad SPI modes support MSB first mode
only. In dual/quad SPI mode if this bit is set, the corresponding error bit is set in SPISR and an interrupt is
generated.
2. In dual and quad SPI mode, values for CPHA-CPOL of either 00 or 11 are allowed. Setting of other configurations
causes a malfunction while communicating with memory. If other values are set, the corresponding error bit is set
in the SPISR and an interrupt is generated if the corresponding bit is enabled in the SPI IPIER register.
3. The slave mode support is available only in standard SPI mode. In dual or quad SPI mode, only the master mode
of the core is supported. If other values are set, the corresponding error bit is set in SPISR and an interrupt is
generated if the corresponding bit is enabled in the SPI IPIER register.
4. Loopback is allowed in standard SPI mode.
Command
Error CPOL_CPHA
_Error Tx_Empty
MSB
Reserved Error MODF Rx_Empty
31 11 10 9 8 7 6 5 4 3 2 1 0
Loop Back
Slave_Mode_ Rx_Full
Error
Select
Table 2-6: SPI Status Register Description (Core Base Address + 0x64)
Table 2-6: SPI Status Register Description (Core Base Address + 0x64) (Cont’d)
CPOL_CPHA_Error flag.
When set to:
• 0 = Default.
• 1 = The CPOL and CPHA are set to 01 or 10.
When the SPI memory is chosen as either Winbond,
CPOL_CPHA_
6 Read 0 Micron or Spansion or Macronix and CPOL and CPHA are
Error
configured as 01 or 10, this bit is set.
Table 2-6: SPI Status Register Description (Core Base Address + 0x64) (Cont’d)
Receive full.
When a receive FIFO exists, this bit is set High when the
receive FIFO is full. The occupancy of the FIFO is
1 Rx_Full Read 0 incremented with the completion of each SPI transaction.
Note: When FIFOs do not exist, this bit is set High when an SPI
transfer has completed (this option is available only in standard
SPI mode). Rx_Empty and Rx_Full are complements in this case.
Receive Empty.
When a receive FIFO exists, this bit is set High when the
receive FIFO is empty. The occupancy of the FIFO is
decremented with each FIFO read operation.
0 Rx_Empty Read 1 Note: When FIFOs do not exist, this bit is set High when the
receive register has been read (this option is available only in
standard SPI mode). This bit is cleared at the end of a successful
SPI transfer. For dual/quad SPI mode, the FIFO is always present in
the core.
The SPI DTR should be in reset state before filling so that the DTR FIFO write pointer is
pointing to the 0th location.
Dual/Quad Mode
The first write must always be a SPI command from AXI transactions, followed by the
address (either 24-bit or 32-bit), then filled with the data to be transmitted. When reading
the status register of the memory, then as per the command requirements, this register
should be filled with dummy bytes along with a command and address (optional).
In one of these modes, the dummy bytes are required to fill in the DTR which is used for the
internal count of the data reception from memory.
In commands such as dual mode read, these bytes are not transferred on the data lines, but
are used by the internal logic to keep track of the number of data bytes to be read from the
SPI slave memory.
If a transfer is in progress, the data in the SPI DTR is loaded into the shift register as soon
as the data in the shift register is transferred to the SPI DRR and a new transfer starts. The
data is held in the SPI DTR until replaced by a subsequent write. The SPI DTR is shown in
Figure 2-4 and Table 2-7 shows the data format.
When a transmit FIFO exists, data is written directly into the FIFO and the first location in
the FIFO is treated as the SPI DTR. The pointer is decremented after completion of each SPI
transfer. The choice of inclusion or exclusion of the FIFO in the design is available only when
the core is configured in Standard SPI mode. If the core is configured in dual or quad SPI
mode, the FIFO always exists. In this mode, the FIFO depth is defined with the parameter
FIFO Depth (allowed values are 16 or 256).
This register cannot be read and can only be written when it is known that space for the
data is available. If an attempt to write is made on a full register or FIFO, the AXI write
transaction completes with an error condition. Reading the SPI DTR is not allowed and the
read transaction results in undefined data.
X-Ref Target - Figure 2-4
N-1 0
X14422
Figure 2-4: SPI Data Transmit Register (Core Base Address + 0x68)
Table 2-7: SPI Data Transmit Register Description (Core Base Address + 0x68)
Core Reset
Bits Name Access Value Description
Notes:
1. The D N-1 bit always represents the MSB bit irrespective of LSB first or MSB first transfer selection. When the
Transfer Width parameter is 8 or 16, the unused upper bits ((AXI data width – 1) to N) are reserved.
2. In standard SPI mode, the width of this register can be 8 or 16 or 32 based on the core configuration. In dual or
quad SPI mode, this register is 8-bits wide.
If the SPI DRR was not read and is full, the most recently transferred data is lost and a
receive overrun interrupt occurs. The same condition can also occur with a master SPI
device.
The choice of inclusion (FIFO Depth = 16 or 256) or exclusion (FIFO Depth = 0) of the FIFO
in the design is available only when the core is configured in standard SPI mode. When the
core is configured in dual or quad SPI mode, the FIFO always exists. In this mode, the FIFO
depth is defined with the parameter FIFO Depth (allowed values are 16 or 256). For both
master and slave SPI configuration mode of the core (in Standard SPI mode only) with a
receive FIFO, the data is buffered in the FIFO. The receive FIFO is a read-only buffer. If an
attempt is made to read an empty receive register or FIFO, it gives out an error in the Status
register. Writes to the SPI DRR do not modify the register contents and return with a
successful OK response.
The power-on reset values for the SPI DRR are unknown. When known data has been written
into the receive FIFO during core transactions, the data in this register can be considered for
reading. The SPI DRR is shown in Figure 2-5, while the specifics of the data format is
described Table 2-8.
IMPORTANT: Based on the command that is issued to the SPI device, a certain unwanted number of
bytes are written to the Receive FIFO. These bytes have to be discarded.
N-1 0
X14424
Figure 2-5: SPI Data Receive Register (Core Base Address + 0x6C)
Table 2-8: SPI Data Receive Register Description (Core Base Address + 0x6C)
Notes:
1. The D N-1 bit always represents the MSB bit irrespective of LSB first or MSB first transfer selection. When the
Transfer Width parameter is 8 or 16, the unused upper bits ((AXI data width – 1) to N) are reserved.
2. In standard SPI mode, the width of this register can be 8 or 16 or 32 based on the core configuration. In dual or
quad SPI mode, this register is 8-bit wide.
3. In standard mode, reading an empty DRR FIFO returns a slave error.
31 N N-1 0
X14425
Figure 2-6: SPI Slave Select Register (Core Base Address + 0x70)
Table 2-9: SPI Slave Select Register Description (Core Base Address + 0x70)
Core Reset
Bits Name Description
Access Value
31:N Reserved N/A N/A Reserved
Active-Low, one-hot encoded slave select vector of length
N-bits. N must be ≤ the data bus width (32-bit).
[N–1]:0 Selected Slave R/W 1 The slaves are numbered right to left starting at zero with
the LSB. The slave numbers correspond to the indexes of
signal SS.
This register is read-only. When written, or read when the FIFO is empty, the register
contents are not affected. The only reliable way to determine that the transmit FIFO is
empty/full is by reading the Tx_Empty/Tx_Full status bit in the SPI Status Register or the DTR
empty bit in the interrupt status register. The transmit FIFO occupancy register is shown in
Figure 2-7, while the specifics of the data format are described in Table 2-10.
X-Ref Target - Figure 2-7
Occupancy
Reserved Value
31 log(C_FIFO_DEPTH) (log(C_FIFO_DEPTH)-1) 0
X14426
Figure 2-7: SPI Transmit FIFO Occupancy Register (Core Base Address + 0x74)
Table 2-10: SPI Transmit FIFO Occupancy Register Description (Core Base Address + 0x74)
Reset
Core
Bits Name Access Value Description
(hex)
31 – log(FIFO Depth) Reserved N/A N/A Reserved
Occupancy The binary value plus 1 yields the
(log(FIFO Depth)–1):0 Read 0
Value occupancy.
This register is read-only. A write to it (or of a read when the FIFO is empty) does not affect
the register contents. The only reliable way to determine that the receive FIFO is empty/full
is by reading the Rx_Empty/Rx_Full status bit in the SPI status register.
The receive FIFO occupancy register is shown in Figure 2-8, while the specifics of the data
format are described in Table 2-11.
Occupancy
Reserved Value
31 log(C_FIFO_DEPTH) (log(C_FIFO_DEPTH)-1) 0
X14427
Figure 2-8: SPI Receive FIFO Occupancy Register (Core Base Address + 0x78)
Table 2-11: SPI Receive FIFO Occupancy Register Description (Core Base Address + 0x78)
Reset
Bits Name Core Value Description
Access
(hex)
31–log(FIFO Depth) Reserved N/A N/A Reserved
Occupancy The binary value plus 1 yields the
(log(FIFO Depth)–1):0 Read 0
Value occupancy.
In Standard SPI mode, when FIFO Depth is set to 0, all of the interrupts are available except:
Reserved
31 30 0
X14428
Figure 2-9: Device Global Interrupt Enable Register (Core Base Address + 0x1C)
Table 2-12: Device Global Interrupt Enable Register Description (Core Base Address + 0x1C)
Core Reset
Bits Name Description
Access Value
Global Interrupt Enable.
Allows passing all individually enabled interrupts to the
31 GIE R/W 0 interrupt controller.
When set to:
0 = Disabled.
1 = Enabled.
30:0 Reserved N/A N/A Reserved
DRR
DRR_Not_Empty Full
Loop Back
Error Slave Mode Tx FIFO DTR
Reserved Error Half Empty Empty MODF
31 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Table 2-13: IP Interrupt Status Register Description (Core Base Address + 0x20)
Core Reset
Bits Name Access Value Description
Table 2-13: IP Interrupt Status Register Description (Core Base Address + 0x20) (Cont’d)
Table 2-13: IP Interrupt Status Register Description (Core Base Address + 0x20) (Cont’d)
Table 2-13: IP Interrupt Status Register Description (Core Base Address + 0x20) (Cont’d)
Notes:
1. TOW = Toggle On Write. Writing a 1 to a bit position within the register causes the corresponding bit position in the register
to toggle.
2. Look for the DTR Empty bit in IPISR to make sure that the transaction from the IP to flash memory is complete.
DRR
DRR_Not_Empty Full
Loop Back
Error Slave Mode Tx FIFO DTR
Reserved Error Half Empty Empty MODF
31 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Table 2-14: IP Interrupt Enable Register Description (Core Base Address + 0x28)
Table 2-14: IP Interrupt Enable Register Description (Core Base Address + 0x28) (Cont’d)
Table 2-14: IP Interrupt Enable Register Description (Core Base Address + 0x28) (Cont’d)
XIP Mode
When the AXI Quad SPI core is configured in XIP mode, only the following registers are
available through the AXI4-Lite interface:
These 32-bit registers are configurable and accessible individually through the AXI4-Lite
interface. Table 2-15 provides a summary of the AXI Quad SPI core registers in XIP mode.
IMPORTANT: In XIP mode, the AXI QUAD SPI does not generate any interrupt. The interrupt pin can be
left unconnected.
Mode determines which one of these commands is supported by the core. These
commands are built in and no other commands need to be configured. When Mode is set,
the same command operates during the whole transaction.
31 2 1 0
CPOL_CPHA
Error Rx Full
31 5 4 3 2 1 0
Specification Exceptions
Exceptions from the Motorola M68HC11-Rev. 4.0 Reference
Manual
• A slave mode-fault error is added to provide an interrupt if a SPI device is configured
as a slave and is selected when not enabled.
• In this design, the SPI DTR and SPI DRR registers have independent addresses. This is
an exception to the M68HC11 specification that calls for two registers to have the same
address.
• All SS signals are required to be routed between SPI devices internally to the FPGA.
This is because toggling of the SS signal is utilized in slaves to minimize FPGA
resources.
• Manual control of the SS signals is provided by setting Bit[7] in the SPICR register.
When the device is configured as a master and is enabled while Bit[7] of the SPICR
register is set, the vector in the SPISSR register is asserted. When this mode is enabled,
multiple elements can be transferred without toggling the SS vector.
• A control bit is provided to inhibit master transfers. This bit is effective in any master
mode, but its primary intent is manual control of the SS signals.
• In the M68HC11 implementation, the transmit register is transparent to the shift
register which necessitates the write collision error (WCOL) detection hardware. This
feature is not implemented in this design.
• The interrupt enable bit (SPIE) defined by the M68HC11 specifications which resides in
the M68HC11 control register has been moved to the IPIER register. In place of the SPIE
bit, there is a bit to select local master loopback mode for testing.
• An option is implemented in this design to implement FIFOs on both transmit and
receive (Full Duplex only) mode.
• M68HC11 implementation supports only byte transfer. In this design either a byte,
half-word, or word transfer can be configured using the Transaction Width parameter.
• The baud rate generator is specified by Motorola to be programmable using bits in the
control register; however, in this FPGA design the baud rate generator is programmable
using parameters in the VHDL implementation. Thus, run-time configuration of the
baud rate is not possible. Beyond the ratios of 2, 4, 16 and 32, all integer multiples of
16 up to 2048 are allowed.
• Most of the SPI slave devices support the SPI modes 0 and 3. For some of these
devices, the data valid time of 8 ns from the falling edge of SCK is applicable. While
operating with these devices at a higher speed of 50 MHz (most of the instructions
support this speed), the core should be configured with Frequency Ratio set to 2
(where the AXI is configured to operate at 100 MHz).
Due to limited time availability in the design as well as real SPI slave behavior for data
change, the data in the SPI core is registered in the middle of each SPI rising and next
consecutive falling edge inside the core. This adds 5 ns of time to the core (while
operating at 100 MHz on the ext_spi_clk port) for registering the data. As per the
M68HC11 document, the master should register data on each rising edge of SCK in SPI
modes 1 and 3. Note that the data registering mechanism when Frequency Ratio is 2
follows a different pattern than specified in the standard although this is applicable to
the data registering mechanism in the core only. The SPI core, when configured in
master mode, changes data on each falling edge and this behavior is as per the
M68HC11 standard.
• When the AXI Quad SPI core is configured in slave mode (Mode set to Standard), the
data in the core is registered on the SCK rising edge + one AXI clock cycle. Internally,
this data is registered on the next rising edge of the AXI clock cycle. The core changes
the data on the SCK falling edge + one AXI clock cycle.
• In Standard SPI mode of operation, when the SCK RATIO = 16 is used, the core provides
approximately seven cycles of ext_spi_clk setup time for the downstream device to
register the data on the next SPI rising edge.
Other Exceptions
• The AXI Quad SPI core supports one memory selection at a time. This means, in
multi-slave systems, the core should be configured to select and perform operations
only on one slave at a time.
• The core is based on the specific memory parts from Winbond (W25Q80), Micron
(N25Q256), Macronix (MX66U1G45G), and Spansion (S70FL01GS). To test the core with
other memory parts, ensure that the internal command decoding logic and its bit
positions are understood for correct operation of the core.
Also, check the common command set between the Winbond or Micron or Spansion or
Macronix memory part data sheet and other memory parts to confirm that the
common commands between these documents are executed. In quad mode, the design
supports the Micron memory parts with HOLD functionality only. The memory parts
with RESET functionality are not supported in the design.
• See Following are the unsupported Commands for Dual/Quad SPI Mode across
different memories of Winbond, Micron, Spansion, and Macronix.
• Dedicated memory should be used as AXI Quad SPI slaves because the core supports a
limited set of commands which are common in Winbond, Micron, and Spansion
memories in terms of command, address, data requirement and their Macronix
behavior. If single dedicated memories are used with the core, a wider range of
commands is supported for the respective memory and performance is optimized.
• In XIP mode, there are several clock domain crossing signals present between the AXI4
and AXI4-Lite interfaces and the SPI domain. When reading the XIP SR, note that the
core takes five clock cycles to update the status bits.
• XIP configuration mode does not support byte access mode.
• The core does not support queued commands. The core design is based on commands
supported by standard SPI devices such as Winbond, Micron, Macronix, and Spansion
memory only.
While carrying out the write burst operation in the DTR register, it is illegal to have holes in
the write strobes. This is not allowed by the core and core behavior in this instance is not
guaranteed.
When starting any new transaction at the SPI flash memory, the DTR FIFO should be always
filled with a command followed by address, dummy bytes, then data bytes. This sequence
should be strictly adhered to by the application. The read or write data occupancy registers
indicate the number of locations left in the receive or transmit FIFO which help to determine
the burst length of the next transaction. This mode is most suitable for CDMA-based
applications.
• Supports multi-master configuration within the FPGA with separated _I, _O, _T
representation of 3-state ports.
• Works with N times 8-bit data characters in default configuration. The default mode
implements manual control of the SS output using data written to the SPISSR. This
appears directly on the SS output when the master is enabled. This mode can only be
used with external slave devices. An optional operation can be selected where the SS
output is toggled automatically (when FIFO is disabled) with each 8-bit character
transfer by the master device using a bit in the SPICR for SPI master devices.
• Multi-master environment supported (implemented with 3-state drivers and requires
software arbitration for possible conflict). See AXI4-Lite Interface Functionality in
Standard SPI Multi-Master Configuration.
• Multi-slave environment supported (automatic generation of additional slave select
output signals for the master).
• Supports maximum SPI clock rates up to one-half the AXI clock rate in master mode
and one-fourth the AXI clock rate in slave modes (C_SCK_RATIO = 2 is not supported in
slave mode due to the synchronization method used between the AXI and SPI clocks). It
is required that the AXI and external clock signals be aligned when configured in slave
mode.
• Parameterizable baud rate generator for the SPI clock signal.
• The WCOL flag is not supported as a write collision error as described in the M68HC11
reference manual. Do not write to the transmit register when a SPI data transfer is in
progress.
• Back-to-back transactions are supported — multiple, uninterrupted byte/half-word/
word transfers can occur provided that the transmit FIFO never gets empty and the
receive FIFO never gets full.
• All SPI transfers are full-duplex where an 8-bit data character is transferred from the
master to the slave and an independent 8-bit data character is transferred from the
slave to the master. This can be viewed as a circular 16-bit shift register in that an 8-bit
shift register in the SPI master device is connected to another 8-bit shift register in a
SPI slave device.
The signals SCK, IO0(MOSI), and IO1(MISO) are shared for all slaves and masters. See
Figure 3-1, where any one of the SPI devices can be configured as a master and the others
can be configured as slaves (via register(60h) configuration). In such cases the master will
drive the SPISEL pin of the slaves from the ss pins.
SPI Device 0
IO0(MOSI)
SS(0)
IO1(MISO)
SCK SS(1)
SPISEL
SS(1) SS(2)
SS(2) SS(3)
SS(3)
SPI Device 1
IO0(MOSI)
IO1(MISO)
SCK
SPISEL
SS(1)
SS(2)
SS(3)
SPI Device 2
IO0(MOSI)
IO1(MISO)
SCK
SPISEL
SS(1)
SS(2)
SS(3)
SPI Device 3
IO0(MOSI)
IO1(MISO)
SCK
SPISEL
SS(1)
SS(2)
SS(3)
Slave-only devices (not shown) have SPISEL local slave select ports
only and do not have SS(N) remote slave select ports
x14433
Figure 3-1: Multi-Master Configuration Block Diagram for Standard SPI Mode
Note: When the core is generated in master mode but through register configuration (60h) if it is
configured as a slave, SPISEL should be driven to the core from the SPI master.
Each master SPI device has the functionality to generate an active-Low, one-hot encoded
SS(N) vector where each bit is assigned an SS signal for each slave SPI device. It is possible
for both SPI master/slave devices to be internal to the FPGA and SPI slave devices to be
external to the FPGA. SPI pins are automatically generated through the Vivado® Design
Suite when interfacing to an external SPI slave device. Multiple SPI master/slave devices are
shown in Figure 3-1. The same configuration diagram is applicable for dual mode.
When FIFOs are implemented, the slave select address is required to be the same for all
data buffered in the FIFOs. This is necessary because there is no FIFO for the slave select
address. Both transmit and receive FIFOs are 16 (or 256) elements deep and are accessed
using single AXI transactions because burst mode is not supported.
The transmit FIFO is write-only. When data is written into the FIFO, the occupancy number
is incremented and when a SPI transfer is completed, the number is decremented. As a
consequence of this operation, aborted SPI transfers still have the data available for the
transmission retry. The transfers can only be aborted in the master mode by setting the
master transaction inhibit bit, bit 8 of the SPICR, to 1 during a transfer. Setting this bit in the
slave mode has no effect on the operation of the slave. These aborted transfers are on the
SPI interface. The occupancy number is contained in a read-only register.
If a write is attempted when the FIFO is full, an acknowledgment is given along with a
generated error signal. Interrupts associated with the transmit FIFO include:
The receive FIFO is read-only. When data is read from the FIFO, the occupancy number is
decremented and when a SPI transfer is completed, the number is incremented. If a read is
attempted when the FIFO is empty, acknowledgment is given along with a generated error
signal. When the receive FIFO becomes full, the receive FIFO full interrupt is generated.
Data is automatically written to the FIFO from the SPI module shift register after the
completion of a SPI transfer. If the receive FIFO is full and more data is received, a receive
FIFO overflow interrupt is issued. When this occurs, all attempts to write data to the full
receive FIFO by the SPI module are lost.
When the AXI Quad SPI core is configured with FIFOs, SPI transfers can be started in two
different ways depending on when the enable bit in the SPICR is set. If the enable bit is set
prior to the first data being loaded in the FIFO, the SPI transfer begins immediately after the
write to the master transmit FIFO. If the FIFO is emptied using SPI transfers before
additional elements are written to the transmit FIFO, an interrupt is asserted. When the AXI
to SPI SCK frequency ratio is sufficiently small, this scenario is highly probable.
Alternatively, the FIFO can be loaded with up to 16 or 256 elements and then the enable bit
can be set, which starts the SPI transfer. In this case, an interrupt is issued after all elements
are transferred. In all cases, more data can be written to the transmit FIFOs to increase the
number of elements transferred before emptying the FIFOs.
A similar error detection mechanism has been implemented for SPI slave devices. The
detected error occurs when a SPI device configured as a slave, but not enabled, is selected
(that is, its SS bit is asserted) by another SPI device. When this condition is detected, IPISR
bit 1 is set by a strobe to the IPISR register.
Underrun and overrun condition error detection is also provided. Underrun conditions can
happen only when operated in slave mode. This condition occurs when a master commands
a transfer, but the slave does not have data in the transmit register or FIFO to transfer. In
this case, the slave underrun interrupt is asserted and the slave shift register is loaded with
all zeros for transmission. An overrun condition can occur to both master and slave devices
where a transfer occurs when the receive register or FIFO is full. During an overrun
condition, the data received in that transfer is not registered (it is lost) and the IPISR
overrun interrupt bit 5 is asserted.
All incoming signals are synchronized to the AXI clock when the Frequency Ratio parameter
is greater than 4. Because of the tight timing requirements when the Frequency Ratio
parameter is set to 4, the incoming SCK clock signal and its synchronized signals are used
directly in the internal logic. Therefore, the external clock must be synchronized with the
AXI clock when the Frequency Ratio parameter is 4. For other Frequency Ratio parameter
values, it is preferred, but might not be necessary to have such synchronization.
RECOMMENDED: In slave mode operation, use the FIFO by setting FIFO Depth to 16 or 256 in standard
SPI mode.
In slave mode, two interrupts are available in addition to the other interrupts in the IPISR:
• DRR_Not_Empty (bit 8)
• Slave_Mode_Select (bit 7)
Before the other SPI master starts communication, it is mandatory to fill the slave core
transmit FIFO with the required data beats. When the master starts communication, with the
core configured in slave mode, the core transfers data till the data is available in its transmit
FIFO. At the end of last data beat transmitted from the slave FIFO, the core (in slave mode)
generates the DTR empty signal to notify that new data beats need to be filled in its
transmit FIFO before further communication can start.
See the answer records or the device user guide to understand more about the functionality
and use of the STARTUPEn primitive.
• Master mode
• STARTUP enabled
• SPI mode is QUAD
• Number of slaves is 2
When this parameter is enabled, the IP core has two SPI interfaces. IP is connected to two
flashes/SPI slave devices as shown in Figure 3-2.
lo*_i
Flash1
MUX
QSPI Logic
lo*_0
SPISR
lo*_1_i
DEMUX
Flash2
lo*_1_0
AXI QUAD SPI
;
This mode is set whether or not Enable Performance Mode is selected and when it is,
Enable XIP Mode is not selected. The AXI Quad SPI core supports Winbond, Micron,
Spansion and Macronix memories. Check the commands if different memories must be
tested with the core. If the commands, address, and data behavior are the same for a
different memory, that device can be chosen as the base memory to test the core.
The core understands the commands and its expected behavior for the targeted memory
through internal logic. The commands which are not supported by the Winbond, Micron,
Macronix, and Spansion memory device mentioned in the data sheet are marked with a
command error. After the command error is set, the core does not execute the SPI
transaction for that command and a command error interrupt is generated. After the
command phase, if there is an address phase included, the next DTR contents are
transferred on a SPI transaction in the modes defined by the address mode bits. If the data
phase is present for the particular command, the data phase is executed based on read or
write, with the modes set by the data mode bits.
The dummy bytes, which are required in some of the instructions for the selected memory,
should be part of the SPI DTR along with the number of bytes intended to read from
memory. For more information on the number of dummy bytes needed for a particular
instruction, consult the data sheet for the targeted memory.
For read commands, after the transmission of the address bits, the core immediately reverts
to input mode and starts storing data in the DRR. Therefore, be aware of how many dummy
bytes are to be ignored in the DRR. For example, for the fast read dual output command in
Winbond memory, the DTR should be filled with one command byte plus three address
bytes plus two dummy bytes for the dummy cycles plus the number of dummy bytes to be
read from memory. The command and address are transferred in standard SPI mode, after
which the core reverts to the input mode and starts storing the data. The data is transferred
on the IO0_I and IO_1 lines and stored in the SPI DRR, which includes the two dummy
cycles plus valid data. Therefore, while reading the SPI DRR, ignore the first 6 bytes of the
SPI DRR. The valid data available in the FIFO begins with the seventh byte. This also applies
to other dual or quad read commands.
For each fresh transaction, the SPI DTR FIFO must be cleared. The first entry in the SPI DTR
is always considered the command entry, which is cross-checked against built-in logic for
the respective memory in the selected SPI mode.
When Enable Performance Mode and Enable XIP Mode are both selected, the core
supports standard, dual and quad modes:
• Standard mode is set with Mode as Standard and Slave Device as Winbond, Micron,
Macronix, or Spansion.
• Dual mode is set with Mode is Dual and Slave Device is Winbond, Micron, Macronix,
or Spansion.
• Quad mode is set with Mode is Quad and Slave Device is Winbond, Micron,
Macronix, or Spansion.
Winbond Memory
Before executing the DIOFR (0xBBh) or QIOFR (0xEBh), the core executes the high
performance mode command on each power-on reset state. This ensures that the Winbond
memory is configured in high-performance mode.
IMPORTANT: When quad mode is set, the Winbond memory must be pre-configured by writing to the
status register to set the QE bit to 1.
It is your responsibility to pre-configure the memory. The core does not write anything to
the status register. The core assumes that this exercise is completed previously in XIP mode.
When the core is configured in dual or quad mode prior to executing the DIOFR or QIOFR
commands, the core performs the high performance command write to the memory on
POR before accepting the transaction on the AXI4 interface. The HPM command requires
one command and three dummy SPI cycles. This writing of the HPM command in memory
is performed only at the power-on condition. The memory is now placed in high
performance mode (HPM — 0xA3h) and allows DIOFR or QIOFR to operate in their
respective modes.
Micron Memory
In Micron memory, the volatile as well as nonvolatile configuration registers are left with
the default configuration of dummy cycles. That is, VCR[7:4] and NVCR[15:12] are set to
1111. The core behavior is based on this assumption only and if these dummy cycle register
values are changed, the core behavior is not guaranteed.
RECOMMENDED: Do not change the default Volatile Configuration Register (VCR) and Non Volatile
Configuration Register (NVCR) configuration.
At the start of each new transaction, the core sends the respective command, address and
required dummy cycles and then receives data.
Spansion Memory
It is your responsibility to pre-configure the Spansion memory. The core does not write
anything to the status register. The core assumes that this exercise is completed previously
in XIP mode.
IMPORTANT: When quad mode is set, the Spansion memory must be pre-configured by writing to the
configuration register to set the QUAD bit to 1.
Macronix Memory
In Macronix memory, the configuration register handles the dummy cycle information.
Configuration of dummy cycle numbers is different depending on the bit6 & bit7 (DC0 &
DC1) setting in the configuration register. By Default, the values of bit6 and bit 7 are 00.
Macronix data sheet provides information on dummy cycle for varying the DC0 and DC1.
Note: For more details, refer “Dummy Cycle and Frequency Table (MHz)" Table in Macronix data
sheet MX66U1G45G.
Also, in mixed mode, the volatile configuration register of the Micron device is not
supported as this command is not present in the Winbond device. See Following are the
unsupported Commands for Dual/Quad SPI Mode across different memories of Winbond,
Micron, Spansion, and Macronix. for a list of unsupported commands.
Table 3-1: Supported Commands in Dual SPI and Mixed Memory Mode
Opcode (Hex) Command Description
01 Write status register
02 Page program
03 Read data bytes
04 Write disable
05 Read status register
06 Write enable
4B Read One Time Programmable (OTP) (Read of OTP area)
75 Program/erase suspend
7A Program/erase resume
9F Read identification ID
C7 Bulk erase
D8 Sector erase
command is not present in the Winbond device. See Following are the unsupported
Commands for Dual/Quad SPI Mode across different memories of Winbond, Micron,
Spansion, and Macronix. for a list of unsupported commands.
Table 3-2: Supported Commands in Quad Mode and Mixed Mode Memory
Opcode (Hex) Command Description
01 Write status register
02 Page program
03 Read data bytes
04 Write disable
05 Read status register
06 Write enable
32 Quad IP page program
C7 Bulk erase
75 Erase suspend
7A Erase resume
4B Read unique ID number
9F Read JEDEC® ID number
D8 Sector erase
BB Fast read dual I/O(similar to (3Bh) ,but Yes Yes Yes Yes
with the capability to input the
Address bits (A23-0) two bits per
clock)
6B Fast read quad output(fast read 4 Yes Yes Yes Yes
lines)
EB Fast read quad I/O(similar to (3Bh) Yes Yes Yes Yes
,but with the capability to input the
Address bits (A23-0) 4 bits per clock.,)
06 WEN(write enable sets the Write Yes Yes Yes Yes
Enable Latch (WEL) bit in the Status
Register to a 1. The WEL bit must be
set prior to every Page Program,
Sector Erase, Block Erase, Chip Erase
and Write Status Register instruction.)
WRITE ENABLE in Numonyx / in
Macronix
04 Write disable(sets WEL to 0) Yes Yes Yes Yes
02 Page program(The Page Program Yes Yes Yes Yes
instruction allows from one byte to
256 bytes (a page) of data to be
programmed at previously erased
(FFh) memory locations)
32 Quad page program(page program Yes Yes Yes No
with 4 pins)
D8 Block erase(The Block Erase Yes Yes Yes Yes
instruction sets all memory within a
specified block (64K-bytes) to the
erased state of all 1s (FFh) / SECTOR
ERASE in Numonyx
01 Write status register(Only Yes Yes Yes Yes
Non-volatile Status Register bits
SRP0, SEC, TB, BP2, BP1, BP0 (bits 7, 5,
4, 3, 2 of Status Register-1) and QE,
SRP1(bits 9 and 8 of Status Register-2)
can be written to.)
03 Read data(The Read Data instruction Yes Yes Yes Yes
allows one more data bytes to be
sequentially read from the memory.)
05 Read SR-1(The Read Status Register Yes Yes Yes Yes
instructions allow the 8-bit Status
Registers to be read.)
E3 PPB program octal word read quad I/ Yes Yes Yes Yes
O (for windbond). The Octal Word
Read Quad I/O (E3h) instruction is
similar to the Fast Read Quad I/O
(EBh) instruction except that the lower
four address bits (A0, A1, A2, A3) must
equal 0. As a result, the four dummy
clocks are not required, which further
reduces the instruction overhead
allowing even faster random access
for code execution (XIP). / Write
NonVolatile Lock Bits in Numonyx
Following are the unsupported Commands for Dual/Quad SPI Mode across different
memories of Winbond, Micron, Spansion, and Macronix.
• Release power down/high performance mode (ABh): This command supports release
power down/high performance mode or reading the device ID with a different
combination of dummy bytes. The core only supports release power down/high
performance-mode where only one command byte is required to be placed in the DTR.
The other mode of the command is not supported, as there is another command (90h)
to read the device ID.
• XIP mode or continuous read mode in all the memories is not supported in Legacy or
enhanced mode.
• All commands in dual or quad mode are supported in extended SPI mode. Dual In Out
(DIO) and Quad In Out (QIO) modes are not supported. Following are the commands
that are not supported by core:
• All the double data rate (DDR) commands are not supported in any mode of the core.
• Spansion Flash supports 32-bit addressing mode with 24-bit address commands
provided the ExtAddr bit is set to 1. This feature is not supported by the core.
• Autoboot commands of Spansion Flash are not supported by the core in any mode.
• All commands in dual or quad mode are supported in extended SPI mode.
• Dual In Out (DIO) and Quad In Out (QIO) modes are not supported.
The clock phase (CPHA) bit can be set to select one of two different transfer formats. If
CPHA is 0, data is valid on the first SCK edge (rising or falling) after SS(N) has been
asserted. If CPHA is 1, data is valid on the second SCK edge (rising or falling) after SS(N)
has asserted.
IMPORTANT: For successful transfers, the clock phase and polarity must be identical to those of the
master SPI device and the selected slave device.
The first SCK cycle begins with a transition of the SCK signal from its idle state, which
denotes the start of the data transfer. Because the clock transition from idle denotes the
start of a transfer, the M68HC11 specification notes that the SS(N) line can remain
active-Low between successive transfers. The specification states that this format is useful
in systems with a single master and single slave. In the context of the M68HC11
specification, transmit data is placed directly in the shift register on a write to the transmit
register. Consequently, it is your responsibility to ensure that the data is properly loaded
into the SPISSR register prior to the first SCK edge.
The SS signal is toggled for all CPHA configurations and there is no support for SPISEL
being held Low. It is required that all SS signals be routed between SPI devices internally to
the FPGA. Toggling the SS signal reduces FPGA resources.
Resets
The core supports active-Low reset input from the AXI interface in all configuration modes.
External reset must be synchronous to the AXI clock. The core also supports the internal
reset register which generates a local reset signal to the core causing all registers to obtain
default settings on each bit.
Protocol Description
For the SPI protocol description, see the Motorola M68HC11-Rev. 4.0 Reference Manual
[Ref 10].
For the AXI protocol description, see the AMBA® AXI4-Stream Protocol Specification [Ref 4].
Mode = Dual
The core is configured to support dual and standard mode SPI commands. The
configuration modes and their behavior are described in these sections:
In this mode, it is assumed that there is more than one SPI slave device. As the core
supports only Winbond and Micron memories, the slave must be one of these two devices.
This is considered to be a mixed memories mode where Winbond memories are taken as
the base for defining the behavior of the core. The instructions which are common to
Winbond, Micron and Spansion memories (from the extended SPI protocol instructions set)
are supported. Table 3-4 shows the core behavior.
Table 3-4: SPI Command Core Behavior for Dual Mode and Mixed Mode Memories
Micron/ Command
Command Type Winbond Spansion Error Core Behavior
Table 3-4: SPI Command Core Behavior for Dual Mode and Mixed Mode Memories (Cont’d)
Notes:
1. Slave Device = Mixed is mixed memory mode. For Mode = Dual, the dual as well as standard SPI commands are
supported. For each command, the Winbond memory base behavior is used as the default operating mode. For
the commands supported only by Micron or Spansion. the command error flag is set and the command is not
executed. In this mode, the command set in common with Winbond and Micron memories is supported.
This is a dedicated mode and supports only Winbond memories as SPI slave devices. Most
of the Winbond memory SPI commands are supported. Table 3-5 shows the core behavior.
Notes:
1. The core is designed to support Winbond W25Q64BV memory. See the device data sheet for the command,
address, dummy bytes and data bytes required for each command and for the command, address and data bits
operating details.
This is a dedicated mode and supports only Micron memories as SPI slave devices. The core
supports most of the dual and standard Micron memory SPI commands. Table 3-6 shows
the core behavior.
Table 3-6: SPI Command Core Behavior for Dual Mode and Micron Memory
Command Command
Micron Memory Core Behavior
Type Error
Standard SPI Supported No Standard format
Standard SPI Not supported Yes No SPI transaction
Dual mode Supported No Dual mode instruction format as given in the data sheet
Dual mode Not supported Yes No SPI transaction
Quad mode Supported Yes No SPI transaction
Table 3-6: SPI Command Core Behavior for Dual Mode and Micron Memory (Cont’d)
Command Micron Memory Command Core Behavior
Type Error
Quad mode Not supported Yes No SPI transaction
Notes:
1. The core is designed to support the Micron N25Q256-3V memory in this mode for all dual and standard mode
commands. See the device data sheet for the command, address, dummy bytes and data bytes required for each
command and for the command, address and data bits operating details.
This is a dedicated mode and supports only Spansion memories as SPI slave devices. The
core supports most of the dual and standard Spansion memory SPI commands. Table 3-7
shows the core behavior.
Table 3-7: SPI Command Core Behavior for Dual Mode and Spansion Memory
Command Spansion Command
Type Memory Error Core Behavior
Notes:
1. The core is designed to support the Spansion S70FL01GS memory in this mode for all dual and standard mode
commands. See the device data sheet for the command, address, dummy bytes and data bytes required for each
command and for the command, address and data bits operating details.
Mode = Quad
The core is configured to support quad, dual and standard mode SPI commands based on
the type of memory used as a SPI slave. The configuration modes and their behavior are
described in these sections:
In this mode, it is assumed that there is more than one SPI slave device. As the core
supports only the Winbond, Micron, and Spansion memories, the slave must be one of
these three devices.
This is a mixed memories mode where Winbond memories are taken as the base for
defining the behavior of the core. Most of the instructions which are common to Winbond,
Micron, and Spansion memories (extended SPI commands) are supported. Table 3-8 shows
the core behavior.
Table 3-8: SPI Command Core Behavior for Quad Mode and Mixed Mode Memories
Micron/ Command
Command Type Winbond Spansion Error Core Behavior
Notes:
1. Slave Device = Mixed is mixed memory mode. In Mode = Quad, the quad, dual and standard SPI commands are
supported. For each command, the Winbond memory base behavior is taken as the default operating mode. For
commands supported only by Micron or Spansion, the command error flag is set and the command is not
executed. In this mode, the command set in common with Winbond and Micron memories is supported.
This is a dedicated mode and supports only Winbond memories as SPI slave devices. Most
of the Winbond W25Q64BV memories SPI commands are supported. Table 3-9 shows the
generalized core behavior.
Table 3-9: SPI Command Core Behavior for Dual Mode and Winbond Memory
Command Command
Type Winbond Error Core Behavior
Notes:
1. The core is designed to support the Winbond W25Q64BV memory. See the device data sheet for the command,
address, dummy bytes and data bytes required for each command and for the command, address and data bits
operating details.
This is a dedicated mode and supports only Micron memories as SPI slave devices. The core
supports most of the Micron N25Q256-3V memory quad, dual, and standard SPI
commands. Table 3-10 shows the core behavior.
Table 3-10: SPI Command Core Behavior for Dual Mode and Micron Memory
Command Command
Type Micron Error Core Behavior
Notes:
1. The core is designed to support the Micron N25Q256-3V memory device in this mode for all quad, dual and
standard commands. See the device data sheet for the command, address, dummy bytes and data bytes
requirements for each command and for the command, address and data bits operating details.
This is a dedicated mode and supports only Spansion memories as SPI slave devices. The
core supports most of the Spansion S70FL01GS memory quad, dual, and standard SPI
commands.
Table 3-11: SPI Command Core Behavior for Dual Mode and Spansion Memory
Notes:
1. The core is designed to support the Spansion S70FL01GS memory device in this mode for all quad, dual and
standard commands. See the device data sheet for the command, address, dummy bytes and data bytes
requirements for each command and for the command, address and data bits operating details.
In XIP mode, the core supports 24-bit addressing mode as the common mode across
Winbond, Micron, and Spansion devices, while for Micron and Spansion memories the core
also supports 32-bit address mode. In 32-bit addressing mode of IP, flash must be
configured in 32 bit mode. For the supported command set corresponding flash data sheet
can be referred. The 24-bit addressing is applicable to both Winbond and Micron memories
with the core in Standard, Dual, and Quad modes.
In this mode, the AXI4-Lite interface is first used to configure the core with the proper CPOL
and CPHA modes. The valid modes are 00 and 11. Any other combination causes the core to
not accept the AXI4 transaction. The AXI4-Lite interface is only used to set the
configuration register and read the status register. The AXI4 interface is used to read the
data from memory with the address provided by the AXI4 interface. The read channel of the
AXI4 interface should provide the starting address which is converted by the core to the SPI
transactions at the SPI interface. The operating mode of the core is set using Mode while
the targeted memory is selected based on the Slave Device setting. In this case, a single
memory is targeted and multiple memories are not supported by the core. The target
memory can be any from Winbond, Micron, or Spansion or any other memory which
supports the default three read commands. The maximum burst length for read transaction
on AXI4 interface in this mode is 64 as the FIFO depth is 64. The core behavior is not
guaranteed otherwise.
The default commands are fast read (0x0Bh), fast read dual I/O (0xBBh) and fast read quad
I/O (0xEBh). Based on the setting of Mode, the same command is used throughout the
operation. The command cannot be changed as it is generated internally by the core.
The core has internal reference logic, which pads the dummy bytes required for the
particular read command.
The XIP mode of core operation is based on the Winbond, Micron, and Spansion memory
data sheet specification for read command behavior.
The core uses the ext_spi_clk as the reference clock for the SPI logic. This clock is
separate from the AXI4 interface clock and it should be double the desired SPI frequency at
the SPI interface. The core uses a Frequency Ratio setting of 2, which is fixed for this mode,
for generating the SPI clock at the SPI interface with reference to this clock. There is no soft
reset register or interrupt register associated with XIP mode. The only way to reset the core
is to reset the interconnect.
In this mode, the core supports WRAP as well as INCR type AXI4 transactions only. The
FIXED transaction results in an error and the core does not accept the transaction. Instead,
the transaction error flag is set in the XIP status register. In this case, the targeted memory
is Winbond or Spansion and if the core is configured in quad mode, ensure that the QE bit
of the status register of the Winbond memory or the QE bit of the configuration register of
the Spansion memory is set prior to the booting the core from SPI flash memory. This
should be performed using external programming tools.
SPI Master Device with/without FIFOs and Slave Select Vector Asserted
Manually Using SPICR Bit 7
This flow permits the transfer of N number of byte/half-word/word elements with a single
toggling of the slave select vector. This is the default mode of operation. Use these steps to
successfully complete the SPI transaction:
of SCK, and for all other modes, it is two ext_spi_clk cycles after the falling edge of SCK. Also
there are no idle cycles between each new SPI transaction.
13. Repeat step 10 through step 12 until all data is transferred.
14. Write all ones to the SPISSR register or exit the manual slave select assert mode to
deassert the SS vector while SCK and IO0 are in the idle state.
15. Disable devices as required.
SPI Master and Slave Devices without FIFOs Performing One 8-bit/16-bit/
32-bit Transfer (Optional Mode)
Use these steps to successfully complete a SPI transaction:
SPI Master and Slave Devices where Registers/FIFOs are Filled Before the SPI
Transfer Begins and Multiple Discrete 8-bit Transfers are Performed
(Optional Mode)
The slave operation of the core supports a FIXED burst at the transmit or receive FIFO only.
The length of this burst transaction should be based on the FIFO Depth parameter as well
as the transmit or receive occupancy register. Take note of this to avoid any overrun or
underrun errors of the DTR or DRR FIFO.
2. Configure the master DGIER and IPIER registers. Also configure the slave DGIER and
IPIER registers as required.
3. Write configuration data to the master SPI device SPICR register as required.
4. Write configuration data to the slave SPI device SPICR register as required.
5. Write the active-Low, one-hot encoded slave select address to the master SPISSR
register.
6. Write all data to the slave SPI DTR register/FIFO as required.
7. Write all data to the master SPI DTR register/FIFO.
8. Write the enable bit to the master SPICR register which starts the transfer.
9. Wait for interrupt (typically IPISR bit 4) or poll status for completion.
10. Read the IPISR register of both master and slave SPI devices as required.
11. Perform interrupt requests as required.
12. Read the SPISR register of both master and slave SPI devices as required.
13. Perform actions as required or dictated by SPISR register data.
SPI Master and Slave Devices with FIFOs Where Some Initial Data is Written
to FIFOs, the SPI Transfer is Started, Data is Written to the FIFOs as Fast or
Faster than the SPI Transfer and Multiple Discrete 8-bit Transfers are
Performed (Optional Mode).
Use these steps to successfully complete a SPI transaction:
The sequence flow to operate the core in dual mode from the core point of view is shown.
Check the inter-dependency of the commands before filling the SPI DTR register and
enabling the SPI core to start the transaction.
1. Ensure that Mode is Dual and that Slave Device is set for the correct SPI slave memory.
2. Ensure that the instructions driven by the required SPI clock and set by Frequency
Ratio, are listed.
3. Set the FIFO Depth parameter. This parameter can either be 16 or 256.
4. Write to the soft reset register to reset the core. This reset is active for 16 AXI cycles,
during which each FIFO register is in the reset state.
5. Write to the SPICR register to put the core in master mode; set the CPOL, CPHA values,
and make sure that the master transaction inhibit bit is set.
6. Write to the IPIER and IPISR registers to enable the required interrupts.
7. Write to the SPI DTR with the command, address, dummy, and data bytes to be
transmitted in the same sequence provided in the data sheet of the target device.
8. Write to the SPI DTR with the number of data bytes intended to be read or written to
memory along with command, address, and dummy bytes.
9. Write to the SPISSR register to assert the chip select signal from the core.
10. Write to the SPICR register to enable the master transaction inhibit bit, so that the core
starts the SPI clock.
11. For a write, wait until the DTR empty interrupt is generated.
12. When the DTR empty interrupt is generated, data can still be written into the SPI DTR for
further transactions if the slave select register remains unchanged (such as if the slave is
selected).
13. If further data is written, the SPISSR register continues to be asserted; only the SPI clock
is stopped. When the DTR FIFO is not empty, the SPI clock is enabled again and data is
transmitted.
14. When reading, step 11, step 12, and step 13 also apply. Fill the DTR FIFO with any
random data beats while reading the SPI slave memory.
15. Disabling the selected slave by setting all SPISSR register bits to 1 (or carrying out the
master transactions inhibit bit set to 1 in the SPICR register), the SPI clock is stopped.
16. After disabling the selected slave by setting all SPISSR register bits to 1, If the SPI DTR
FIFO is filled again, the core considers this a fresh transaction and compares the first
entry in the DTR FIFO with the supported commands.
17. Between new transactions, make sure that the SPI DTR and DRR FIFOs are reset by
writing into the SPICR register bits while the slave is deselected. This allows these two
FIFOs to be reset and the first entry of the DTR FIFO to be compared with the supported
commands.
Note: Core will support both the approaches of writing all at a time to the DTR (After Master inhibit
set, Write all (Command,Address, Data) to the DTR then, Resetting the Master inhibit as mentioned
in (step 7)) and writing one at a time to the DTR (After Master inhibit set, Write command to the SPI
DTR , and then reset the inhibit, and similarly repeat the above procedure for Address,Data).
Always check the supported and unsupported command list for the Winbond, Micron, and
Spansion memories (unsupported commands for dual/quad SPI Mode and Winbond,
Micron, or Spansion memory). If unsupported commands are executed, the core behavior is
not guaranteed. An interrupt is set to indicate a command error, which means that the
command does not match any of the supported commands in the core. The core in Dual/
Quad mode always sends the command phase of the SPI transaction on a single line i.e.,
IO0_* ports. 2-2-2 and 4-4-4 (Command, address, and data) SPI modes are not supported in
Dual/Quad SPI Configuration of the core.
Transfer Formats
In Standard SPI mode CPHA - CPOL, any one of the 00, 01, 10, or 11 modes are allowed.
In dual or quad SPI mode CPHA - CPOL, only 00 or 11 modes are allowed. If any other
modes are set in the SPICR, an interrupt is set indicating the error and the core does not
perform as expected.
SCK
Dt(0) Dt(1) Dt(2) Dt(3) Dt(4) Dt(5) Dt(6) Dt(7)
IO1 (MISO) Dr(0) Dr(1) Dr(2) Dr(3) Dr(4) Dr(5) Dr(6) Dr(7) **
SS
SPISEL
Legend:
A0: Address of Transmit_Data Register
Dt: Transmitted Data
Dr: Received Data
SCK is shown for CPOL = 0
**: Not defined, but normally MSB of character just received
IO0 (MOSI) X14434
Figure 3-3: Data Write-Read Cycle on SPI Bus with CPHA = 0 and SPICR(7) = 0 for 8-bit Data
Signal SCK remains in the idle state until one-half period following the assertion of the
slave select line which denotes the start of a transaction. Because assertion of the SS(N)
line denotes the start of a transfer, it must be deasserted and re-asserted for sequential
element transfers to the same slave device.
One bit of data is transferred per SCK clock period. Data is shifted on one edge of SCK and
is sampled on the opposite edge when the data is stable. Consistent with the M68HC11 SPI
specification, selection of clock polarity and a choice of two different clocking protocols on
an 8/16/32-bit oriented data transfer is possible using bits in the SPICR.
The IO0 pin is equivalent to IO0 (MOSI) in standard SPI mode. The IO1 pin is equivalent to
IO1 (MISO) in standard SPI mode.
The IO0 and IO1 ports behave differently depending on whether the SPI device is
configured as a master or a slave. When configured as a master, the IO0 port is a serial data
output port, while the IO1 is a serial data input port. The opposite is true when the device
is configured as a slave; the IO1 port is a slave serial data output port and the IO0 is a serial
data input port. There can be only one master and one slave transmitting data at any given
time. The bus architecture provides limited contention error detection (that is, multiple
devices driving the shared IO1 and IO0 signals) and requires the software to provide
arbitration to prevent possible contention errors.
All SCK, IO0, and IO1 pins of all devices are hard-wired together. For all transactions, a
single SPI device is configured as a master and all other SPI devices on the SPI bus are
configured as slaves.
The single master drives the SCK and IO0 pins to the SCK and IO0 pins of the slaves. The
uniquely-selected slave device drives data from its IO1 pin to the IO1 master pin, thus
realizing full-duplex communication.
The Nth bit of the SS(N) signal selects the Nth SPI slave with an active-Low signal. All other
slave devices ignore both SCK and IO0 signals. In addition, the non-selected slaves (that is,
SS pin High) drive their IO1 pin to 3-state so as not to interfere with SPI bus activities.
When external slave SPI devices are implemented, the SCK, IO0 and IO1, as well as the
needed SS(N) signals, are brought out to pins. All signals are true 3-state bus signals and
erroneous external bus activity can corrupt internal transfers when both internal and
external devices are present.
Ensure that the external pull-up or pull-down of external SPI 3-state signals are consistent
with the sink/source capability of the FPGA I/O drivers. The I/O drivers can be configured
for different drive strengths, as well as internal pull-ups. The 3-state signals for multiple
external slaves can be implemented per the system design requirements, but the external
bus must follow the SPI M68HC11 specifications.
SCK
IO0 (MOSI) Dt(0) Dt(1) Dt(2) Dt(3) Dt(4) Dt(5) Dt(6) Dt(7)
IO1 (MISO) ** Dr(0) Dr(1) Dr(2) Dr(3) Dr(4) Dr(5) Dr(6) Dr(7)
SS
SPISEL
Legend:
AO: Address of Transmit_Data Register
Dt: Transmitted Data
Dr: Received Data
SCK is shown for CPOL = 0
**: Not defined, but normally MSB of character just received
x14435
Figure 3-4: Data Write-Read Cycle on SPI Bus with CPHA = 1 and SPICR(7) = 0 for 8-bit Data
This configuration mode is provided to permit transfer of data with automatic toggling of
the slave select (SS) signal until all elements are transferred. In this mode, the data in the
SPISSR register appears on the SS(N) output when the new transfer starts. After every beat
of the SPI transaction (configured through Transaction Width in the Vivado Integrated
Design Environment (IDE)), the SS(N) output goes to 1. The data in the SPISSR register
again appears on the SS(N) output at the beginning of a new transfer. The slave select
signal does not need to be manually controlled. This mode is not supported in dual or quad
SPI modes in cores using the AXI4-Lite and AXI4 interfaces.
As described earlier, SCK must be stable before the assertion of slave select. Therefore,
when manual slave select mode is used, the SPI master must be enabled first (SPICR bit 7 =
1) to put SCK in the idle state prior to asserting slave select.
The master transfer inhibit (SPICR bit 8) can be used to inhibit master transactions until the
slave select is asserted manually and all FIFO data registers are initialized as required. This
can be used before the first transaction and after any transaction that is allowed to
complete.
When the preceding rules are followed, the timing is the same as presented for the
automatic slave select assertion mode, with the exception that you control the assertion of
the slave select signal and the number of elements transferred. While performing complete
memory read or page read operations, the manual slave select mode should be used.
As a slave, the processor considers a transfer to begin with the first SCK edge or the falling
edge of SS, depending on the CPHA format selected. When CPHA equals zero, the falling
edge of SS indicates the beginning of a transfer. When CPHA equals one, the first edge on
the SCK indicates the start of the transfer. In either CPHA format, a transfer can be aborted
by de-asserting the SS(N) signal, which causes the SPI slave logic and bit counters to be
reset. In this implementation, the software driver can deselect all slaves (that is, SS(N) is
driven High) to abort a transaction. Although the hardware is capable of changing slaves
during the middle of a single or burst transfer, the software should be designed to prevent
this.
In slave configuration, the data is transmitted from the SPI DTR register on the first AXI
rising clock edge following SS signal being asserted. The data should be available in the
register or FIFO. If data is not available, then the underrun interrupt is asserted.
When configured without FIFOs, the Rx_Full bit (1) in the SPISR is set to denote the end of
a transfer. When data is available in the SPI DRR register, bit 4 of the IPISR is asserted as
well. The data in the SPI DRR is sampled on the same clock edge as the assertion of the SPI
DRR register full interrupt.
When the SPI device is configured as a master without FIFOs, these steps occur:
• Rx_Empty bit (0), Tx_Full bit, and bit 3 in the SPISR are cleared.
• Tx_Empty bit (2), Rx_Full bit, and bit 1 in SPISR are set.
• DRR Full bit (4), Slave MODF bit, and bit 1 in the IPISR are set on the first rising AXI
clock edge after the end of the last SCK cycle.
Note: The end of the last SCK cycle is a transition on SCK for CPHA = 0, but is not denoted by
a transition on SCK for CPHA = 1 (see Figure 3-3 and Figure 3-4). However, the internal master
clock provides this SCK edge which prompts the setting and clearing of the bits noted.
In this design, a counter is implemented that permits the simultaneous setting of SPISR and
IPISR bits for both master and slave SPI devices. External SPI slave devices can use an
internal AXI clock that is asynchronous to the SCK clock. This can cause status bits in the
SPISR and IPISR to be inconsistent with each other. Therefore, the AXI Quad SPI core cannot
be used in a system with external SPI slave devices that do not use the AXI clock.
When the AXI Quad SPI core is configured with FIFOs and a series of consecutive SPI 8-bit/
16-bit/32-bit element transfers are performed (based on parameter settings), the SPISR bits
and IPISR do indicate completion of the first and the last SPI transfers with no indication of
intermediate transfers. The only way to monitor when intermediate transfers are completed
is to monitor the receive FIFO occupancy number. There is also an interrupt when the
transmit FIFO is half empty, bit 6 of IPISR.
When the SPI device is configured as a slave, the setting/clearing of the bits discussed
previously for a master coincides with the setting or clearing of the master bits for both
cases of CPHA = 0 and CPHA = 1. Keep in mind that for CPHA = 1 (that is, no SCK edge
denoting the end of the last clock period), the slave has no way of knowing when the end
of the last SCK period occurs, unless an AXI clock period counter was included in the SPI
slave device.
If you are customizing and generating the core in the Vivado IP integrator, see the Vivado
Design Suite User Guide: Designing IP Subsystems using IP Integrator (UG994) [Ref 5] for
detailed information. IP integrator might auto-compute certain configuration values when
validating or generating the design. To check whether the values do change, see the
description of the parameter in this chapter. To view the parameter value you can run the
validate_bd_design command in the Tcl Console.
You can customize the IP for use in your design by specifying values for the various
parameters associated with the IP core using the following steps:
For details, see the Vivado Design Suite User Guide: Designing with IP (UG896) [Ref 1] and
the Vivado Design Suite User Guide: Getting Started (UG910) [Ref 6].
Note: Figure in this chapter is an illustration of the Vivado IDE. This layout might vary from the
current version.
Figure 4-1 shows the AXI Quad SPI Vivado Integrated Design Environment (IDE) screen.
X-Ref Target - Figure 4-1
• Enable Performance Mode – Enables the AXI4 interface. Using the AXI4 interface also
enables the burst capability at the transmit and receive FIFO addresses of the core.
When this option is not selected, the AXI4-Lite interface is used.
SPI Options
• Mode – Selects standard, dual or quad mode. The correct mode is selected based on
the targeted SPI slave device and application.
• Transaction Width – Selects 8, 16, or 32-bit transactions. Each SPI transaction
incorporates the selected number of bits. In dual and quad SPI modes, the transaction
width is restricted to 8 bits. In XIP mode the transaction width is restricted to 8 in std,
dual and quad modes.
• Frequency Ratio – Selects a power of two divisor value from 2 to 2,048. The resulting
SPI clock frequency is the quotient of the frequency associated with the ext_spi_clk
signal divided by the selected value. In dual or quad SPI mode of the legacy and
enhanced mode, the divisor is restricted to 2. In XIP mode the frequency ratio is
restricted to 2 in std, dual and quad modes.
• No. of Slaves – Selects the number on non-XIP mode SPI slave devices from 1 to 32. In
XIP mode, the number of SPI slave devices is restricted to 1.
• Slave Device – Selects the dual or quad SPI mode slave device category from:
The slave device parameter is ignored in non XIP standard SPI mode. If SPI Mode is
selected as Dual/Quad then the slave device option will be visible in Vivado IDE.
Remaining Options
• Enable Master Mode – Enables master SPI mode when checked, slave SPI mode when
not checked. The enable master mode parameter is applicable only in standard SPI
mode. In dual or quad SPI mode, only master SPI mode is supported.
• Enable FIFO – Includes the transmit or receive FIFO in the design when checked, omits
the FIFO when not checked. The enable FIFO parameter is applicable only in standard
SPI mode. In dual or quad SPI mode, the FIFO is always included in the design.
• FIFO Depth – Selects the depth of the included FIFO from 0, 16 or 256 beats. In
standard SPI mode, this parameter is only available when the FIFO is included. In dual
or quad SPI mode, the FIFO depth is limited to either 16 or 256 beats. The FIFO width is
fixed at eight bits.
• Enable STARTUPEn Primitive – Includes the STARTUP primitive in the design when
checked, omits the primitive when not checked. The STARTUPE2 primitive is featured in
7 series FPGAs and the STARTUPE3 primitive is featured in UltraScale™ devices. It is
useful in sharing the SPI clock with an external SPI slave device. This primitive is always
disabled in the slave mode of the device.
• Enable Async Clock Mode – Enable this option only when the core is in standalone
mode and the AXI interface and external SPI clocks differ in terms of phase/polarity and
frequency. This option is disabled in the IP integrator. This parameter is auto
propagated depending on the clocks connected to the core. If the AXI clock and
ext_spi_clk are synchronous to each other, this parameter is set to 0, It is set to 1 if
they are asynchronous to each other.
• Enable Byte Level Interrupt -Enabling this parameter, the “DRR NOT Empty Interrupt”
will be triggered on the basis of Byte level instead of transaction level. By default, the
value will be set to “0” which means the “Interrupt” will be triggered with respect to the
transaction.
User Parameters
Table 4-1 shows the relationship between the fields in the Vivado IDE and the User
Parameters (which can be viewed in the Tcl Console).
Notes:
1. Share the unused startup Ports C_SHARED_STARTUP 0.
2. Use Startup internal to IP C_USE_STARTUP_INT 0.
Output Generation
For details, see the Vivado Design Suite User Guide: Designing with IP (UG896) [Ref 1].
Required Constraints
The system-level constraints mentioned in Constraining the IP section have to be added in
the top XDC files. The numbers mentioned are arbitrary values and update them according
to your design.
The STARTUPE2 primitive is used to drive the SCK on the CCLK pin and the STARTUPE3
primitive is used to drive the SCK and data pins.
When using the STARTUP primitive, the clock-data relationship changes due to the extra
delay added in the SCK path. This delay can vary from as low as 0.1 ns to as high as 7.5 ns
based on the device and speed grade. This value can be found in the FPGA data sheet.
Because this delay is not timed by the tool, you must consider the maximum delay for all
calculations. Assume this delay is called CCLK_DELAY. For K7-2 this value can range from
0.5 ns to 6.7ns. This puts the first restriction on the frequency of the clock. The frequency of
operation cannot exceed Fmax1 = (1/CCLK_DELAY) MHz
This means:
• The rising-edge of SCK must be between these two active edges of ext_spi_clk.
• The position of the rising-edge of SCK should be such that it meets the T setup and T hold
time of the SPI device.
• Tsetup analysis should be done by taking into account the minimum delay on SCK (that
is, the minimum delay of STARTUP), the maximum delay of the datapath, and the board
routing delay.
• Similarly Thold analysis should be done by taking into account the maximum delay on
SCK (that is, the maximum delay of STARTUP), the minimum delay of data, and the
board routing delay.
This requirement of the SPI device further brings down the operational frequency of the IP.
Based on this you obtain two numbers. F max that will break T su and F max that will break Th:
F max2 = fn {STARTUP delay min, max datapath, board routing delay, Tsu}
F max3 = fn {STARTUP delay max, min datapath, board routing delay, Th}
Read Operation
In SCK ratio = 2 scenarios, a successful read operation occurs when the SPI data, launched
on the falling-edge of SCK, is captured on the second rising-edge of ext_spi_clk. This
means that the data should be available and stable at the time the capture happens on the
second rising edge.
• SCK has max delay on the line (that is, Max delay of STARTUP)
• SPI drives the data with max Tco
Thus the actual F max is the one that is most restrictive amongst F max2, F max3 and F max4.
Constraining the IP
To understand how the constraints are added, it is important to understand the logic
structure around the clock and data in AXI Quad SPI flash memory.
CFG Logic
Fabric
DI[3:0]
Q D SPI Flash
CCLK
USRCCLK0
Clock D[03:00]
DO[3:0]
D Q
STARTUP
Note: Refer to UltraScale FPGA Post-Configuration Access of Parallel NOR Flash Memory using
STARTUPE3 (XAPP1282) [Ref 22].
Note: Refer to UltraScale FPGA Post-Configuration Access of SPI Flash Memory using STARTUPE3
(XAPP1280) [Ref 23].
The STARTUP primitive adds delay on the USRCCLKO to the CCLK pin. This delay is
unaccounted for in the tool and is not considered in the timing calculation. For the tool, the
timing path ends at USRCCLKO.
To obtain the required constraints you must account for the STARTUP primitive delay. As the
timing path ends at USRCCLKO, you cannot create a clock on the CCLK pin.
To emulate the SCK clock, you must create a generated clock such that the STARTUP
primitive delay is taken into account. This can be achieved by creating a generated clock on
the USRCCLKO pin.
This takes into account the delay of the flip-flop that generates the SCK, the routing delay
from that flip-flop to USRCCLKO pin, and the STARTUP primitive delay. Further, to reduce
the delay on SCK you must ensure that the delay from the flip-flop to USRCCLKO is as low
as possible. This can be constrained by using set_max_delay.
2. STARTUPE3 (UltraScale+) primitive included inside IP: Vivado times the STARTUPE3
differently for UltraScale+ devices. For the purpose of timing the STARTUPE3, certain
internal pins have been modeled which can be used to time the primitive. Below lines
show the set of constraints that can be used with UltraScale+ devices.
set tdata_trace_delay_max 0.25
set tdata_trace_delay_min 0.25
set tclk_trace_delay_max 0.2
set tclk_trace_delay_min 0.2
create_generated_clock -name clk_sck -source [get_pins -hierarchical
*axi_quad_spi_0/ext_spi_clk] [get_pins -hierarchical */CCLK] -edges {3 5 7}
set_input_delay -clock clk_sck -max [expr $tco_max + $tdata_trace_delay_max +
$tclk_trace_delay_max] [get_pins -hierarchical *STARTUP*/DATA_IN[*]] -clock_fall;
set_input_delay -clock clk_sck -min [expr $tco_min + $tdata_trace_delay_min +
$tclk_trace_delay_min] [get_pins -hierarchical *STARTUP*/DATA_IN[*]] -clock_fall;
set_multicycle_path 2 -setup -from clk_sck -to [get_clocks -of_objects [get_pins
-hierarchical */ext_spi_clk]]
set_multicycle_path 1 -hold -end -from clk_sck -to [get_clocks -of_objects [get_pins
-hierarchical */ext_spi_clk]]
set_output_delay -clock clk_sck -max [expr $tsu + $tdata_trace_delay_max -
$tclk_trace_delay_min] [get_pins -hierarchical *STARTUP*/DATA_OUT[*]];
set_output_delay -clock clk_sck -min [expr $tdata_trace_delay_min -$th -
$tclk_trace_delay_max] [get_pins -hierarchical *STARTUP*/DATA_OUT[*]];
set_multicycle_path 2 -setup -start -from [get_clocks -of_objects [get_pins
-hierarchical */ext_spi_clk]] -to clk_sck
set_multicycle_path 1 -hold -from [get_clocks -of_objects [get_pins -hierarchical */
ext_spi_clk]] -to clk_sck
set_max_delay -datapath_only -from [get_pins -hier {*STARTUP*_inst/DI[*]}] 1.000
set_max_delay -datapath_only -from [get_clocks -of_objects [get_pins -hierarchical
*/ext_spi_clk]] -to [get_pins -hier *STARTUP*_inst/USRCCLKO] 1.000
set_max_delay -datapath_only -from [get_clocks -of_objects [get_pins -hierarchical
*/ext_spi_clk]] -to [get_pins -hier *STARTUP*_inst/DO[*]] 1.000
Note: [1] Multi Cycle Path constraints may be removed or updated on getting any timing violations.
Note: [2] Regarding set_max_delay constraints, recent Vivado tool (From 2020.1 onwards) flow takes
care of adding set_max_delay constraints for US/US+. In this case, do not add explicit constraints
mentioned above and make sure to comment the set_max/min_delay constraints.
3. STARTUPE2 Enabled:
# this is to ensure min routing delay from SCK generation to STARTUP input
# User should change this value based on the results
# having more delay on this net reduces the Fmax
# Data is captured into FPGA on the second rising edge of ext_spi_clk after the SCK
falling edge
STARTUP is Disabled:
# Data is captured into FPGA on the second rising edge of ext_spi_clk after the SCK
falling edge
# Data is driven by the FPGA on every alternate rising_edge of ext_spi_clk
The SPI_1 ports are constrained the way shown in STARTUP is Disabled. The rest of the
constraints are taken from STARTUP3 is Enabled and based on the Ultrascale and Ultrascale
+ device family. In Ultrascale devices, the constraints file looks like the following:
Clock Frequencies
This section is not applicable for this IP core.
Clock Management
This section is not applicable for this IP core.
Clock Placement
This section is not applicable for this IP core.
Banking
This section is not applicable for this IP core.
Transceiver Placement
This section is not applicable for this IP core.
Simulation
For comprehensive information about Vivado Design Suite simulation components, as well
as information about using supported third-party tools, see the Vivado Design Suite User
Guide: Logic Simulation (UG900) [Ref 7].
For information about simulating the example design, see Simulating the Example Design
in Chapter 5.
IMPORTANT: For cores targeting 7 series FPGAs or Zynq-7000 devices, UNIFAST libraries are not
supported. Xilinx IP is tested and qualified with UNISIM libraries only.
For information about synthesizing and implementing the example design, see
Implementing the Example Design.
Example Design
This chapter contains information about the example design provided in the Vivado®
Design Suite.
Overview
The top module instantiates all components of the core and example design that are
needed to implement the design in hardware, as shown in Figure 1. This includes clock
generator (MMCME2), Register configuration module, Read data checker and Slave.
X-Ref Target - Figure 5-1
<Component_name>_exdes.vhd
TOP MODULE
Status
Clk_n
Clk_p Clock
Generator DUT
Reset
SPI Interface to
Slave
Register
Configuration
X13762
The example design demonstrates transactions of the AXI Quad SPI core in its different
configurations. It shows read and write transactions from the AXI Quad SPI to the slave
memory in different configured modes.
• Clock generator: The MMCME2 is used to generate the clock for the example design.
It generates a 200 MHz clock for the device under test (DUT) and other modules used
in the example design. The DUT of the example design is kept under reset until
MMCME2 is locked.
• Register configuration module: The AXI Traffic Generator is used for configuring the
internal registers of the DUT and other modules (see Standard SPI Mode Transactions,
page 76). After initial configuration of the registers sequence of data is sent to the AXI
Quad SPI as AXI transactions, the AXI Quad SPI core generates SPI transactions for the
same data and writes into the slave memory connected to it.
• Read data checker: The AXI Traffic Generator asks the AXI Quad SPI core to read the
data from the connected slave memory by generating the commands, and verifies the
correct data which is written previously is read.
• Slave: Memory models delivered mimic the behavior of Winbond, Micron, and
Spansion Flashes, and are used as slave memory to the AXI Quad SPI core when it is
configured in master mode.
In slave mode the AXI Quad SPI core is instantiated itself as a master internally to show the
slave behavior of the core.
IMPORTANT: The example design is not supported when the STARTUPEn block is enabled.
1. Right-click the core in the Hierarchy window, and select Open IP Example Design.
A new window pops up where you can specify a new directory name for the example
design, or keep the default directory.
A new project is created in the selected directory and is opened in a new Vivado
window.
2. In the Flow Navigator (left side pane), click Run Implementation and follow the
directions.
Table 5-2 shows the COE files generated for data transmission.
Notes:
1. The range from 1 to 3 as each file corresponds to a particular AXI Traffic Generator.
The example design has been verified on KC705 boards. Board constraints are also specified
in the exdes.xdc file but are commented out by default.
1. Configure the core using the Vivado Integrated Design Environment (IDE) in standalone
mode.
2. Implement the example design.
3. Generate the bitstream by selecting the implementation and generate the bitstream
option.
The status of the transaction, such as Done, is displayed on F16, while the E18 and G19 pins
indicate the AXI Traffic Generator core status. For more reference about these pins, refer to
the exdes_xdc.ttcl file. It might be necessary to use the exdes_xdc.ttcl file after
you uncomment the LOC constraints. For more information, see Checking Results,
page 108.
With the external memories targeted as slave SPI, the example design is not supported on
the board, but you can test the bitstream with the memory model on a given FPGA.
IMPORTANT: You must set the parameter combinations for checking the core behavior through Vivado
IDE options.
The built-in memory model is used as target slave. The memory model and core are
configured with the predefined command, address, and data. When the example design
simulations are enabled, both the model and the core exchange data.
The example design supports functional (behavioral) and post-synthesis simulations. For
information how to run simulation, see the Vivado Design Suite User Guide: Logic Simulation
(UG900) [Ref 7].
Simulation Results
The simulation script compiles the AXI Quad SPI example design, and supporting
simulation files. It then runs the simulation and checks that it completed successfully.
Test Hanged
Test Failed.
Note: [1] The WRITE ENABLE command must be issued before every write transaction (erase/write
data to the flash/register write of flash) command to the flash.
Note: [2] The following programming sequence is based on the 24-bit addressing mode of flash and
assumes there is only one slave connected to the AXI QUAD SPI core.
Test Bench
This chapter contains information about the test bench provided in the Vivado® Design
Suite.
Overview
Figure 6-1 shows test bench for the AXI Quad SPI example design. The top-level test bench
generates a 200 MHz clock and drives initial reset to the example design.
X-Ref Target - Figure 6-1
top_tb
clock_in
SPI Interface
to Slave
<componentname>_exdes.vhd
Slave Model
(top)
status
Test Status
done
X13763
Checking Results
The Quad SPI example design does not write much data into the slave device. It reads back
and compares the read data with the written data. The signal status is used to convey
information about the test case results.
01 - Test completed successfully. This means the read data matches with the written
data.
10 - Test failed. Read data does not match with the written data—data mismatch
• Status (9 downto 2) gives the index of MIF where the test stopped.
Note: The Done signal goes High after the test is complete.
Table A-1: Device Part Numbers Used for Verification and Validation
Device Validation Verification
Micron
N25Q256A33E No Yes
N25Q256A31E No Yes
N25Q256A13E No Yes
N25Q256A11E No Yes
N25Q032A13E No Yes
N25Q032A11E No Yes
N25Q256A83E No Yes
N25Q256A73E No Yes
N25Q128A11E No Yes
N25Q128A11B No Yes
N25Q128A13E No Yes
N25Q128A13B Yes Yes
Spansion
S25FL512S No Yes
S70FL01GS Yes Yes
Winbond
W25Q80BL No Yes
W25Q80BV No Yes
W25Q80BW No Yes
W25Q80DL No Yes
W25Q80DV No Yes
W25Q80EW No Yes
Table A-1: Device Part Numbers Used for Verification and Validation (Cont’d)
Device Validation Verification
W25Q80V No Yes
Notes:
1. See Migrating from Micron’s N25Q to Micron’s MT25 technical note [Ref 21], for compatibility of
Micron MT25Q devices with validated N25Q devices.
Upgrading
This appendix contains information about migrating a design from ISE® Design Suite to the
Vivado® Design Suite, and for upgrading to a more recent version of the IP core. For
customers upgrading in the Vivado Design Suite, important details (where applicable)
about any port changes and other impact to user logic are included.
There were several I/O ports added that are applicable only in dual quad mode. See
Table 2-2 on pages 21 and 22.
Debugging
This appendix includes details about resources available on the Xilinx Support website and
debugging tools.
Documentation
This product guide is the main document associated with the AXI Quad SPI core. This guide,
along with documentation related to all products that aid in the design process, can be
found on the Xilinx Support web page or by using the Xilinx Documentation Navigator.
Download the Xilinx Documentation Navigator from the Downloads page. For more
information about this tool and the features available, open the online help after
installation.
Answer Records
Answer Records include information about commonly encountered problems, helpful
information on how to resolve these problems, and any known issues with a Xilinx product.
Answer Records are created and maintained daily ensuring that users have access to the
most accurate information available.
Answer Records for this core are listed here, and can also be located by using the Search
Support box on the main Xilinx support web page. To maximize your search results, use
proper keywords such as
• Product name
• Tool messages
• Summary of the issue encountered
A filter search is available after results are returned to further target the results.
For the AXI Quad SPI Core Master Answer Record see Xilinx Answer 54408
Technical Support
Xilinx provides technical support at the Xilinx Support web page for this LogiCORE™ IP
product when used as described in the product documentation. Xilinx cannot guarantee
timing, functionality, or support if you do any of the following:
• Implement the solution in devices that are not defined in the documentation.
• Customize the solution beyond that allowed in the product documentation.
• Change any section of the design labeled DO NOT MODIFY.
To contact Xilinx Technical Support, navigate to the Xilinx Support web page.
The Vivado logic analyzer is used with the logic debug IP cores, including:
Several internal signal are marked as debug signals. These can be easily added to the logic
analyzer.
See the Vivado Design Suite User Guide: Programming and Debugging (UG908) [Ref 9].
Hardware Debug
Hardware issues can range from link bring-up to problems seen after hours of testing. This
section provides debug steps for common issues. The Vivado Design Suite debug feature is
a valuable resource to use in hardware debug.
1. Use the Vivado logic analyzer for hardware debug at the SPI interface.
2. Attach the logic analyzer ports on all SPI interface ports like SS, SCK, IO0, and IO1
(also, IO2, and IO3 if used in Quad mode).
3. Generate the transactions at the AXI interface, and observe whether or not the Slave
Select line is asserted, and whether or not the SPI clock is present.
4. Observe whether or not the data from the core provides sufficient setup and hold time.
Interface Debug
AXI4-Lite Interfaces
Read from a register that does not have all 0s as a default to verify that the interface is
functional. Output s_axi_arready asserts when the read address is valid, and output
s_axi_rvalid asserts when the read data/response is valid. If the interface is
unresponsive, ensure that the following conditions are met:
AXI4 Interfaces
The AXI Quad SPI core supports AXI4 interface in Enhanced mode and in XIP mode.
• In Enhanced mode, only FIXED AXI4 transactions are allowed for Data Transmit and Data
Receive FIFO locations. Any other AXI4 transaction is not allowed and core behavior is
not guaranteed.
• In XIP mode, all AXI4 transactions are allowed. It is recommended that you use 32-bit
AXI4 transactions. The following points cover further debug information.
Xilinx Resources
For support resources such as Answers, Documentation, Downloads, and Forums, see Xilinx
Support.
References
These documents provide supplemental material useful with this product guide:
18. Execute-in-Place (XIP) with AXI Quad SPI Using Vivado IP Integrator Application Note
(XAPP1176)
19. Throughput Performance Measurement Application Note (XAPP797)
20. Vivado Design Suite User Guide: Implementation (UG904)
21. Migrating from Micron’s N25Q to Micron’s MT25 technical note (TN-25-01)
22. UltraScale FPGA Post-Configuration Access of Parallel NOR Flash Memory using
STARTUPE3 (XAPP1282)
23. UltraScale FPGA Post-Configuration Access of SPI Flash Memory using STARTUPE3 (XAPP
1280)
Revision History
The following table shows the revision history for this document.