13 SYNCHRONOUS SERIAL INTERFACE (SPIA)
13-6
Seiko Epson Corporation
S1C17M20/M21/M22/M23/M24/M25
TECHNICAL MANUAL (Rev. 1.0)
4. Wait for an SPIA interrupt when using the interrupt.
5. Repeat Steps 2 to 4 (or 2 and 3) until the end of transmit data.
6. Negate the slave select signal by controlling the general-purpose output port (if necessary).
Data sending operations
SPIA Ch.
n
starts data sending operations when transmit data is written to the SPI
n
TXD register.
The transmit data in the SPI
n
TXD register is automatically transferred to the shift register and the SPI
n
INTF.
TBEIF bit is set to 1. If the SPI
n
INTE.TBEIE bit = 1 (transmit buffer empty interrupt enabled), a transmit buf-
fer empty interrupt occurs at the same time.
The SPICLK
n
pin outputs clocks of the number of the bits specified by the SPI
n
MOD.CHLN[3:0] bits and the
transmit data bits are output in sequence from the SDO
n
pin in sync with these clocks.
Even if the clock is being output from the SPICLK
n
pin, the next transmit data can be written to the SPI
n
TXD
register after making sure the SPI
n
INTF.TBEIF bit is set to 1.
If transmit data has not been written to the SPI
n
TXD register after the last clock is output from the SPICLK
n
pin, the clock output halts and the SPI
n
INTF.TENDIF bit is set to 1. At the same time SPIA issues an end-of-
transmission interrupt request if the SPI
n
INTE.TENDIE bit = 1.
SPICLKn
SDOn
SPInINTF.TBEIF
SPInINTF.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
Data (W)
→
SPInTXD
Data (W)
→
SPInTXD
1 (W)
→
SPInINTF.TENDIF
Data (W)
→
SPInTXD
Figure 13.5.2.1 Example of Data Sending Operations in Master Mode (SPInMOD.CHLN[3:0] bits = 0x7)
Data transmission
End
Negate the slave select signal output from
a general-purpose port
(
)
Assert the slave select signal output from
a general-purpose port
(
)
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 13.5.2.2 Data Transmission Flowchart in Master Mode