19 UNIVERSAL SERIAL INTERFACE WITH LCD INTERFACE (USIL)
19-12
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
The STDIF flag indicates the transmit data buffer status. STDIF is set to 1 indicating that the transmit data buf-
fer becomes empty when data written to the transmit data buffer is sent to the transmit shift register. STDIF is
an interrupt flag. An interrupt or DMA request can be generated when this flag is set to 1 (see Section 19.7).
Write subsequent data to the transmit data buffer to start the following transmission using this interrupt or
DMA. The transmit data buffer size is 1 byte, but a shift register is provided separately to allow data to be writ-
ten while the previous data is being sent. If an interrupt or DMA is not used for transmission, be sure to confirm
that the transmit data buffer is empty before writing transmit data. Writing data before STDIF has been set will
overwrite earlier transmit data inside the transmit data buffer.
In SPI master mode, the SSIF flag indicates the USIL status. This flag switches to 1 when transmit data is writ-
ten to the transmit buffer and reverts to 0 after both the shift register and transmit buffer become empty. Read
this flag to check whether the SPI controller is operating or at standby.
spi_ck (master mode)
TD[7:0]
Shift register
USIL_CK pin
(SCPOL = 0, SCPHA = 1)
USIL_CK pin
(SCPOL = 0, SCPHA = 0)
USIL_DO pin
SSIF (master mode)
STDIF
Interrupt
A
D7
A
D6
A
D5
A
D4
A
D3
A
D2
A
D1
B
D5
B
D4
B
D3
B
D2
B
D1
A
D0
B
D0
Write
Write
Transmit buffer empty interrupt
Reset by writing 1
Reset by writing 1
Transmit buffer empty interrupt
(MSB first)
Data A
Data B
B
D7
B
D6
5.2.1 Data Transmission Timing Chart (SPI mode)
Figure 19.
Data reception
In SPI master mode, write dummy data to the transmit data buffer. Writing to the transmit data buffer creates
the trigger for reception as well as transmission start. Writing actual transmit data enables simultaneous trans-
mission and reception. This starts the SPI clock output from the USIL_CK pin.
In SPI slave mode, the module waits until the clock is input from the USIL_CK pin. There is no need to write
to the transmit data buffer if no transmission is required. The receiving operation is started by the clock input
from the master device. If data is transmitted simultaneously, write transmit data to the transmit data buffer be-
fore the clock is input.
The data is received in sequence in the shift register at the SPI clock edge (see Figure 19.4.5.1). The received
data is loaded into the receive data buffer once the 8 bits of data are received in the shift register.
The received data in the buffer can be read from RD[7:0]/USIL_RD register.
The SPI controller includes two status flags for transfer control: SRDIF/USIL_SIF register and SSIF/USIL_SIF
register.
The SRDIF flag indicates the receive data buffer status. This flag is set to 1 when the data received in the shift
register is loaded into the receive data buffer, indicating that the received data can be read out. SRDIF is an
interrupt flag. An interrupt or DMA request can be generated when this flag is set to 1 (see Section 19.7). Read
the received data from the receive data buffer using this interrupt or DMA. The receive data buffer size is 1
byte, therefore the received data must be read before the subsequent data reception has completed. Furthermore,
SRDIF must be reset by writing 1. While SRDIF is set to 1, the next received data will not be transferred from
the shift register to the receive data buffer (the first byte data exists in the receive data buffer and the second
byte data exists in the shift register). An overrun error occurs if the third byte data is received in this condition,
as the second byte data in the shift register is corrupted (an overrun error occurs at the time the first bit of the
third byte is fetched).
In SPI master mode, the SSIF flag indicates the shift register status. This flag switches to 1 at the beginning of
data reception and reverts to 0 once the data is received. Read this flag to check whether the SPI controller is
operating or at standby.