Aro 10 Catalog Piese Ro - Fr.eng.
Aro 10 Catalog Piese Ro - Fr.eng.
Peripheral Interface
(AXI SPI) (v1.02.a)
DS742 January 18, 2012 Product Specification
Copyright 20102012 Xilinx, Inc. XILINX, the Xilinx logo, Artix, ISE, Kintex, Spartan, Virtex, and other designated brands included herein are trademarks of Xilinx
in the United States and other countries. ARM is a registered trademark of ARM in the EU and other countries. The AMBA trademark is a registered trademark of ARM
Limited. All other trademarks are the property of their respective owners.
Functional Description
The top level block diagram for the Xilinx AXI SPI IP core is shown in Figure 1.
X-Ref Target - Figure 1
AXI SPI
SPI Module
(3)
Register BRG
Module
SPI
Status Register Ports
(SPISR)
SCK
Control Register MISO
(SPICR)
AXI4-Lite
Interrrupt Controller
Register Set
Notes:
1. The width of Tx FIFO, Rx FiFO, and Shift Register depends on the value of the generic, C_NUM_TRANSER_BITS.
2. The width of SS depends on the value of the generic C_NUM_SS_BITS.
3. BRG (Buad Rate Generator) DS742_01
The AXI SPI IP core 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. The core supports Manual Slave Select Mode as the
default mode of operation. This mode allows the user to manually control the slave select line using the data written
to the slave select register. This allows transfers of an arbitrary number of elements without toggling the slave select
line between elements. However, the user must toggle the slave select line before starting a new transfer.
The other mode of operation is Automatic Slave Select Mode. In this mode the slave select line is toggled
automatically after each element transfer. This mode is described in more detail in SPI Protocol with Automatic
Slave Select Assertion.
The AXI SPI IP core supports continuous transfer mode; when configured as a master the transfer continues until
the data is available in transmit register/FIFO. This capability is provided in both manual and automatic slave
select modes.
When the core is configured as a slave and if inadvertently its slave select line (SPISEL) goes high (inactive state) in
between the data element transfer, then the current transfer is aborted. Again if the slave select line goes low then
the aborted data element is transmitted again. The core allows additional slaves to be added with automatic
generation of the required decoding logic for individual slave select outputs by the master. Additional masters can
also be added. However, the means to detect all possible conflicts are not implemented with this interface standard.
To eliminate conflicts, software is required to arbitrate bus control.
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 does impact the achievable
performance in terms of frequency and resource utilization. All of the SPI and INTR registers are 32-bit wide. The
core supports only 32-bit word access to all SPI and INTR register modules.
AXI4-Lite IP IPIF Interface (IPIF): The AXI4-Lite IP Interface (IPIF) provides the interface to the AXI4-Lite to IP
Interconnect (IPIC). The read and write transactions at the AXI4-Lite interface are translated into equivalent IP
Interconnect (IPIC) transactions. See [Ref 4] for more information about the IPIC.
SPI Register Module: The SPI Register Module includes all memory mapped registers (as shown in Figure 1). It
interfaces to the AXI. It consists of Status Register, Control Register, N-bit Slave Select Register (N 32) and a pair
of Transmit/Receive Registers.
Interrupt Controller Register set Module: The Interrupt Controller Register set Module consists of interrupt
related registers, namely: Device Global Interrupt Enable Register (DGIER), IP Interrupt Enable Register (IPIER),
and IP Interrupt Status Register (IPISR).
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. It is the heart of core.
Optional FIFOs: The Tx FIFO and Rx FIFO are implemented on both transmit and receive paths when enabled by
the parameter C_FIFO_EXIST. The width of Tx FIFO and Rx FIFO are the same and depend on the generic
C_NUM_TRANSFER_BITS. When the FIFOs are enabled, their depth is fixed at 16.
Design Parameters
To allow the user to obtain an AXI SPI IP core that is uniquely tailored for the system, certain features can be
parameterized. Parameterization affords a measure of control over the function, resource usage, and performance
of the implemented AXI SPI IP core. The features that can be parameterized are as shown in Table 1. In addition to
the parameters listed in this table, there are also parameters that are inferred for each AXI interface in the
Embedded Development Kit (EDK) tools. Through the design, these EDK-inferred parameters control the behavior
of the AXI Interconnect. For a complete list of the interconnect settings related to the AXI interface, see [Ref 6].
Notes: Notes:
1. The range C_BASEADDR to C_HIGHADDR is the address range for the AXI SPI IP. This range is subject to restrictions to
accommodate the simple address decoding scheme that is employed. The size, C_HIGHADDR - C_BASEADDR + 1, must be a
power of two and must be at least 0x80 to accommodate all AXI SPI IP core registers. However, a larger power of two can be
chosen to reduce decoding logic. C_BASEADDR must be aligned to a multiple of the range size.
2. No default value is specified to ensure that an actual value appropriate to the system is set. The values must be set by the user.
3. C_SCK_RATIO = 2 is not supported when the AXI SPI IP core is configured as slave. Read the Precautions to be Taken while
Assigning the C_SCK_RATIO Parameter section carefully when using this parameter.
Core Grouping
C_BASEADDR + 40 SRR Write N/A Software Reset Register
C_BASEADDR + 60 SPICR R/W 0x180 SPI Control Register
C_BASEADDR + 64 SPISR Read 0x25 SPI Status Register
SPI Data Transmit Register
C_BASEADDR + 68 SPIDTR Write 0x0
A single register or a FIFO
SPI Data Receive Register
C_BASEADDR + 6C SPIDRR Read NA
A single register or a FIFO
C_BASEADDR + 70 SPISSR R/W No slave is selected SPI Slave Select Register
SPI Transmit FIFO
C_BASEADDR + 74 Read 0x0 Transmit FIFO Occupancy Register
Occupancy Register (1)
SPI Receive FIFO
C_BASEADDR + 78 Read 0x0 Receive FIFO Occupancy Register
Occupancy Register(1)
Interrupt Controller Grouping
C_BASEADDR + 1C DGIER R/W 0x0 Device Global Interrupt Enable Register
Register Details
Software Reset Register (SRR)
The Software Reset Register allows the programmer to reset the core independent of other cores in the systems. To
activate software generated reset, the value of 0x0000_000A must be written to this register. Any other write access
generates an error condition with undefined results and results in error generation. The bit assignment in the
software reset register is shown in Figure 2 and described in Table 5. An attempt to read this register returns
undefined data.
X-Ref Target - Figure 2
31 0
Reset DS742_02
Master
TransactionRx FIFO Master
Inhibit Reset CPHA LOOP
31 10 9 8 7 6 5 4 3 2 1 0
Tx_Empty
Reserved MODF Rx_Empty
31 6 5 4 3 2 1 0
Rx_Full
Slave_Mode Tx_Full
_Select DS742_04
N-1 0
N-1 0
31 N N-1 0
DS742_07
Table 10: SPI Slave Select Register (SPISSR) Description (C_BASEADDR + 0x70)
Bit(s) Name Core Access Reset Value Description
31 - N Reserved N/A N/A Reserved
Active Low, one-hot encoded slave select vector of length N-bits. N
Selected must be less than or equal to the data bus width (32-bit). The slaves are
[N-1] - 0 R/W 1
Slave numbered right to left starting at zero with the LSB. The slave numbers
correspond to the indexes of signal SS.
Occupancy
Reserved Value
31 4 3 0
Table 11: SPI Transmit FIFO Occupancy Register Description (C_BASEADDR + 0x74)
Bit(s) Name Core Access Reset Value (hex) Description
31 - 4 Reserved N/A N/A Reserved
3-0 Occupancy Value Read 0 Bit 3 is the MSB. The binary value plus 1 yields the occupancy.
Occupancy
Reserved Value
31 4 3 0
DS742_09
Table 12: SPI Receive FIFO Occupancy Register Description (C_BASEADDR + 0x78)
Bit(s) Name Core Access Reset Value (hex) Description
31- 4 Reserved N/A N/A Reserved
3-0 Occupancy Value Read 0 Bit 3 is the MSB. The binary value plus 1 yields the occupancy.
Reserved
31 30 0
DS742_10
Figure 10: Device Global Interrupt Enable Register (DGIER) (C_BASEADDR + 0x1C)
Table 13: Device Global Interrupt Enable Register(DGIER) Description (C_BASEADDR + 0x1C)
Bit(s) Name Access Reset Value Description
Global Interrupt Enable
Enables all individually enabled interrupts to be passed to the interrupt controller.
31 GIE R/W 0
0 = Disabled
1 = Enabled
30 - 0 Reserved N/A N/A Reserved
DRR
DRR_Not_Empty
Full
Tx FIFO DTR
Reserved Half Empty Empty MODF
31 9 8 7 6 5 4 3 2 1 0
DRR Slave
Over-run MODF
Slave DTR
Mode_Select Under-run
DS742_11
Table 14: IP Interrupt Status Register (IPISR) Description (C_BASEADDR + 0x20) (Contd)
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.
DRR
DRR_Not_Empty
Full
Tx FIFO DTR
Reserved Half Empty Empty MODF
31 9 8 7 6 5 4 3 2 1 0
DRR Slave
Over-run MODF
Slave DTR
Mode_Select Under-run
DS742_12
Table 15: IP Interrupt Enable Register (IPIER) Description (C_BASEADDR + 0x28) (Contd)
Design Description
SPI Device Features
In addition to the features listed in the Features section, the SPI device also includes the following standard features:
Supports multi-master configuration within the Field Programmable Gate Array (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 via data written to the SPISSR. This appears directly on the SS output when the master
is enabled. This mode can be used only with external slave devices. An optional operation where the SS output
is toggled automatically with each 8-bit character transfer by the master device can be selected via 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 the SPI in Multi-Master Configuration section.
Multi-slave environment supported (automatic generation of additional slave select output signals for the
master).
Supports maximum SPI clock rates up to one-half of the AXI clock rate in master mode and one-fourth of 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 to take care of the AXI and external clock signals
alignment when configured in slave mode.
Parameterizable baud rate generator.
The Write Collision error (WCOL) flag is not supported as a write collision error as described in the M68HC11
reference manual. The user must not write to the transmit register when an SPI data transfer is in progress.
Back-to-back transactions are supported, which means there can be multiple byte/half-word/word transfers
taking place without interruption, 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; an 8-bit shift register in the SPI master device and another 8-bit shift register in a SPI slave
device that are connected.
This IP cannot be used for FPGA bitstream programming through the SPI interface during power-on reset
state.
The data transfer and registering mechanism of this core is synchronized with the AXI clock. User should take
care while configuring the IP. See the timing parameters for the targeted device while configuring the core and
the C_SCK_RATIO parameter.
SPI Device 0
MOSI
MISO
SS(0)
SCK
SPISEL SS(1)
SS(1) SS(2)
SS(2) SS(3)
SS(3)
SPI Device 1
MOSI
MISO
SCK
SPISEL
SS(1)
SS(2)
SS(3)
SPI Device 2
MOSI
MISO
SCK
SPISEL
SS(1)
SS(2)
SS(3)
SPI Device 3
MOSI
MISO
SCK
SPISEL
SS(1)
SS(2)
SS(3)
Slave-only devices (not shown) have only SPISEL local slave select ports
and do not have SS(N) remote slave select ports
DS742_13
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 SPI master/slave devices to be both internal
to the FPGA and SPI slave devices to be external to the FPGA. SPI pins are automatically generated through Xilinx
Platform Generator when interfacing to an external SPI slave device. Multiple SPI master/slave devices are shown
in Figure 13.
Optional FIFOs
The user has the option to include FIFOs in the AXI SPI IP core as shown in Figure 1. Because SPI is full-duplex,
both transmit and receive FIFOs are instantiated as a pair.
When FIFOs are implemented, the slave select address is required to be the same for all data buffered in the FIFOs.
This is required because a FIFO for the slave select address is not implemented. Because burst mode is not
supported, both transmit and receive FIFOs are 16 elements deep and are accessed via single AXI transactions.
The transmit FIFO is write-only. When data is written in the FIFO, the occupancy number is incremented and when
an 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 Master Transaction Inhibit bit, bit(23) of 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 a
read-only register.
If a write is attempted when the FIFO is full, then an acknowledgement is given along with an error signal
generation. Interrupts associated with the transmit FIFO include data transmit FIFO empty, transmit FIFO half
empty and transmit FIFO underrun. See the section on Interrupt Register Set Description for details.
The receive FIFO is read-only. When data is read from the FIFO, the occupancy number is decremented and when
an SPI transfer is completed, the number is incremented. If a read is attempted when the FIFO is empty, then
acknowledgement is given along with an error signal generation. 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 an SPI transfer. If the receive FIFO is full and more data is received, then a receive FIFO overflow
interrupt is issued. When this happens, all data attempted to be written to the full receive FIFO by the SPI module
is lost.
SPI transfers, when the AXI SPI IP core is configured with FIFOs, 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, then
the SPI transfer begins immediately after the write to the master transmit FIFO. If the FIFO is emptied via 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 up
to 16 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.
Underrun and overrun conditions error detection is also provided. Underrun conditions can happen only in slave
mode operation. This happens when a master commands a transfer but the slave does not have data in the transmit
register or FIFO for transfer. In this case, the slave underrun interrupt is asserted and the slave shift register is
loaded with all zeros for transmission. Overrun can happen 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.
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 upon a write to the transmit register. Consequently, it is the users responsibility
to ensure that the data is properly loaded in 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. The different transfer formats are described in the following sections.
3#+
-/3) $T $T $T $T $T $T $T $T
33
30)3%,
,EGEND
! !DDRESS OF 4RANSMIT?$ATA 2EGISTER
$T 4RANSMITTED $ATA
$R 2ECEIVED $ATA
3#+ IS SHOWN FOR #0/,
.OT DEFINED BUT NORMALLY -3"