20 GENERAL-PURPOSE SERIAL INTERFACE (FSIO)
20-6
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
Setting input/output pins
All four pins
—
SIN
x
, SOUT
x
, SCLK
x
, and #SRDY
x—
are used in the clock-synchronized mode. 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
Write 0x0 to IRMD[1:0]/FSIO_IRDA
x
register to choose the normal interface.
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 as the master for clock-synchronized transfer, set SMD[1:0] to 0x0; when using the
serial interface as a slave, set SMD[1:0] to 0x1.
Setting the input clock
Clock-synchronized master mode
This mode operates with the internal clock generated by 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).”
Clock-synchronized slave mode
This mode operates with the clock that is output by the external master. This clock is input from the SCLK
x
pin. Therefore, there is no need to control the baud-rate timer.
Setting the receive FIFO level (advanced mode)
This serial interface incorporates a 4-byte receive FIFO allowing up to 4 bytes of data to be received without
an error even when the receive data register is not read. This serial interface can generate a receive-buffer full
interrupt when the specified number of data are received in the receive FIFO. Use FIFOINT[1:0]/FSIO_IRDA
x
register to set this number of data. Writing 0–3 to FIFOINT[1:0] sets the number of data to 1–4. The default
setting at initial reset is 0 so that a receive-buffer full interrupt will generate when one data is received.
Control and Operation of Clock-Synchronized Transfer
20.6.3
Transmit control
(1) Enabling transmit operation
Use the transmit-enable bit TXEN/FSIO_CTL
x
register for transmit control.
When transmit is enabled by writing 1 to this bit, the clock input to the shift register is enabled (ready for in-
put), thus allowing for data to be transmitted. The synchronizing clock input/output of the SCLK
x
pin is also
enabled (ready for input/output).
Transmit is disabled and the transmit data buffer (FIFO) is cleared by writing 0 to TXEN.
After the port function select bits are set for the serial inputs/outputs, the I/O direction of the #SRDY
x
and
SCLK
x
pins are changed at follows:
#SRDY
x
: When slave mode is set, a switch is made to output mode.
Otherwise, input mode is maintained.
SCLK
x
: When master mode is set, a switch is made to output mode.
Otherwise, input mode is maintained.
Note: In clock-synchronized transfers, the clock line is shared between the transmit and receive units,
so the communication mode is half-duplex. Therefore, TXEN and the receive-enable bit (RXEN/
FSIO_CTL
x
register) cannot be enabled simultaneously. When transmitting data, fix RXEN at 0
and do not change it during a transmit operation.
In addition, make sure that TXEN is not set to 0 during a transmit operation.