11 SYNCHRONOUS SERIAL INTERFACE (SPI)
S1C17F13 TeChniCal Manual
Seiko epson Corporation
11-3
(Rev. 1.0)
Pin Functions in Master Mode and Slave Mode
11.2.3
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 11.2.3.1.
2.3.1 Pin Function Differences between Modes
Table 11.
Pin
Function in master mode
Function in slave mode
SDI
n
Always placed into input state.
SDO
n
Always placed into output state.
This pin is placed into output state while a low level
is applied to the #SPISS
n
pin or placed into Hi-Z
state while a high level is applied to the #SPISS
n
pin.
SPICLK
n
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.
#SPISS
n
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 #SPISS
n
pin enables
the SPI to transmit/receive data. While a high level
is applied to this pin, the SPI is not selected as a
slave device. Data input to the SDI
n
pin and the
clock input to the SPICLK
n
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.
Input Pin Pull-Up/Pull-Down Function
11.2.4
The SPI 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 11.2.4.1. This function is enabled by setting the SPI
n
MOD.PUEN bit to 1.
2.4.1 Pull-Up or Pull-Down of Input Pins
Table 11.
Pin
Master mode
Slave mode
SDI
n
Pull-up
Pull-up
SPICLK
n
–
SPI
n
MOD.CPOL bit = 1: Pull-up
SPI
n
MOD.CPOL bit = 0: Pull-down
#SPISS
n
–
Pull-up
Clock Settings
11.3
SPI Operating Clock
11.3.1
Operating clock in master mode
In master mode, the SPI 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 SPI channel
is input to the SPI as CLK_SPI
n
. Since this clock is also used as the SPI clock SPICLK
n
without changing,
the CLK_SPI
n
frequency becomes the baud rate.
To supply CLK_SPI
n
to the SPI, the 16-bit timer clock source must be enabled in the clock generator. Also
the T16_
m
CTL.MODEN bit of the corresponding 16-bit timer channel must be set to 1. It does not matter
how the T16_
m
CTL.PRUN bit is 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, the SPI input 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.