19 UNIVERSAL SERIAL INTERFACE (USI) [S1C17564]
19-4
Seiko Epson Corporation
S1C17554/564 TECHNICAL MANUAL
USI Module Settings
19.4
Make the following settings before starting data transfers using the USI module.
(1) Configure the pins to be used for USI according to the interface mode. (See Section 19.2.)
(2) Program the clock source module to supply the clock required to the USI module. (See Section 19.3.)
(3) Reset the USI module.
(4) Set the USI interface mode and a general condition (MSB first/LSB first) to be applied to all interface modes.
(5) Set the data format and operating conditions for the interface mode selected.
(6) Set interrupt conditions if necessary. (See Section 19.7.)
USI Module Software Reset
19.4.1
Writing 0x0 to USIMOD[2:0]/USI_GCFGx register resets the USI module circuits. Be sure to perform software
reset before setting the interface mode.
Interface Mode
19.4.2
The USI module provides five serial interface functions shown in Section 19.1. Each channel can be configured to
one of them using the USIMOD[2:0]/USI_GCFGx register.
4.2.1 Interface Mode Selection
Table 19.
USIMOD[2:0]
Interface mode
0x7–0x6
Reserved
0x5
I2C slave
0x4
I2C master
0x3
Reserved
0x2
SPI master
0x1
UART
0x0
Software reset
(Default: 0x0)
Note: Be sure to perform software reset and set the interface mode before changing other USI configu-
rations.
General Settings for All Interface Modes
19.4.3
MSB first/LSB first selection
Use LSBFST/USI_GCFGx register to select whether the data MSB or LSB is input/output first.
LSB first is selected when LSBFST is set to 0 (default). MSB first is selected when LSBFST is set to 1.
Settings for UART Mode
19.4.4
When the USI is used in UART mode, configure the data length, stop bit, and parity bit. The start bit length is fixed
at 1 bit.
Data length
Use UCHLN/USI_UCFGx register to select the data length. Setting UCHLN to 0 (default) configures the data
length to 7 bits. Setting UCHLN to 1 configures it to 8 bits.
Stop bit
Use USTPB/USI_UCFGx register to select the stop bit length. Setting USTPB to 0 (default) configures the stop
bit length to 1 bit. Setting USTPB to 1 configures it to 2 bits.
Parity bit
Use UPREN/USI_UCFGx register to select whether the parity function is enabled or not. Setting UPREN to 0
(default) disables the parity function. In this case, no parity bit will be added to transfer data and receive data
will not be checked for parity. Setting UPREN to 1 enables the parity function. In this case, a parity bit will be
added to transfer data and receive data will be checked for parity.