Architecture
1431
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Serial Peripheral Interface (SPI)
29.2.13 DMA Events Support
If handling the SPI message traffic on a character-by-character basis requires too much CPU overhead,
then the CPU can configure the system DMA to handle the SPI data transfer.
The SPI module has two DMA synchronization event outputs for receive (REVT) and transmit (XEVT),
allowing DMA transfers to be triggered by SPI read receive and write transmit events. The SPI module
enables DMA requests by enabling the DMA request enable (DMAREQEN) bit in the SPI interrupt register
(SPIINT0).
When a character is to be transmitted the SPI module signals the DMA via the XEVT signal. The DMA
controller then transfers the data from the source buffer into the SPI transmit data register (SPIDAT1).
When a character is received, the SPI module signals the DMA via the REVT signal. The DMA controller
then reads the data from the SPI receive buffer register (SPIBUF) and transfers it to a destination buffer
for ready access.
In most cases, if the DMA is being used to service received data from the SPI, the receive interrupt enable
(RXINTEN) bit in SPIINT0 should be cleared to 0. This prevents the CPU from responding to the received
data in addition to the DMA. For specific SPI synchronization event number assignments and detailed
DMA features, see your device-specific data manual.
29.2.14 Robustness Features
The SPI module includes many features to make the SPI communication link robust. A internal loopback
test mode can be used to facilitate a power on self test routine. Additionally, the SPI master continually
monitors the bus for faults on its data line. The handshaking between master and slave can be monitored
as well, and appropriate actions can be taken (interrupt, timeout) when the handshake breaks down. The
following sections describe these robustness features in more detail.
29.2.14.1 SPI Internal Loopback Test Mode (Master Only)
CAUTION
The internal loop-back self-test mode should not be entered during a normal
data transaction or unpredictable operation may occur.
To select the loopback mode, the SPIx_CLK, SPIx_SOMI, SPIx_SIMO pins should be configured as
functional pins by configuring the SPI pin control register 0 (SPIPC0) and by setting the LOOPBACK bit in
the SPI global control register 1 (SPIGCR1). The SPIx_ENA and SPIx_SCS[n] pins can be used as
general-purpose I/O pins by configuring the SPIPC1 through SPIPC5 registers. The internal loop-back
self-test mode can be utilized to test the SPI transmit path and receive path including the transmit and
receive buffers. In this mode, the transmit signal is internally fed back to the receiver and the SPIx_SIMO,
SPIx_SOMI, and SPIx_CLK pins are in a high-impedance state. This mode allows the CPU to write into
the transmit buffer, and check that the receive buffer contains the correct transmit data. If an error occurs
the corresponding error is set within the status field.
29.2.14.2 SPI Transmission Continuous Self-Test
During a data transfer, the SPI inputs the value from its data output pin on the appropriate SPIx_CLK
edge. This value is compared against the expected value and any difference indicates a fault on the SPI
bus. If a fault is detected, then the BITERR bit in the SPI receive buffer register (SPIBUF) and the
BITERRFLG bit in the SPI flag register (SPIFLG) are set and an error interrupt is generated if enabled.
The SPI continuous self-test mode is not available in SPI loopback mode.