12 SYNCHRONOUS SERIAL INTERFACE (SPIA)
12-10
Seiko Epson Corporation
S1C17M12/M13 TECHNICAL MANUAL
(Rev. 1.2)
Data reception
End
Read receive data from
the SPInRXD register
NO
YES
Receive data remained?
Wait for an interrupt request
(SPInINTF.RBFIF = 1)
Data transmission
End
Read the SPInINTF.TBEIF bit
Write transmit data to
the SPInTXD register
YES
NO
NO
YES
Transmit data remained?
SPInINTF.TBEIF = 1 ?
Wait for an interrupt request
(SPInINTF.TBEIF = 1)
Figure 12.5.5.2 Data Transfer Flowcharts in Slave Mode
12.5.6 Terminating Data Transfer in Slave Mode
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 SPIA Ch.
n
operations.
12.6 Interrupts
SPIA has a function to generate the interrupts shown in Table 12.6.1.
Table 12.6.1 SPIA Interrupt Function
Interrupt
Interrupt flag
Set condition
Clear condition
End of transmission SPInINTF.TENDIF When the SPInINTF.TBEIF bit = 1 after data of
the specified bit length (defined by the SPInMOD.
CHLN[3:0] bits) has been sent
Writing 1
Receive buffer full
SPInINTF.RBFIF
When data of the specified bit length is received and
the received data is transferred from the shift register
to the received data buffer
Reading the SPIn-
RXD register
Transmit buffer empty SPInINTF.TBEIF
When transmit data written to the transmit data buf-
fer is transferred to the shift register
Writing to the
SPInTXD register
Overrun error
SPInINTF.OEIF
When the receive data buffer is full (when the re-
ceived data has not been read) at the point that re-
ceiving data to the shift register has completed
Writing 1
SPIA provides interrupt enable bits corresponding to each interrupt flag. An interrupt request is sent to the interrupt
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 SPIA operating status.
Figure 12.6.1 shows the SPI
n
INTF.BSY and SPI
n
INTF.TENDIF bit set timings.