M68HC11
REFERENCE MANUAL
SYNCHRONOUS SERIAL PERIPHERAL INTERFACE
MOTOROLA
8-1
SECTION 8
SYNCHRONOUS SERIAL PERIPHERAL INTERFACE
The serial peripheral interface (SPI) is one of two independent serial communications
subsystems included on the MC68HC11A8. As the name implies, the SPI is primarily
used to allow the microcontroller unit (MCU) to communicate with peripheral devices.
The SPI is also capable of interprocessor communications in a multiple-master sys-
tem. Peripheral devices are as simple as an ordinary transistor-transistor logic (TTL)
shift register or as complex as a complete subsystem, such as a liquid crystal diode
(LCD) display driver or an analog-to-digital (A/D) converter subsystem. The SPI sys-
tem is flexible enough to interface directly with numerous standard product peripherals
from several manufacturers. The system can be configured as a master or a slave de-
vice. Data rates as high as 1 Mbit per second are accommodated when the system is
configured as a master; rates as high as 2 Mbits per second are accommodated when
the system is operated as a slave.
Clock control logic allows a selection of clock polarity and a choice of two fundamen-
tally different clocking protocols to accommodate most available synchronous serial
peripheral devices. When the SPI is configured as a master, software selects one of
four different bit rates for the serial clock.
Error-detection logic is included to support interprocessor communications. A write-
collision detector indicates when an attempt is made to write data to the serial shift reg-
ister while a transfer is in progress. A multiple-master mode-fault detector automatical-
ly disables SPI output drivers if more than one MCU simultaneously attempts to
become bus master.
The I/O pin control logic on the MC68HC11A8 is more flexible than that of other Mo-
torola MCUs. This added I/O pin control allows the MC68HC11A8 to implement sys-
tems with a single, bidirectional data line or other unusual synchronous serial
configurations.
8.1 SPI Transfer Formats
During an SPI transfer, data is simultaneously transmitted (shifted out serially) and re-
ceived (shifted in serially). A serial clock line synchronizes shifting and sampling of the
information on the two serial data lines. A slave select line allows individual selection
of a slave SPI device; slave devices that are not selected do not interfere with SPI bus
activities. On a master SPI device, the slave select line can optionally be used to indi-
cate a multiple-master bus contention.
8.1.1 SPI Clock Phase and Polarity Controls
Software can select any of four combinations of serial clock (SCK) phase and polarity
using two bits in the SPI control register (SPCR). The clock polarity is specified by the
CPOL control bit, which selects an active high or active low clock and has no signifi-