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.
[5] Prohibition of operation is handled by
processing for transmission.
[4]