M68HC11
REFERENCE MANUAL
PARALLEL INPUT/OUTPUT
MOTOROLA
7-31
channel device in the output driver is disabled so the pin cannot be actively driven
high. When the pin attempts to output a logic one, the N-channel device is disabled;
thus, the pin appears as a high-impedance input. An external pull-up is used to pas-
sively pull the pin high.
The data for output driver [9] comes from transmission gate [10] or [11]. When the SPI
system is enabled, the SPE bit is one; thus, transmission gate [10] is enabled, and
data for the output driver comes from the SPI slave data output signal (SLAVDO).
When the SPI system is disabled, the SPE control bit is zero; thus, transmission gate
[10] is disabled and transmission gate [11] is enabled. In this case, port D data is cou-
pled from the output of HFF [8] to the input of output driver [9]. During a write to port
D, the WPORTD signal is asserted, which causes data to be latched into HFF [8] from
the internal data bus.
During a read of port D, transmission gate [6] is enabled by the RPORTD signal to cou-
ple data to the internal data bus. The source of data for port D reads depends on the
direction control for the output driver. If the output of NAND gate [3] is zero, output driv-
er [9] is enabled and transmission gate [4] is enabled. In this case, port D reads return
the data from a point inside the output driver. If the output of NAND gate [3] is one,
transmission gate [5] is enabled. In this case, reads of port D return the buffered state
from the pin through inverters [7].
The output of inverters [7] drives the serial master data input to the SPI system logic.
The source of this data is always from the MISO pin and is not affected by the data
direction logic.
7.3.6.4 PD3 (MOSI) Pin Logic
This pin alternately functions as the MOSI pin when the synchronous SPI system is
enabled. Refer to
Figure 7-19
for the following discussion. The data direction specifi-
cation for this pin is held in HFF [1]. During a write to the DDRD register, the WDDRD
signal is asserted, causing data to be transferred into HFF [1] from the internal data
bus. A read of DDRD causes the RDDRD signal to be asserted, which enables trans-
mission gate [2] to couple the output of HFF [1] onto the internal data bus.
When HFF [1] is cleared to zero, this pin is configured as a high-impedance input. OR
gate [13] causes HFF [1] to be cleared to zero during reset. OR gate [13] also causes
HFF [1] to be cleared if an SPI mode fault occurs. An SPI mode fault is caused when
a device configured as a master SPI is selected as if it were a slave. This condition
could indicate that more than one SPI device is attempting to drive the common SPI
lines, which could cause a bus conflict. To avoid the possibility of latchup, the port D
pins associated with the SPI are immediately forced to their input configuration.
The actual data direction for this port D pin is determined by the logic output of NAND
gate [3]. When the SPI system is disabled, the DDRD bit from HFF [1] controls direc-
tion. When the SPI system is enabled in slave mode, this pin is configured as a high-
impedance input. When the SPI system is enabled in master mode, the DDRD bit from
HFF [1] controls direction. This last condition means that the user must set the corre-
sponding DDRD bit to one to enable master data output from this pin when the SPI