Datasheet

Serial Peripheral Interface (SPI)
M68HC12B Family Data Sheet, Rev. 9.1
Freescale Semiconductor 201
14.3 Serial Peripheral Interface (SPI)
The serial peripheral interface (SPI) allows the MCU to communicate synchronously with peripheral
devices and other microprocessors. The SPI system in the MCU can operate as a master or as a slave.
The SPI is also capable of interprocessor communications in a multiple master system.
When the SPI is enabled, all pins that are defined by the configuration as inputs will be inputs regardless
of the state of the DDRS bits for those pins. All pins that are defined as SPI outputs will be outputs only if
the DDRS bits for those pins are set. Any SPI output whose corresponding DDRS bit is cleared can be
used as a general-purpose input.
A bidirectional serial pin is possible using the DDRS as the direction control.
Figure 14-11. Serial Peripheral Interface Block Diagram
PIN
CONTROL
LOGIC
8-BIT SHIFT REGISTER
READ DATA BUFFER
SHIFT CONTROL LOGIC
CLOCK
LOGIC
SPI CONTROL
SP0SR SPI STATUS REGISTER
SP0DR SPI DATA REGISTER
SPIF
WCOL
MODF
DIVIDER
SELECT
SP0BR SPI BAUD RATE REGISTER
÷2 ÷4 ÷8 ÷16 ÷32 ÷64 ÷128 ÷256
SPI
INTERRUPT
INTERNAL BUS
MCU P CLOCK
SAME AS E RATE
S
M
M
S
M
S
SPR2
SPR1
SPR0
REQUEST
SPIE
SPE
MSTR
CPOL
CPHA
LSBF
LSBF
PUPS
RDS
SWOM
SPC0
SSOE
SPE
CLOCK
MSTR
SWOM
MISO
PS4
SCK
PS6
SS
PS7
MOSI
PS5
SP0CR1 SPI CONTROL REGISTER 1
SP0CR2 SPI CONTROL REGISTER 2