English
Language : 

MMC2107 Datasheet, PDF (387/618 Pages) –
Freescale Semiconductor, Inc.
Serial Peripheral Interface Module (SPI)
Functional Description
17.8.1 Master Mode
Setting the MSTR bit in SPICR1 puts the SPI in master mode. Only a
master SPI can initiate a transmission. Writing to the master SPIDR
begins a transmission. If the shift register is empty, the byte transfers to
the shift register and begins shifting out on the MOSI pin under the
control of the master SCK clock. The SCK clock starts one-half SCK
cycle after writing to SPIDR.
The SPR[2:0] and SPPR[6:4] bits in SPIBR control the baud rate
generator and determine the speed of the shift register. The SCK pin is
the SPI clock output. Through the SCK pin, the baud rate generator of
the master controls the shift register of the slave.
The MSTR bit in SPICR1 and the SPC0 bit in SPICR2 control the
function of the data pins, MOSI and MISO.
The SS pin is normally an input that remains in the inactive high state.
Setting the DDRSP3 bit in SPIDDR configures SS as an output. The
DDRSP3 bit and the SSOE bit in SPICR1 can configure SS for
general-purpose I/O, mode fault detection, or slave selection.
See Table 17-3.
The SS output goes low during each transmission and is high when the
SPI is in the idle state. Driving the master SS input low sets the MODF
flag in SPISR, indicating a mode fault. More than one master may be
trying to drive the MOSI and SCK lines simultaneously. A mode fault
clears the data direction bits of the MISO, MOSI (or MOMI), and SCK
pins to make them inputs. A mode fault also clears the SPE and MSTR
bits in SPICR1. If the SPIE bit is also set, the MODF flag generates an
interrupt request.
17.8.2 Slave Mode
Clearing the MSTR bit in SPICR1 puts the SPI in slave mode. The SCK
pin is the SPI clock input from the master, and the SS pin is the
slave-select input. For a transmission to occur, the SS pin must be driven
low and remain low until the transmission is complete.
The MSTR bit and the SPC0 bit in SPICR2 control the function of the
data pins, MOSI and MISO. The SS input also controls the MISO pin. If
SS is low, the MSB in the shift register shifts out on the MISO pin. If SS
MMC2107 – Rev. 2.0
MOTOROLA
Serial Peripheral Interface Module (SPI)
For More Information On This Product,
Go to: www.freescale.com
Technical Data
387