
Serial Communication Modules
16-18
MPC801 USER’S MANUAL
MOTOROLA
16
16.3.2.3 SPI TRANSMISSION AND RECEPTION PROCESS.
Since the serial peripheral
interface is a character-oriented communication unit, the PowerPC core is responsible for
packing and unpacking the receive/transmit frames.The core supplies and collects words to
or from the serial peripheral interface as requested. The core receives data by reading the
SPI receive data hold (SPIRD) register. It resets the F bit in the SPI event register (SPIER)
to free up the SPIRD register for the next operation. The core transmits data by writing it into
the SPI transmit data hold (SPITD) register when the FIRST or LAST word is indicated.
The SPI core handshake protocol can be implemented by using a polling or interrupt
mechanism. When using a polling mechanism, the core reads the SPIER in a predefined
frequency and acts according to the value of the SPIER bits.The polling frequency depends
on the SPI serial channel frequency. When using an interrupt mechanism, setting either the
E or F bits of the SPIER causes an interrupt to the core. The interrupt level is determined by
the SPIRL bits of the SPIMR. The core then reads the SPIER and acts appropriately. There
are three basic modes of operation for transmitting and receiving—master, slave, and
multimaster.
NOTE
Once the core realizes that the F and E bits are set,
it should treat the receive request first.
16.3.2.3.1 SPI Master Mode.
When the serial peripheral interface is in master mode, it
transmits a message to the peripheral or SPI slave, which replies simultaneously. When the
MPC801 works with more than one slave, it can use the general-purpose parallel I/O pins
to selectively enable different slaves.
To begin the data exchange, the core writes the data to be transmitted into the SPITD
register. It then sets the STR bit in the SPCOM register to start transmitting data. The SPI
controller then generates programmable clock pulses on the SPICLK pin for each character
and shifts the data out on the SPIMOSI pin. At the same time, the serial peripheral interface
shifts the received data in from the SPIMISO pin. During the transmission process, the core
is responsible for supplying the data whenever the serial peripheral interface requests it to
ensure smooth operation. The STR bit should only be set for the first character of any
transmission. The serial peripheral interface continues transmitting and receiving characters
until the L bit in the SPITD register is set or an error occurs.
The serial peripheral interface sets the E bit of the SPIER and issues a maskable interrupt
to the system interface unit interrupt controller whenever its transmit buffer is not full. It also
sets the E bit after sending the last word. In response, the core should read the exception
flags that relate to the last word. The serial peripheral interface sets the F bit of the SPIER
and issues a maskable interrupt to the system interface unit interrupt controller whenever its
receive buffer has been filled with data. If the serial peripheral interface is the only master in
a system, the SPISEL pin can be used as a general-purpose I/O and the internal SPISEL
pin to the serial peripheral interface will always be forced inactive internally, thus eliminating
the possibility of a multimaster error.