English
Language : 

MC68HC05C9E Datasheet, PDF (66/106 Pages) Freescale Semiconductor, Inc – Microcontrollers
Serial Peripheral Interface (SPI)
10.5.2 Serial Peripheral Status Register
The SPI status register (SPSR), shown in Figure 10-5, contains flags to signal these conditions:
• SPI transmission complete
• Write collision
• Mode fault
Address:
Read:
Write:
Reset:
$000B
Bit 7
SPIF
0
6
5
4
3
2
WCOL
0
MODF
0
0
0
0
0
0
0
= Unimplemented
Figure 10-5. SPI Status Register
1
Bit 0
0
0
0
0
SPIF — SPI Transfer Complete Flag
The serial peripheral data transfer flag bit is set upon completion of data transfer between the
processor and external device. If SPIF goes high, and if SPIE is set, a serial peripheral interrupt is
generated. Clearing the SPIF bit is accomplished by reading the SPSR (with SPIF set) followed by an
access of the SPDR. Following the initial transfer, unless SPSR is read (with SPIF set) first, attempts
to write to SPDR are inhibited.
WCOL — Write Collision Bit
The write collision bit is set when an attempt is made to write to the serial peripheral data register while
data transfer is taking place. If CPHA is 0, a transfer is said to begin when SS goes low and the transfer
ends when SS goes high after eight clock cycles on SCK. When CPHA is 1, a transfer is said to begin
the first time SCK becomes active while SS is low and the transfer ends when the SPIF flag gets set.
Clearing the WCOL bit is accomplished by reading the SPSR (with WCOL set) followed by an access
to SPDR.
MODF — Mode Fault Flag
The mode fault flag indicates that there may have been a multi-master conflict for system control and
allows a proper exit from system operation to a reset or default system state. The MODF bit is normally
clear, and is set only when the master device has its SS pin pulled low. Setting the MODF bit affects
the internal serial peripheral interface system in these ways:
1. An SPI interrupt is generated if SPIE = 1.
2. The SPE bit is cleared. This disables the SPI.
3. The MSTR bit is cleared, thus forcing the device into the slave mode.
Clearing the MODF bit is accomplished by reading the SPSR (with MODF set), followed by a write to
the SPCR. Control bits SPE and MSTR may be restored by user software to their original state during
this clearing sequence or after the MODF bit has been cleared. It is also necessary to restore DDRD
after a mode fault.
Bits 5 and 3–0 — Not Implemented
These bits always read 0.
MC68HC05C9E Advance Information Data Sheet, Rev. 0.1
66
Freescale Semiconductor