14-9
Seiko Epson Corporation
S1C31D50 TECHNICAL MANUAL
(Rev. 1.00)
14.5.3.
Data Reception in Master Mode
A data receiving procedure and operations in master mode are shown below. Figures 14.5.3.1 and
14.5.3.2 show a timing chart and flowcharts, respectively.
Data receiving procedure
1.
Assert the slave select signal by controlling the general-purpose output port (if necessary).
2.
Check to see if the SPIA_
n
INTF.TBEIF bit is set to 1 (transmit buffer empty).
3.
Write dummy data (or transmit data) to the SPIA_
n
TXD register.
4.
Wait for a transmit buffer empty interrupt (SPIA_
n
INTF.TBEIF bit = 1).
5.
Write dummy data (or transmit data) to the SPIA_
n
TXD register.
6.
Wait for a receive buffer full interrupt (SPIA_
n
INTF.RBFIF bit = 1).
7.
Read the received data from the SPIA_
n
RXD register.
8.
Repeat Steps 5 to 7 until the end of data reception.
9.
Negate the slave select signal by controlling the general-purpose output port (if necessary).
Note:
To perform continuous data reception without stopping SPICLK
n
, Steps 7 and 5 operations must be
completed within the SPICLK
n
cycles equivalent to
“Data
bit length -
1”
after Step 6.
Data receiving operations
SPIA Ch.
n
starts data receiving operations simultaneously with data sending operations when transmit
data (may be dummy data if data transmission is not required) is written to the SPIA_
n
TXD register.
The SPICLK
n
pin outputs clocks of the number of the bits specified by the SPIA_
n
MOD.CHLN[3:0]
bits. The transmit data bits are output in sequence from the SDO
n
pin in sync with these clocks and
the receive data bits input from the SDI
n
pin are shifted into the shift register.
When the last clock is output from the SPICLK
n
pin and receive data bits are all shifted into the shift
register, the received data is transferred to the receive data buffer and the SPIA_
n
INTF.RBFIF bit is set
to 1. At the same time SPIA issues a receive buffer full interrupt request if the SPIA_
n
INTE.RBFIE bit
= 1. After that, the re- ceived data in the receive data buffer can be read through the SPIA_
n
RXD
register.
Note
:
If data of the number of the bits specified by the SPIA_
n
MOD.CHLN[3:0] bits is received when the
SPIA_
n
INTF.RBFIF bit is set to 1, the SPIA_
n
RXD register is overwritten with the newly received data
and the previously received data is lost. In this case, the SPIA_
n
INTF.OEIF bit is set.
Figure 14.5.3.1 Example of Data Receiving Operations in Master Mode (SPIA_
n
MOD.CHLN[3:0] bits = 0x7)
Data (W) → SPIA_
n
TXD
Data (W)→SPIA_
n
TXD
Data (W)→ SPIA_
n
TXD
SPIA_
n
RXD → Data (R)
1 (W) → SPIA_
n
INTF.TENDIF
SPIA_
n
RXD → Data (R)
SPIA_
n
RXD → Data (R)
SPICLK
n
SDO
n
SDI
n
SPIA_
n
INTF.TBEIF
SPIA_
n
INTF.RBFIF
SPIA_
n
INTF.TENDIF
Software operations
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
Summary of Contents for S1C31D50
Page 461: ...25 1 Seiko Epson Corporation S1C31D50 TECHNICAL MANUAL Rev 1 00 25 Package TQFP12 48PIN ...
Page 462: ...25 2 Seiko Epson Corporation S1C31D50 TECHNICAL MANUAL Rev 1 00 QFP13 64PIN ...
Page 463: ...25 3 Seiko Epson Corporation S1C31D50 TECHNICAL MANUAL Rev 1 00 TQFP14 80PIN ...
Page 464: ...25 4 Seiko Epson Corporation S1C31D50 TECHNICAL MANUAL Rev 1 00 QFP15 100PIN ...