20 GENERAL-PURPOSE SERIAL INTERFACE (FSIO)
S1C33L26 TECHNICAL MANUAL
Seiko Epson Corporation
20-13
Setting Asynchronous Interface
20.7.2
When performing asynchronous transfer via the serial interface, the following must be done before data transfer can
be started:
1. Setting input/output pins
2. Setting the interface mode
3. Setting the transfer mode
4. Setting the input clock
5. Setting the data format
6. Setting the receive FIFO level
7. Setting interrupts and DMA
The following describes how to set each of the above. For details on interrupt/DMA settings, refer to Section 20.9,
“FSIO Interrupts and DMA.”
Note: Always make sure the serial interface is inactive (TXEN/FSIO_CTL
x
register and RXEN/FSIO_
CTL
x
register = 0) before making these settings. A change in settings during operation may result
in a malfunction.
Setting input/output pins
In the asynchronous mode, two pins—SIN
x
and SOUT
x
—are used. When an external clock is used, one more
pin, SCLK
x
, is also used. Configure the port function select bits to enable these pin functions according to the
channel to be used. For details of pin functions and how to switch over, see the “I/O Ports (GPIO)” chapter.
Setting the interface mode
Initialize IRMD[1:0]/FSIO_IRDA
x
register by writing 0x0 when using the serial interface as a normal interface,
or 0x2 when using the serial interface as an IrDA interface. This setting must be made before a transfer mode is
set.
Setting the transfer mode
Use SMD[1:0]/FSIO_CTL
x
register to set the transfer mode of the serial interface as described earlier. When
using the serial interface in the 8-bit asynchronous mode, set SMD[1:0] to 0x3, when using the serial interface
in the 7-bit asynchronous mode, set SMD[1:0] to 0x2.
Setting the input clock
In the asynchronous mode, the operating clock can be selected between the internal clock and an external clock
using SSCK/FSIO_CTL
x
register.
An external clock is selected (input from the SCLK
x
pin) by writing 1 to SSCK, and an internal clock is se-
lected by writing 0.
Internal clock
When internal clock is selected, the serial interface is clocked by the clock generated using the baud-rate
timer. Setup the baud-rate timer according to the transfer rate for each channel. For how to control the baud-
rate timer, see Section 20.5, “Baud-Rate Timer (Baud Rate Setting).”
External clock
When external clock is selected, the serial interface is clocked by a clock input from the SCLK
x
pin. There-
fore, there is no need to control the baud-rate timer.
Any desired clock frequency can be set. The clock input from the SCLK
x
pin is internally divided by 16 or
8 in the serial interface, in order to create a sampling clock (refer to “Sampling clock”). This division ratio
must also be considered when setting the transfer rate.
Sampling clock
In the asynchronous mode, SIO_CLK (the clock output by the baud-rate timer or input from the SCLK
x
pin) is internally divided in the serial interface, in order to create a sampling clock.