11 SYNCHRONOUS SERIAL INTERFACE (SPI)
11-10
Seiko epson Corporation
S1C17F13 TeChniCal Manual
(Rev. 1.0)
Terminating Data Transfer in Slave Mode
11.5.6
A procedure to terminate data transfer in slave mode is shown below.
1. Wait for an end-of-transmission interrupt (SPI
n
INTF.TENDIF bit = 1). Or determine end of transfer via the re-
ceived data.
2. Set the SPI
n
CTL.MODEN bit to 0 to disable the SPI Ch.
n
operations.
Interrupts
11.6
The SPI has a function to generate the interrupts shown in Table 11.6.1.
6.1 SPI Interrupt Function
Table 11.
Interrupt
Interrupt flag
Set condition
Clear condition
End of transmission
SPI
n
INTF.TENDIF When the SPI
n
INTF.TBEIF bit = 1 after the eighth
data bit has been sent
Writing 1
Receive buffer full
SPI
n
INTF.RBFIF
When the eighth data bit is received and the received
data is transferred from the shift register to the re-
ceived data buffer
Reading the SPI
n-
RXD register
Transmit buffer empty SPI
n
INTF.TBEIF
When transmit data written to the transmit data buf-
fer is transferred to the shift register
Writing to the
SPI
n
TXD register
The SPI provides interrupt enable bits corresponding to each interrupt flag. An interrupt request is sent to the inter-
rupt controller only when the interrupt flag, of which interrupt has been enabled by the interrupt enable bit, is set.
For more information on interrupt control, refer to the “Interrupt Controller” chapter.
The SPI
n
INTF register also contains the BSY bit that indicates the SPI operating status.
Figure 11.6.1 shows the SPI
n
INTF.BSY and SPI
n
INTF.TENDIF bit set timings.
Master mode
SPICLK
n
SDO
n
SPI
n
INTF.BSY
SPI
n
INTF.TENDIF
SPI
n
MOD register
1
2
3
7
8
CPHA bit
1
0
CPOL bit
1
0
Writing data to the SPI
n
TXD register
Slave mode
#SPISS
n
SPI
n
INTF.BSY
SPICLK
n
SDO
n
SPICLK
n
SDO
n
SPI
n
INTF.TENDIF
SPI
n
MOD register
1
2
3
7
8
CPHA bit
1
0
CPOL bit
1
0
Writing data to the SPI
n
TXD register
6.1 SPI
Figure 11.
n
INTF.BSY and SPI
n
INTF.TENDIF Bit Set Timings