19 UNIVERSAL SERIAL INTERFACE (USI) [S1C17564]
19-6
Seiko Epson Corporation
S1C17554/564 TECHNICAL MANUAL
SCHLN = 0, SCMD =
*
SCHLN = 1, SCMD = 0
SCHLN = 1, SCMD = 1
Command bit
D7 (D0) D6 (D1) D5 (D2) D4 (D3) D3 (D4) D2 (D5) D1 (D6) D0 (D7)
4.5.2 9-bit Transfer Data Format in SPI Master Mode
Figure 19.
Receive data mask function
The USI in SPI master mode provides a receive data mask (data retransmission) function. Setting SMSKEN/
USI_SCFGx register to 1 enables this function. When the receive data mask function is enabled, the USI trans-
mits the data stored in the transmit data buffer (TD[7:0]/USI_TDx register) repeatedly until the slave device
sends back a value other than the mask data set to SMSK[7:0]/USI_SMSKx register. In this case, the transmit
buffer empty and receive data buffer full interrupt flags are not set and no interrupt is generated. In other words,
the USI does not accept the receive data while the slave device is transmitting the mask data. For example,
when SMSK[7:0] is 0xff, no interrupt occurs until data other than 0xff is received.
For normal data transfer, set SMSKEN to 0 (default) to disable the receive data mask function.
Settings for I
19.4.6
2C Mode
The I2C mode does not need to set data format and other conditions. The data length in I2C mode is fixed at 8 bits.
Data Transfer Control
19.5
This section describes how to control data transfers. The following explanations assume that the configurations de-
scribed above and interrupt settings have already been finished.
Data Transfer in UART Mode
19.5.1
Data transmission
To start data transmission in UART mode, write the transmit data to the transmit data buffer (TD[7:0]/USI_TDx
register).
The buffer data is sent to the transmit shift register, and the start bit is output from the US_SDOx pin. The data
in the shift register is then output in sequence. Following output of the eighth data bit, the parity bit (if parity is
enabled) and the stop bit are output.
The transmitter circuit includes two status flags: UTDIF/USI_UIFx register and UTBSY/USI_UIFx register.
The UTDIF flag indicates the transmit data buffer status. This flag is set to 1 indicating that the transmit data
buffer becomes empty when data written to the transmit data buffer is sent to the transmit shift register. UTDIF
is an interrupt flag. An interrupt 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. The transmit
data buffer size is 1 byte, but a shift register is provided separately to allow data to be written while the previous
data is being sent. If an interrupt is not used for transmission, be sure to confirm that the transmit data buffer is
empty before writing transmit data. Writing data before UTDIF has been set will overwrite earlier transmit data
inside the transmit data buffer. After UTDIF is set to 1, it can be reset to 0 by writing 1.
The UTBSY flag indicates the shift register status. This flag switches to 1 when transmit data is loaded from
the transmit data buffer to the shift register and reverts to 0 once the data is sent. Read this flag to check wheth-
er the transmitter circuit is operating or at standby.