Functional Description
www.ti.com
278
SWRU543–January 2019
Submit Documentation Feedback
Copyright © 2019, Texas Instruments Incorporated
SPI (Serial Peripheral Interface)
In slave mode, the SPI initiates data transfer on the data lines (MISO/MOSI) when it receives a SPI clock
(SPICLK) from the external SPI master device. The controller is able to work with or without a chip-select
SPIEN, depending on the MCSPI_MODULCTRL[1] PIN34 bit setting. The controller also supports
transfers without a dead cycle between two successive words.
The following configurations are available for the slave channel:
• A channel enable, programmable with the EN bit of the SPI_CHCTRL register. This channel should be
enabled before transmission and reception. Disabling the channel, outside data word transmission, is
the user's responsibility.
• A transmitter register, SPI_TX, on top of the common shift register. If the transmitter register is empty,
the TXS status bit of the SPI_CHSTAT register is set. When SPI is selected by an external master
(active signal on the SPIEN port), the transmitter register content of the channel is always loaded in the
shift register, whether it has been updated or not. The transmitter register should be loaded before SPI
is selected by a master.
• A receiver register, SPI_RX, on top of the common shift register. If the receiver register is full, the RXS
status bit of the SPI_CHSTAT register is set.
• A communication configuration with the following parameters in the MCSPI_CHCONF register:
– Transmit and receive modes, programmable with the TRM bit
– SPI word length, programmable with the WL bits
– SPIEN polarity, programmable with the EPOL bit
– SPICLK polarity, programmable with the POL bit
– SPICLK phase, programmable with the PHA bit
– Use a FIFO buffer or not, programmable with FFER and FFEW, depending on transfer mode
TRM. ?? Depending on the TRM bit of transfer mode, use a FIFO buffer (or not), programmable
with FFER and FFEW.
– The SPICLK frequency of a transfer is controlled by the external SPI master.
– Two DMA requests events, read and write, to synchronize read/write accesses of the DMA
controller with the activity of SPI. The DMA requests are enabled with the DMAR and DMAW bits of
the MCSPI_CHCONF register.
8.2.4.1 Interrupts Events in Slave Mode
The interrupt events related to the transmitter register state are TX_empty and TX_underflow. The
interrupt events related to the receiver register state are RX_full and RX_overflow.
8.2.4.1.1 TX_empty
The TX_empty event is activated when a channel is enabled and its transmitter register becomes empty.
Enabling the channel automatically raises this event. When the FIFO buffer is enabled
(MCSPI_CHCONF[FFEW] set to 1), the TX_empty event is asserted when there is enough space in the
buffer to write a number of bytes defined by MCSPI_XFERLEVEL[AEL].
The transmitter register must be loaded to remove the source of the interrupt, and the TX_empty interrupt
status bit must be cleared for the interrupt line deassertion (if the event is enabled as the interrupt source).
When FIFO is enabled, no new TX_empty event is asserted if the local host has not performed the
number of writes into the transmitter register defined by MCSPI_XFERLEVEL[AEL]. The local host must
perform the correct number of writes.
8.2.4.1.2 TX_underflow
The TX_underflow event is activated when the channel is enabled and the transmitter register or FIFO (if
the buffer is enabled) is empty (not updated with new data), and when an external master device starts a
data transfer with the SPI (transmit and receive).
When FIFO is enabled, the data emitted while the underflow event is raised is not the last data written in
the FIFO. The TX_underflow event indicates an error (data loss) in slave mode.