MOTOROLA
8-10
SYNCHRONOUS SERIAL PERIPHERAL INTERFACE
M68HC11
REFERENCE MANUAL
MISO line. Both these cases result in output driver contentions, but neither causes a
mode-fault error. Too many system configurations are possible to discuss all the pos-
sibilities, but some suggestions will help the system designer find practical ways to
prevent problems.
Under normal conditions, a moderate resistance, (i.e., 1 to 10K ohms) in series with
an SPI pin does not adversely affect SPI transfer operations. If a driver contention oc-
curs, this series resistance will protect the drivers against latchup. Another way to pro-
tect against latchup would be to employ the DWOM option, which transforms the SPI
output drivers into open-drain-type drivers. When the DWOM option is selected, it af-
fects all six port D pins; therefore, pull-up resistors are needed on the PD0 and PD1
pins if they are being used as outputs. Both of these suggestions affect the maximum
usable data rate, depending on the loading capacitance on the SPI lines.
8.5.2 SPI Write-Collision Errors
A write collision occurs if the SPDR is written while a transfer is in progress. Since the
SPDR is not double buffered in the transmit direction, writes to SPDR cause data to
be written directly into the SPI shift register. Because this write corrupts any transfer
in progress, a write-collision error is generated. The transfer continues undisturbed,
and the write data that caused the error is not written to the shifter.
A write collision is normally a slave error because a slave has no control over when a
master will initiate a transfer. A master knows when a transfer is in progress; thus,
there is no excuse for a master to generate a write-collision error, although the SPI log-
ic can detect write collisions in a master as well as in a slave.
The details of what constitutes a transfer in progress depend on the SPI configuration.
For a master, a transfer starts when data is written to SPDR and ends when SPIF is
set. For a slave with CPHA equals zero, a transfer starts when SS goes low and ends
when SS returns high. In this instance, SPIF is set at the middle of the eighth SCK cy-
cle when data is transferred from the shifter to the parallel data register, but the trans-
fer is still in progress until SS goes high. For a slave with CPHA equals one, a transfer
starts when the SCK line goes to its active level, which is the edge at the beginning of
the first SCK cycle. The transfer ends in a slave in which CPHA equals one when SPIF
is set.
8.6 Beginning and Ending SPI Transfers
The two basic SPI transfer formats are described in
8.1 SPI Transfer Formats
. A
transfer includes the eight SCK cycles plus an initiation period at the beginning and
ending period of the transfer. The details of the beginning and ending periods depend
on the CPHA format selected and whether the SPI is configured as a master or a
slave. The initiation delay period is also affected by the SPI clock rate selection when
the SPI is configured as a master.
It may be useful to refer to the transfer format illustrated in
Figure 8-1
and
Figure 8-2
to understand how the beginning and ending details fit into a complete transfer oper-
ation.