11 SYNCHRONOUS SERIAL INTERFACE (SPI)
11-4
Seiko epson Corporation
S1C17F13 TeChniCal Manual
(Rev. 1.0)
f
CLK_SPI
f
CLK_SPI
f
SPICLK
= ——— ————
RLD = ————— - 1 (Eq. 11.1)
2
×
(RLD + 1)
f
SPICLK
×
2
Where
f
SPICLK
: SPICLK
n
frequency [Hz] (= baud rate [bps])
f
CLK_SPI
: SPI operating clock frequency [Hz]
RLD: 16-bit timer reload data value
For controlling the 16-bit timer, refer to the “16-bit Timers” chapter.
Operating clock in slave mode
The SPI set in slave mode operates with the clock supplied from the external SPI master to the SPICLK
n
pin.
The 16-bit timer channel (including the clock source selector and the divider) corresponding to the SPI channel
is not used. Furthermore, the SPI
n
MOD.NOCLKDIV bit setting becomes ineffective.
The SPI keeps operating using the clock supplied from the external SPI master even if all the internal clocks
halt during SLEEP mode, so the SPI can receive data and can generate receive buffer full interrupts.
Clock Supply in DEBUG Mode
11.3.2
In master mode, the operating clock supply during DEBUG mode should be controlled using the T16_
m
CLK.
DBRUN bit.
The CLK_T16_
m
supply to the SPI Ch.
n
is suspended when the CPU enters DEBUG mode if the T16_
m
CLK.
DBRUN bit = 0. After the CPU returns to normal mode, the CLK_T16_
m
supply resumes. Although the SPI Ch.
n
stops operating when the CLK_T16_
m
supply is suspended, the output pins and registers retain the status before
DEBUG mode was entered. If the T16_
m
CLK.DBRUN bit = 1, the CLK_T16_
m
supply is not suspended and the
SPI Ch.
n
will keep operating in DEBUG mode.
The SPI in slave mode operates with the external SPI master clock input from the SPICLK
n
pin regardless of
whether the CPU is placed into DEBUG mode or normal mode.
SPI Clock (SPICLK
11.3.3
n
) Phase and Polarity
The SPICLK
n
phase and polarity can be configured separately using the SPI
n
MOD.CPHA bit and the SPI
n
MOD.
CPOL bit, respectively. Figure 11.3.3.1 shows the clock waveform and data input/output timing in each setting.
SPI
n
MOD register
Cycle No.
SPICLK
n
SPICLK
n
SPICLK
n
SPICLK
n
SDI
n
(Master mode)
SDO
n
(Slave mode)
SDO
n
(Slave mode)
SDO
n
1
CPHA bit
1
0
1
0
x
x
1
0
CPOL bit
1
1
0
0
x
x
x
x
2
3
4
5
6
7
8
MSB
LSB
MSB
LSB
MSB
LSB
MSB
LSB
Writing data to the SPI
n
TXD register
3.3.1 SPI Clock Phase and Polarity (SPI
Figure 11.
n
MOD.LSBFST bit = 0)