Datasheet
SPI0_S field descriptions (continued)
Field Description
5
SPTEF
SPI transmit buffer empty flag
This bit is set when the transmit data buffer is empty. SPTEF is cleared by reading the S register with
SPTEF set and then writing a data value to the transmit buffer at D. The S register must be read with
SPTEF set to 1 before writing data to the D register; otherwise, the D write is ignored. SPTEF is
automatically set when all data from the transmit buffer transfers into the transmit shift register. For an idle
SPI, data written to D is transferred to the shifter almost immediately so that SPTEF is set within two bus
cycles, allowing a second set of data to be queued into the transmit buffer. After completion of the transfer
of the data in the shift register, the queued data from the transmit buffer automatically moves to the shifter,
and SPTEF is set to indicate that room exists for new data in the transmit buffer. If no new data is waiting
in the transmit buffer, SPTEF simply remains set and no data moves from the buffer to the shifter.
If a transfer does not stop, the last data that was transmitted is sent out again.
0 SPI transmit buffer not empty
1
SPI transmit buffer empty
4
MODF
Master mode fault flag
MODF is set if the SPI is configured as a master and the slave select input goes low, indicating some
other SPI device is also configured as a master. The SS pin acts as a mode fault error input only when
MSTR is 1, MODFEN is 1, and SSOE is 0; otherwise, MODF will never be set. MODF is cleared by
reading MODF while it is 1 and then writing to the SPI control register 1 (C1).
0 No mode fault error
1 Mode fault error detected
3–0
Reserved
This field is reserved.
This read-only field is reserved and always has the value 0.
16.3.5 SPI data register (SPIx_D)
This register is both the input and output register for SPI data. A write to the register
writes to the transmit data buffer, allowing data to be queued and transmitted.
When the SPI is configured as a master, data queued in the transmit data buffer is
transmitted immediately after the previous transmission has completed.
The SPTEF bit in the S register indicates when the transmit data buffer is ready to accept
new data. The S register must be read when SPTEF is set before writing to the SPI data
register; otherwise, the write is ignored.
Data may be read from the SPI data register any time after SPRF is set and before another
transfer is finished. Failure to read the data out of the receive data buffer before a new
transfer ends causes a receive overrun condition, and the data from the new transfer is
lost. The new data is lost because the receive buffer still held the previous character and
was not ready to accept the new data. There is no indication for a receive overrun
condition, so the application system designer must ensure that previous data has been
read from the receive buffer before a new transfer is initiated.
Chapter 16 8-Bit Serial Peripheral Interface (8-bit SPI)
MC9S08PA60 Reference Manual, Rev. 1, 9/2012
Freescale Semiconductor, Inc. 435
