QE128 Quick Reference User Guide, Rev. 1.0
Freescale Semiconductor
11-1
Chapter 11
Using the Serial Peripheral Interface (SPI) for the QE
Microcontrollers
11.1
Overview
This is a quick reference for using the serial peripheral interface (SPI) module for the QE family
microcontrollers (MCUs). Basic information about the functional description and configuration options
are provided. The following example may be modified to suit an application. The SPI project is made for
the MC9S08QE128 and MCF51QE128 MCUs.
SPI Quick Reference
Because there are two SPI modules on some devices, there may be two full sets of registers. In the
register names below, where there’s a small x, there would be a 1 or a 2 in your software to
distinguish the registers that are on SPI1 from those on SPI2.
Module configuration:
Module configuration:
Data buffer
11.2
SPI project for EVB
11.2.1
Code Example and Explanation
This example code for Master and Slave project is available from the Freescale Web site
www.freescale.com.
SPIxC1
SPIE
SPE
SPTIE
MSTR
CPOL
CPHA
SSOE
LSBFE
SPIE – SPI Interrupt Enable
CPOL – Clock Polarity
SPE – SPI system Enable
CPHA – Clock Phase
SPTIE – SPI transmit Interrupt Enable
SSOE – Slave Select Output Enable
MSTR – Master/Slave Mode Select
LSBFE – LSB First
SPIxC2
MODFEN
BIDIROE
SPISWAI
SPC0
MODFEN – Master Mode-Fault function Enable
SPISWAI – SPI Stop in Wait mode
BIDIROE – Bidirectional mode Output Enable
SPC0 – SPI Pin control 0
SPIxBR
SPPR2
SPPR1
SPPR0
SPR2
SPR1
SPR0
SPPR[2:0] – SPI Baud Rate Prescaler Divisor
SPR[2:0] – SPI Baud Rate Divisor
SPIxS
SPRF
SPTEF
MODF
SPRF – SPI Read buffer full Flag
MODF – Master Mode Fault Flag
SPTEF – SPI Transmit Buffer Empty Flag
SPIxD
Bit 7
6
5
4
3
2
1
Bit 0