SPI Operation Modes
Serial Peripheral Interface (SPI) Module (SPNU195E)
7
2.3
SPI Operation; Four-Pin Option
The three-pin option and the four-pin options of the SPI are identical in the
master mode (CLKMOD = 1), except that the four-pin option uses either
SPIENA or SPISCS pin. The I/O direction of these pins is determined by the
CLKMOD control bit as SPI not general purpose I/O.
4-pin option with SPISCS
To use the SPISCS as an automatic chip select pin, the SPISCS pin must be
configured to be functional (SPIPC6.4 = 1). In this mode, the master will drive
this signal low when data has been written to SPIDAT1 and then drive the pin
high again after a character transmission has completed. If data is written to
SPIDAT0, SPISCS remains high (see
Figure 3
).
Figure 3.
SPI Four Pin Option with SPISCS
To use the SPISCS as a chip select, the slave SPISCS pin must be
configured as SPI functional (SPIPC6.4 = 1). In this mode, an active low
signal on the SPISCS pin will allow the slave SPI to transfer data to the serial
data line. An inactive high signal will put the slave SPI’s serial output pin in a
high-impedance state. Therefore many slave devices can be tied together on
the network, but only one slave at a time is allowed to talk. While the slave is
not selected, no shifting or interrupts will occur.
SPI four pin option (1)
Master
Slave
(Master = 1 ; CLKMOD = 1)
(Master = 0 ; CLKMOD = 0)
SPIDAT1
SPIDAT0
MSB
LSB
MSB
LSB
Write to
SPIDAT1
SPISOMI
SPISIMO
SPISOMI
SPISIMO
SPICLK
SPICLK
SPISCS
SPISCS
Write to SPIDAT1
SPICLK
SPISIMO
SPISOMI
SPICSCS