Datasheet
Serial Peripheral Interface (S08SPIV3)
MC9S08GT16A/GT8A Data Sheet, Rev. 1
Freescale Semiconductor 189
Figure 12-2. SPI Module Quick Start
12.1.1 Features
Features of the SPI module include:
• Master or slave mode operation
• Full-duplex or single-wire bidirectional option
• Programmable transmit bit rate
• Double-buffered transmit and receive
• Serial clock phase and polarity options
• Slave select output
• Selectable MSB-first or LSB-first shifting
MSTR CPOL CPHA SSOE LSBFE
MODFEN BIDIROE SPISWAI SPC0
Additional configuration options.
SPPR0 SPR2 SPR1 SPR0SPPR2 SPPR1
Baud rate = (BUSCLK/SPPR[2:0])/SPR2[2:0]
Bit 7
Module Initialization (Slave):
Write: SPIC1 to configure interrupts, set primary SPI options, slave mode select, and
system enable.
Write: SPIC2 to configure optional SPI features
Module Initialization (Master):
Write: SPIC1 to configure interrupts, set primary SPI options, master mode select,
and system enable.
Write: SPIC2 to configure optional SPI features
Write: SPIBR to set baud rate
Module Use:
After SPI master initiates transfer by checking that SPTEF = 1 and then writing data to SPID:
Wait for SPTEF, then write to SPID
Wait for SPRF, then read from SPID
Mode fault detection can be enabled for master mode in cases where more than one SPI device might become a master
at the same time.
SPIC1
SPIC2
SPIBR
SPID
SPIE SPE SPTIE
Module/interrupt enables and configuration
Bit 6 Bit 5
Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
MODFSPTEF
SPIS
SPRF
