R01UH0823EJ0100 Rev.1.00
Page 1396 of 1823
Jul 31, 2019
RX23W Group
38. Serial Peripheral Interface (RSPIa)
(c) Flow of Error Processing
The RSPI has three types of error. When a mode fault error is generated, the SPCR.SPE bit is automatically cleared,
stopping operations for transmission and reception. For errors from other sources, however, the SPCR.SPE bit is not
cleared and operations for transmission and reception continue; accordingly, we recommend clearing of the SPCR.SPE
bit to stop operations in the case of errors other than mode fault errors. Not doing so will lead to updating of the
SPSSR.SPECM[2:0] bits.
When interrupts are used and an error occurs, if the ICU.IRn.IR flag for the SPTI or SPRI interrupt request is set to 1,
clear the ICU.IRn.IR flag in the error processing routine. If the SPRI interrupt request is indicated, read the receive buffer
and initialize the sequencer in the RSPI.
Figure 38.38
Flowchart for Master Mode (Error Processing)
Set SPCR.SPE = 1 and set bits
SPTIE, SPRIE, and SPEIE
Proceed to
processing for
transmission
Proceed to
processing for
reception
Proceed to
error
processing
[3] Set the SPE bit to “enabled”.
Enable the required interrupts at the
same time (Disables the related
interrupt when using a polling).
Clear the SPSR.MODF, OVRF,
and PERF flags
End of initial settings
Pre-transfer processing
[1] Clear error sources.
Set SPCR2.SPIIE = 0
[2] Disable SPII interrupts.
Error processing
Start error
processing
SPEI interrupt?
Yes
No
SPSR.MODF = 0
Yes
SPCR.SPE = 0
SSL0 = inactive?
No
No
Error processing
Repeat the transfer processing
End of error
processing
[4]
[4] Read the port register and confirm that
the SSL0 pin is at the inactive level.
[5] Clear the ICU.IRn.IR flag
corresponding to SPTI, SPRI, etc.
Set SPCR.SPTIE = 0,
SPRIE = 0, SPEIE = 0,
and SPCR2.SPIIE = 0
Clear the SPSR.MODF, OVRF,
and PERF flags
[6] Run the initialization processing again, etc.
[5]
The order of processing can be changed.