18 UNIVERSAL SERIAL INTERFACE (USI)
18-20
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
When an overrun error occurs, the overrun error flag (SEIF/USI_SIF register) is set to 1. The receiving
operation continues even if this error occurs. SEIF is reset by writing 1. To reset an overrun error, write 1
to SEIF and then read the receive data buffer (USI_RD register) twice. The procedure that writes 1 to SEIF
and reads USI_RD register twice can be reversed.
I
2
C master/slave mode
An overrun error occurs when a transmit or receive trigger is issued after two-byte data has been received (the
first byte data exists in the receive data buffer and the second byte data exists in the shift register) without
the receive data buffer being read.
When an overrun error occurs, the overrun error flag (IMEIF/USI_IMIF register for I
2
C master mode or
ISEIF/USI_ISIF register for I
2
C slave mode) is set to 1. The receiving operation continues even if this error
occurs. IMEIF/ISEIF is reset by writing 1. To reset an overrun error, write 1 to IMEIF/ISEIF and then read
the receive data buffer (USI_RD register) twice.
Framing error (UART mode only)
If the stop bit is received as 0 in UART mode, the UART controller determines loss of sync and a framing error
occurs. If the stop bit is configured to two bits, only the first bit is checked.
The framing error flag (USEIF/USI_UIF register) is set to 1 if this error occurs. The received data is still trans-
ferred to the receive data buffer if this error occurs and the receiving operation continues, but the data cannot be
guaranteed, even if no framing error occurs for subsequent data receiving. The framing error flag is reset to 0
by writing 1.
Parity error (UART mode only)
If UPREN/USI_UCFG register has been set to 1 (parity enabled), data received is checked for parity in UART
mode. Data received in the shift register is checked for parity when sent to the receive data buffer. The match-
ing is checked against the UPMD/USI_UCFG register setting (odd or even parity). If the result is a non-match,
a parity error is issued, and the parity error flag (UPEIF/USI_UIF register) is set to 1. Even if this error occurs,
the data received is sent to the receive data buffer, and the receiving operation continues. However, the received
data cannot be guaranteed if a parity error occurs. The UPEIF flag is reset to 0 by writing 1.
USI Interrupts and DMA
18.7
This section describes the USI interrupts generated in each interface mode and invoking DMA.
For more information on interrupt processing and DMA transfer, see the “Interrupt Controller (ITC)” chapter and
the “DMA Controller (DMAC)” chapter, respectively.
The USI outputs one interrupt signal shared by the all interrupt causes to the interrupt controller (ITC). Inspect the
interrupt flags available in each mode to determine the interrupt cause occurred.
Interrupts in UART Mode
18.7.1
The UART mode includes a function for generating the following three different types of interrupts.
• Transmit buffer empty interrupt
• Receive buffer full interrupt
• Receive error interrupt
Transmit buffer empty interrupt
To use this interrupt, set UTDIE/USI_UIE register to 1. If UTDIE is set to 0 (default), interrupt requests for this
cause will not be sent to the ITC.
When transmit data written to the transmit data buffer is transferred to the shift register, the USI module sets
UTDIF/USI_UIF register to 1, indicating that the transmit data buffer is empty. If transmit buffer empty inter-
rupts are enabled (UTDIE = 1), an interrupt request is sent simultaneously to the ITC. An interrupt occurs if
other interrupt conditions are met. You can inspect the UTDIF flag in the interrupt handler routine to determine
whether the USI (UART mode) interrupt is attributable to a transmit buffer empty. If UTDIF is 1, the next trans-
mit data can be written to the transmit data buffer by the interrupt handler routine.