13 SYNCHRONOUS SERIAL INTERFACE (SPIA)
13-4
Seiko Epson Corporation
S1C17M20/M21/M22/M23/M24/M25
TECHNICAL MANUAL (Rev. 1.0)
f
CLK_SPIA
f
CLK_SPIA
f
SPICLK
= ——— ————
RLD = ————— - 1 (Eq. 13.1)
2
×
(RLD + 1)
f
SPICLK
×
2
Where
f
SPICLK
: SPICLK
n
frequency [Hz] (= baud rate [bps])
f
CLK_SPIA
: SPIA 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
SPIA 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 SPIA channel is
not used. Furthermore, the SPI
n
MOD.NOCLKDIV bit setting becomes ineffective.
SPIA keeps operating using the clock supplied from the external SPI master even if all the internal clocks halt
during SLEEP mode, so SPIA can receive data and can generate receive buffer full interrupts.
13.3.2 Clock Supply in DEBUG Mode
In master mode, the operating clock supply during DEBUG mode should be controlled using the T16_
m
CLK.DB-
RUN bit.
The CLK_T16_
m
supply to SPIA Ch.
n
is suspended when the CPU enters DEBUG mode if the T16_
m
CLK.DB-
RUN bit = 0. After the CPU returns to normal mode, the CLK_T16_
m
supply resumes. Although SPIA 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 SPIA Ch.
n
will keep operating in DEBUG mode.
SPIA 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.
13.3.3 SPI Clock (SPICLKn) 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 13.3.3.1 shows the clock waveform and data input/output timing in each setting.
SPInMOD register
Cycle No.
SPICLKn
SPICLKn
SPICLKn
SPICLKn
SDIn
(Master mode)
SDOn
(Slave mode)
SDOn
(Slave mode)
SDOn
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 SPInTXD register
Figure 13.3.3.1 SPI Clock Phase and Polarity (SPInMOD.LSBFST bit = 0, SPInMOD.CHLN[3:0] bits = 0x7)