12 SYNCHRONOUS SERIAL INTERFACE (SPIA)
S1C17M12/M13 TECHNICAL MANUAL
Seiko Epson Corporation
12-9
(Rev. 1.2)
Data receiving procedure
1. Wait for a receive buffer full interrupt (SPI
n
INTF.RBFIF bit = 1).
2. Read the received data from the SPI
n
RXD register.
3. Repeat Steps 1 and 2 until the end of data reception.
Data transfer operations
The following shows the slave mode operations different from master mode:
• Slave mode operates with the SPI clock supplied from the external SPI master to the SPICLK
n
pin.
The data transfer rate is determined by the SPICLK
n
frequency. It is not necessary to control the 16-bit timer.
• SPIA can operate as a slave device only when the slave select signal input from the external SPI master to the
#SPISS
n
pin is set to the active (low) level.
If #SPISS
n
= high, the software transfer control, the SPICLK
n
pin input, and the SDI
n
pin input are all inef-
fective. If the #SPISS
n
signal goes high during data transfer, the transfer bit counter is cleared and data in the
shift register is discarded.
• Slave mode starts data transfer when SPICLK
n
is input from the external SPI master after the #SPISS
n
signal
is asserted. Writing transmit data is not a trigger to start data transfer. Therefore, it is not necessary to write
dummy data to the transmit data buffer when performing data reception only.
• Data transmission/reception can be performed even in SLEEP mode, it makes it possible to wake the CPU up
using an SPIA interrupt.
Other operations are the same as master mode.
Notes: • If data of the number of bits specified by the SPInMOD.CHLN[3:0] bits is received when the
SPInINTF.RBFIF bit is set to 1, the SPInRXD register is overwritten with the newly received
data and the previously received data is lost. In this case, the SPInINTF.OEIF bit is set.
• When the clock for the first bit is input from the SPICLKn pin, SPIA starts sending the data
currently stored in the shift register even if the SPInINTF.TBEIF bit is set to 1.
#SPISSn
SPICLKn
SDOn
SDIn
SPInINTF.TBEIF
SPInINTF.RBFIF
Software operations
1 2 3
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
Data (W)
→
SPInTXD
Data (W)
→
SPInTXD
Data (W)
→
SPInTXD
SPInRXD
→
Data (R)
SPInRXD
→
Data (R)
Figure 12.5.5.1 Example of Data Transfer Operations in Slave Mode (SPInMOD.CHLN[3:0] bits = 0x7)