The SPI is in slave mode when the MS bit of the SPI_MODULCTRL register is set. In slave mode, the SPI should be connected to only one external master device.
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.
- 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.