28.10.2014 Views

MMC2107 - Freescale Semiconductor

MMC2107 - Freescale Semiconductor

MMC2107 - Freescale Semiconductor

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Freescale</strong> <strong>Semiconductor</strong>, Inc.<br />

Serial Peripheral Interface Module (SPI)<br />

Functional Description<br />

17.8.1 Master Mode<br />

nc...<br />

<strong>Freescale</strong> <strong>Semiconductor</strong>, I<br />

17.8.2 Slave Mode<br />

Setting the MSTR bit in SPICR1 puts the SPI in master mode. Only a<br />

master SPI can initiate a transmission. Writing to the master SPIDR<br />

begins a transmission. If the shift register is empty, the byte transfers to<br />

the shift register and begins shifting out on the MOSI pin under the<br />

control of the master SCK clock. The SCK clock starts one-half SCK<br />

cycle after writing to SPIDR.<br />

The SPR[2:0] and SPPR[6:4] bits in SPIBR control the baud rate<br />

generator and determine the speed of the shift register. The SCK pin is<br />

the SPI clock output. Through the SCK pin, the baud rate generator of<br />

the master controls the shift register of the slave.<br />

The MSTR bit in SPICR1 and the SPC0 bit in SPICR2 control the<br />

function of the data pins, MOSI and MISO.<br />

The SS pin is normally an input that remains in the inactive high state.<br />

Setting the DDRSP3 bit in SPIDDR configures SS as an output. The<br />

DDRSP3 bit and the SSOE bit in SPICR1 can configure SS for<br />

general-purpose I/O, mode fault detection, or slave selection.<br />

See Table 17-3.<br />

The SS output goes low during each transmission and is high when the<br />

SPI is in the idle state. Driving the master SS input low sets the MODF<br />

flag in SPISR, indicating a mode fault. More than one master may be<br />

trying to drive the MOSI and SCK lines simultaneously. A mode fault<br />

clears the data direction bits of the MISO, MOSI (or MOMI), and SCK<br />

pins to make them inputs. A mode fault also clears the SPE and MSTR<br />

bits in SPICR1. If the SPIE bit is also set, the MODF flag generates an<br />

interrupt request.<br />

Clearing the MSTR bit in SPICR1 puts the SPI in slave mode. The SCK<br />

pin is the SPI clock input from the master, and the SS pin is the<br />

slave-select input. For a transmission to occur, the SS pin must be driven<br />

low and remain low until the transmission is complete.<br />

The MSTR bit and the SPC0 bit in SPICR2 control the function of the<br />

data pins, MOSI and MISO. The SS input also controls the MISO pin. If<br />

SS is low, the MSB in the shift register shifts out on the MISO pin. If SS<br />

<strong>MMC2107</strong> – Rev. 2.0<br />

Technical Data<br />

MOTOROLA Serial Peripheral Interface Module (SPI) 387<br />

For More Information On This Product,<br />

Go to: www.freescale.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!