
MOTOROLA
8-14
SYNCHRONOUS SERIAL PERIPHERAL INTERFACE
M68HC11
REFERENCE MANUAL
Figure 8-6 Transfer Ending for an SPI Slave
When CPHA equals zero, there is a potential problem that can be avoided by proper
software but is sometimes overlooked. The SPIF flag is set at the end of a transfer, but
the slave is not permitted to write new data to the SPDR while the SS line is still low.
If the master device is busy, the SS line to the slave can remain low longer than the
slave expects. The proper way for the slave to manage this problem is to read the state
of the port D bit 5 pin, (SS), before writing to SPDR. If this procedure is not followed
(slave mode and CPHA = 0) and an attempt is made to write to SPDR before SS goes
high, a write collision will result.
8.7 Transfers to Peripherals with Odd Word Lengths
The SPI system in the MC68HC11A8 is oriented toward 8-bit transfers, but not all pe-
ripherals use eight bits. Some peripherals use multiples of eight bits, but a few use odd
word lengths. When a peripheral uses an odd number of bits, it is usually possible to
send it some multiple of eight bits, and the peripheral will ignore the extra bits. Serial
peripherals are commonly designed for cascading. In these devices, only the most re-
cent bits received will be important, and extra leading bits pass through the peripheral.
In more unusual peripheral designs, the leading bits can alter the way the peripheral
will interpret the remaining bits in a serial stream. In all cases, the requirements of
each peripheral in the system must be considered.
The MC144110 six-channel, 6-bit, D/A converter peripheral is an example of a periph-
eral with an odd word length. This device requires six 6-bit words (a total of 36 bits) to
update all six channels. The following examples show two possible approaches for
managing this device to illustrate some of the possible trade-off decisions found in un-
SCK (CPHA=1)
LAST
EDGE
SCK (CPHA=0)
SECOND LAST
EDGE
PC (LOW) PC (HIGH)
EARLIEST POSSIBLE STACKING
DUE TO SPIF INTERRUPT
(NO OTHER INTERRUPT PENDING)
SPIF SET
E
NEW OPCODE
(NOT EXECUTED DUE TO INTERRUPT)
SYNCHRONIZATION
UNCERTAINTY
R/W