19 UNIVERSAL SERIAL INTERFACE (USI) [S1C17564]
19-20
Seiko Epson Corporation
S1C17554/564 TECHNICAL MANUAL
Interrupts in UART Mode
19.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_UIEx 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_UIFx 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.
Receive buffer full interrupt
To use this interrupt, set URDIE/USI_UIEx register to 1. If URDIE is set to 0 (default), interrupt requests for
this cause will not be sent to the ITC.
If a received data is loaded into the receive data buffer, the USI module sets URDIF/USI_UIFx register to 1.
If receive buffer full interrupts are enabled (URDIE = 1), an interrupt request is sent simultaneously to the
ITC. An interrupt occurs if other interrupt conditions are met. You can inspect the URDIF flag in the interrupt
handler routine to determine whether the USI (UART mode) interrupt is attributable to a receive buffer full.
If URDIF is 1, the received data can be read from the receive data buffer by the interrupt handler routine.
However, be sure to check whether a receive error has occurred or not.
Receive error interrupt
To use this interrupt, set UEIE/USI_UIEx register to 1. If UEIE is set to 0 (default), interrupt requests for this
cause will not be sent to the ITC.
The USI module sets an error flag (UPEIF/USI_UIFx register, USEIF/USI_UIFx register, or UOEIF/USI_UIFx
register) to 1 if a parity error, framing error, or overrun error is detected when receiving data. If receive error
interrupts are enabled (UEIE = 1), an interrupt request is sent simultaneously to the ITC. If other interrupt con-
ditions are satisfied, an interrupt occurs. You can inspect the UPEIF, USEIF, and UOEIF flags in the interrupt
handler routine to determine whether the USI (UART mode) interrupt was caused by a receive error. If any of
the error flags has the value 1, the interrupt handler routine will proceed with error recovery.
Interrupts in SPI Master Mode
19.7.2
The SPI master mode include 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 STDIE/USI_SIEx register to 1. If STDIE 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
STDIF/USI_SIFx register to 1, indicating that the transmit data buffer is empty. If transmit buffer empty inter-
rupts are enabled (STDIE = 1), an interrupt request is sent simultaneously to the ITC. An interrupt occurs if
other interrupt conditions are met. You can inspect the STDIF flag in the interrupt handler routine to determine
whether the USI (SPI master mode) interrupt is attributable to a transmit buffer empty. If STDIF is 1, the next
transmit data can be written to the transmit data buffer by the interrupt handler routine.