R01UH0823EJ0100 Rev.1.00
Page 1399 of 1823
Jul 31, 2019
RX23W Group
38. Serial Peripheral Interface (RSPIa)
(6) Software Processing Flow
show examples of the flow of software processing.
(a) Transmit Processing Flow
Figure 38.40
Flowchart in Slave Mode (Transmission)
(b) Receive Processing Flow
The RSPI does not handle receive-only operation, so processing for transmission is required.
Figure 38.41
Flowchart in Slave Mode (Reception)
[4] Each time the handling routine
runs, access to the number of
frames set in the
SPDCR.SPFC[1:0] bits proceeds.
Processing for transmission
Start processing
for transmission
SPTI interrupt generated
or SPSR.SPTEF = 1?*
1
Yes
No
Have the last of the data been
written?
Yes
No
End of
processing for
transmission
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.
[4]
Write data for transmission to
SPDR
Note 1.
When using a polling for the SPTEF flag, proceed to the transmit data writing process after reading the SPTEF flag as 1.
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.
Processing for reception
Start processing
for reception
SPRI interrupt generated
or SPSR.SPRF = 1?
Yes
No
Read receive data from SPDR
Have the last of the data been
read?
Yes
No
SPCR.SPRIE = 0
End of
processing for
reception
[4] Each time the handling routine runs,
access to the number of frames set
in the SPDCR.SPFC[1:0] bits
proceeds.
[4]