18 UNIVERSAL SERIAL INTERFACE (USI)
S1C33L26 TECHNICAL MANUAL
Seiko Epson Corporation
18-19
(1) Waiting for start condition
The procedure is the same as that of data transmission in I
2
C slave mode.
(2) Receiving slave address and transfer direction data bit
The procedure is the same as that of data transmission in I
2
C slave mode.
(3) Data reception
When the transfer direction bit received with the slave address in Step (2) is 0, start data reception by set-
ting ISTGMOD[2:0] to 0x3 and writing 1 to ISTG.
When clocks are input, the I
2
C controller loads the USI_DO pin status to the shift register in sync with each
clock. The received data is loaded to the receive data buffer (RD[7:0]/USI_RD register) once the 8-bit data
has been received in the shift register.
Writing 1 to ISTG sets ISBSY to 1. When the received data is loaded to the receive data buffer, ISBSY
reverts to 0 and ISSTA[2:0] is set to 0x3 (end of receive data). An interrupt request can be generated at this
point. Read the received data from the receive data buffer using this interrupt.
It is necessary to send back an ACK or NAK to the master device after an 8-bit data has been received.
To send back an ACK, set ISTGMOD[2:0] to 0x4 and write 1 to ISTG. To send back a NAK, set
ISTGMOD[2:0] to 0x5 and write 1 to ISTG.
ISBSY is set to 1 while an ACK/NAK is being sent and it reverts to 0 when the transmission has completed.
An interrupt request can be generated at this point. When an ACK or NAK has been sent, ISSTA[2:0] is set
to 0x4.
Repeat an 8-bit data reception and ACK (NAK) transmission for the required number of times.
(4) When a stop condition is received
If the ISSTA[2:0] value read during data reception is 0x1, the I
2
C master device has generated a stop condi-
tion (see Figure 18.5.3.6). In this case, abort data reception.
Clock stretch function
While data is being sent/received, this I
2
C slave generates a clock stretch status by pulling down the SCL line to
low to make a wait request to the master device after an ACK is sent/received until the following data transfer is
started.
Receive Errors
18.6
In UART mode, three different receive errors (overrun error, framing error, and parity error) may be detected while
receiving data. In SPI and I
2
C modes, overrun errors may be detected while receiving data.
Since receive errors are interrupt causes, they can be processed by generating interrupts. For more information on
interrupt control, see Section 18.7.
Overrun error (all interface modes)
UART mode
An overrun error occurs if the next reception is completed when URDIF is 1 and the receive data buffer (USI_
RD register) is not read (an overrun error occurs at the time stop bit has been received).
When an overrun error occurs, the overrun error flag (UOEIF/USI_UIF register) is set to 1. The receiving
operation continues even if this error occurs. To reset UOEIF, perform USI software reset (write 0x0 to
USIMOD[2:0]/USI_GCFG register) to initialize USI.
SPI mode
An overrun error occurs if data are received successively when SRDIF is 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).