13 SYNCHRONOUS SERIAL INTERFACE (SPIA)
S1C17M20/M21/M22/M23/M24/M25
Seiko Epson Corporation
13-3
TECHNICAL MANUAL (Rev. 1.0)
13.2.3 Pin Functions in Master Mode and Slave Mode
The pin functions are changed according to the master or slave mode selection. The differences in pin functions be-
tween the modes are shown in Table 13.2.3.1.
Table 13.2.3.1 Pin Function Differences between Modes
Pin
Function in master mode
Function in slave mode
SDIn
Always placed into input state.
SDOn
Always placed into output state.
This pin is placed into output state while a low level
is applied to the #SPISSn pin or placed into Hi-Z
state while a high level is applied to the #SPISSn
pin.
SPICLKn Outputs the SPI clock to external devices.
Output clock polarity and phase can be configured
if necessary.
Inputs an external SPI clock.
Clock polarity and phase can be designated accord-
ing to the input clock.
#SPISSn Not used.
This input function is not required to be assigned to
the port. To output the slave select signal in master
mode, use a general-purpose I/O port function.
Applying a low level to the #SPISSn pin enables
SPIA to transmit/receive data. While a high level is
applied to this pin, SPIA is not selected as a slave
device. Data input to the SDIn pin and the clock
input to the SPICLKn pin are ignored. When a high
level is applied, the transmit/receive bit count is
cleared to 0 and the already received bits are dis-
carded.
13.2.4 Input Pin Pull-Up/Pull-Down Function
The SPIA input pins (SDI
n
in master mode or SDI
n
, SPICLK
n
, and #SPISS
n
pins in slave mode) have a pull-up or
pull-down function as shown in Table 13.2.4.1. This function is enabled by setting the SPI
n
MOD.PUEN bit to 1.
Table 13.2.4.1 Pull-Up or Pull-Down of Input Pins
Pin
Master mode
Slave mode
SDIn
Pull-up
Pull-up
SPICLKn
–
SPInMOD.CPOL bit = 1: Pull-up
SPInMOD.CPOL bit = 0: Pull-down
#SPISSn
–
Pull-up
13.3 Clock Settings
13.3.1 SPIA Operating Clock
Operating clock in master mode
In master mode, the SPIA operating clock is supplied from the 16-bit timer. The following two options are pro-
vided for the clock configuration.
Use the 16-bit timer operating clock without dividing
By setting the SPI
n
MOD.NOCLKDIV bit to 1, the operating clock CLK_T16_
m
, which is configured by
selecting a clock source and a division ratio, for the 16-bit timer channel corresponding to the SPIA channel
is input to SPIA as CLK_SPIA
n
. Since this clock is also used as the SPI clock SPICLK
n
without changing,
the CLK_SPIA
n
frequency becomes the baud rate.
To supply CLK_SPIA
n
to SPIA, the 16-bit timer clock source must be enabled in the clock generator. It
does not matter how the T16_
m
CTL.MODEN and T16_
m
CTL.PRUN bits of the corresponding 16-bit timer
channel are set (1 or 0).
When setting this mode, the timer function of the corresponding 16-bit timer channel may be used for an-
other purpose.
Use the 16-bit timer as a baud rate generator
By setting the SPI
n
MOD.NOCLKDIV bit to 0, SPIA inputs the underflow signal generated by the corre-
sponding 16-bit timer channel and converts it to the SPICLK
n
. The 16-bit timer must be run with an appro-
priate reload data set. The SPICLK
n
frequency (baud rate) and the 16-bit timer reload data are calculated
by the equations shown below.