ST7LITE20F2 ST7LITE25F2 ST7LITE29F2
On-chip peripherals
11.4
11.4.1
11.4.2
Note:
11.4.3
Serial peripheral interface (SPI)
Introduction
The serial peripheral interface (SPI) allows full-duplex, synchronous, serial communication
with external devices. An SPI system may consist of a master and one or more slaves or a
system in which devices may be either masters or slaves.
Main features
● Full duplex synchronous transfers (on 3 lines)
● Simplex synchronous transfers (on 2 lines)
● Master or slave operation
● Six master mode frequencies (fCPU/4 max.)
● fCPU/2 max. slave mode frequency (see note)
● SS Management by software or hardware
● Programmable clock polarity and phase
● End of transfer interrupt flag
● Write collision, Master mode Fault and Overrun flags.
In slave mode, continuous transmission is not possible at maximum frequency due to the
software overhead for clearing status flags and to initiate the next transmission sequence.
General description
Figure 42 shows the serial peripheral interface (SPI) block diagram. There are 3 registers:
● SPI Control Register (SPICR)
● SPI Control/Status Register (SPICSR)
● SPI Data Register (SPIDR)
The SPI is connected to external devices through 3 pins:
● MISO: Master In / Slave Out data
● MOSI: Master Out / Slave In data
● SCK: Serial Clock out by SPI masters and input by SPI slaves
● SS: Slave select:
This input signal acts as a "chip select” to let the SPI master communicate with slaves
individually and to avoid contention on the data lines. Slave SS inputs can be driven by
standard I/O ports on the master device.
Doc ID 8349 Rev 5
91/166