R01UH0823EJ0100 Rev.1.00 Page 1380 of 1823
Jul 31, 2019
RX23W Group 38. Serial Peripheral Interface (RSPIa)
(5) When SPDR is read in the receive buffer full interrupt routine or in the receive buffer full detecting process by
polling the SPRF flag, the receive data can be read. When the receive data is read, the SPRF flag becomes 0.
If transmit data is written to SPDR while the transmit buffer holds data that has not yet been transmitted (the SPTEF flag
is 0), the RSPI does not update the data in the transmit buffer. Transmit data should be written to SPDR in the transmit
buffer empty interrupt request routine or in the transmit buffer empty detecting process by polling the SPTEF flag. To use
a transmit buffer empty interrupt, set the SPTIE bit in SPCR to 1.
When setting the SPCR.SPE bit to 0 (RSPI disabled), the SPCR.SPTIE bit should also be set to 0. Otherwise (if the
SPCR.SPE bit is 0 and the SPCR.SPTIE is 1), a transmit buffer empty interrupt request will occur.
When serial transfer ends with the receive buffer being full (the SPRF flag is 1), the RSPI does not copy data from the
shift register to the receive buffer, and detects an overrun error (refer to
section 38.3.8, Error Detection). To prevent a
receive data overrun error, read the received data using a receive buffer full interrupt request before the next serial
transfer ends. To use an RSPI receive buffer full interrupt, set the SPCR.SPRIE bit to 1.
Transmit and receive interrupts or the corresponding IRn.IR flags (where n is the interrupt vector number) in the ICU can
be used to confirm the states of the transmit and receive buffers. Refer to
section 15, Interrupt Controller (ICUb), for
the interrupt vector numbers. The status of the transmit and receive buffers can be also confirmed by the SPTEF and
SPRF flags.