PKP
VS1000 P
ROGRAMMER
’
S
G
UIDE
VSMPG
SPI_CF_MASTER sets master mode. If not set, slave mode is used.
SPI_1 is the length of SPI data in bits. Example: For 8-bit data transfers, set
SPI_CF_DLEN to 7.
SPI_CF_FSIDLE contains the state of FSYNC when SPI_ST_TXRUNNING is clear.
This bit is only valid in master mode.
16.3.2
Clock Configuration SPIx_CLKCONFIG
SPIx_CLKCONFIG Bits
Name
Bits
Description
SPI_CC_CLKDIV
9:2
Clock divider
SPI_CC_CLKPOL
1
Clock polarity selection
SPI_CC_CLKPHASE
0
Clock phase selection
In master mode, SPI_CC_CLKDIV is the clock divider for the SPI block. The gener-
ated SCLK frequency
f
=
f
m
2
×
(
c
+1)
, where
f
m
is the master clock frequency and
c
is
SPI_CC_CLKDIV. Example: With a 12 MHz master clock, SPI_CC_CLKDIV=3 divides
the master clock by 4, and the output/sampling clock would thus be
f
=
12
M Hz
2
×
(3+1)
=
1
.
5
M Hz
.
SPI_CC_CLKPOL reverses the clock polarity. In master mode, the inverter is imple-
mented as the last thing in the output clock data chain. In slave mode, it is imple-
mented as the first thing in the input clock data chain.
See Figure 14 for details.
If SPI_CC_CLKPOL is clear the data is read at rise edge and written at fall edge if
SPI_CC_CLKPHASE is clear. When SPI_CC_CLKPHASE is set the data is written at
rise edge and read at fall edge.
SCLK
SPI
block
SPI_CC_CLKPOL
SPI
block
SPI_CC_CLKPOL
MASTER MODE
SLAVE MODE
MUX
MUX
SCLK_int
SCLK_int
SCLK
Figure 14: Normal and Reverese SPI Clock Polarity
SPI_CC_CLKPHASE defines the data clock phase. If clear the first data is written when
xcs is asserted and data is sampled at first clock edge (rise edge when SPI_CC_CLKPOL
= 0 and fall edge if SPI_CC_CLKPOL = 1). If SPI_CC_CLKPHASE is set the first data
is written a the first data clock edge and sampled at second.
Rev. 0.20
2011-10-04
Page