18 UNIVERSAL SERIAL INTERFACE (USI)
18-8
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
Sampling clock
USI_DI pin
Shift register
RD[7:0]
URBSY
URDIF
Interrupt
start
stop
stop
A
D7
parity
parity
(MSB first)
Data A
Data B
start B
D7
stop
parity
A
D0
C
D0
B
D0
start C
D7
Receive buffer full interrupt
Receive buffer full interrupt
Overrun error interrupt
(when Data B has not been read)
Read
Reset by writing 1
5.1.2 Data Receiving Timing Chart (UART mode)
Figure 18.
Data Transfer in SPI Mode
18.5.2
Data transmission
To start data transmission in SPI mode, write the transmit data to the transmit data buffer (TD[7:0]/USI_TD
register).
The buffer data is sent to the transmit shift register. In SPI master mode, the module starts clock output from
the USI_CK pin. In SPI slave mode, the module awaits clock input from the USI_CK pin. The data in the shift
register is shifted in sequence at the clock rising or falling edge (see Figure 18.4.5.1) and sent from the USI_
DO pin.
The SPI controller includes two status flags for transfer control: STDIF/USI_SIF register and SSIF/USI_SIF
register.
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 18.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 USI status. This flag switches to 1 when transmit data is written
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
USI_CK pin
(SCPOL = 0, SCPHA = 1)
USI_CK pin
(SCPOL = 0, SCPHA = 0)
USI_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 18.