Slave Mode with Interrupt
Policy
Figure 111 shows the initialization phase and the transfer phase flows using the
interrupt.
The transfer format depends on the master controller.
Reading SPSTA at the beginning of the ISR is mandatory for clearing the SPIF flag.
Clear is effective when reading SPDAT.
Figure 113. Slave SPI Interrupt Policy Flows
SPI Initialization
Interrupt Policy
SPI Interrupt
Service Routine
Select Slave Mode
Get Status
MSTR = 0
Read SPSTA
Select Format
Get Data Received
program CPOL & CPHA
read SPDAT
Enable interrupt
Prepare New Transfer
ESPI =1
write data in SPDAT
Enable SPI
SPEN = 1
Prepare Transfer
write data in SPDAT
166
AT8xC51SND2C
4341D–MP3–04/05