12 SYNCHRONOUS SERIAL INTERFACE (SPIA)
12-8
Seiko Epson Corporation
S1C17M12/M13 TECHNICAL MANUAL
(Rev. 1.2)
Data reception
End
Read the SPInINTF.TBEIF bit
Write dummy data (or transmit data) to
the SPInTXD register
Read receive data from
the SPInRXD register
YES
NO
NO
YES
Receive data remained?
SPInINTF.TBEIF = 1 ?
Wait for an interrupt request
(SPInINTF.RBFIF = 1)
(A) Intermittent data reception
Data reception
End
Read the SPInINTF.TBEIF bit
Write dummy data (or transmit data) to
the SPInTXD register
Read receive data from
the SPInRXD register
YES
NO
NO
YES
Receive data remained?
SPInINTF.TBEIF = 1 ?
Wait for an interrupt request
(SPInINTF.TBEIF = 1)
(B) Continuous data reception
Write dummy data (or transmit data) to
the SPInTXD register
Wait for an interrupt request
(SPInINTF.RBFIF = 1)
Execute this sequence
within theSPICLKn
cycles equivalent to
“Data bit length - 1” from
an interrupt request
Negate the slave select signal output from
a general-purpose port
(
)
Negate the slave select signal output from
a general-purpose port
(
)
Assert the slave select signal output from
a general-purpose port
(
)
Assert the slave select signal output from
a general-purpose port
(
)
Figure 12.5.3.2 Data Reception Flowcharts in Master Mode
12.5.4 Terminating Data Transfer in Master Mode
A procedure to terminate data transfer in master mode is shown below.
1. Wait for an end-of-transmission interrupt (SPI
n
INTF.TENDIF bit = 1).
2. Set the SPI
n
CTL.MODEN bit to 0 to disable the SPIA Ch.
n
operations.
3. Stop the 16-bit timer to disable the clock supply to SPIA Ch.
n
.
12.5.5 Data Transfer in Slave Mode
A data sending/receiving procedure and operations in slave mode are shown below. Figures 12.5.5.1 and 12.5.5.2
show a timing chart and flowcharts, respectively.
Data sending procedure
1. Check to see if the SPI
n
INTF.TBEIF bit is set to 1 (transmit buffer empty).
2. Write transmit data to the SPI
n
TXD register.
3. Wait for a transmit buffer empty interrupt (SPI
n
INTF.TBEIF bit = 1).
4. Repeat Steps 2 and 3 until the end of transmit data.
Note: Transmit data must be written to the SPInTXD register after the SPInINTF.TBEIF bit is set to 1 by
the time the sending SPInTXD register data written is completed. If no transmit data is written
during this period, the data bits input from the SDIn pin are shifted and output from the SDOn
pin without being modified.