www.geehy.com Page 293
(
11
)
Interrupt can be triggered by master mode fault, overrun and CRC error
flag
(
12
)
Have DMA transmit and receive buffers
(
13
)
Calculation, transmission and verification can be conducted through
hardware CRC
(
14
)
CRC error flag
(
15
)
Two 32-bit embedded RXFIFO and TXFIFO have DMA function
23.4
Functional Description
Description of SPI Signal Line
Table 77 SPI Signal Line Description
Pin name
Description
SCK
Master device: SPI clock outputs
Slave device: SPI clock inputs
MISO
Master device: Input the pin and receive data
Slave device: Output the pin and send data
Data direction: From slave device to master device
MOSI
Master device: Output the pin and send data
Slave device: Input the pin and receive data
Data direction: From master device to slave device
NSS
Software NSS mode: NSS pin can be used for other purposes.
Hardware NSS mode of master device:
NSS outputs, in single-master mode,
NSS OFF output: Operation of multiple master environments is allowed,
Slave hardware NSS mode: The NSS signal is set to low level as the chip selection signal
of the slave
Communication format
In SPI communication, receiving data and transmitting data can be carried out at
the same time. SCK sends and samples the data on the data line synchronously.
The communication format depends on the clock phase, clock polarity and data
frame format. If the communication is normal, the master device and the slave
device must have the same communication format.
23.4.2.1
Phase and polarity of clock signal
The clock polarity and clock phase are CPOL and CPHA bits of SPI_CTRL1
register.
Clock polarity CPOL means the level signal of SCK signal line when SPI is in idle
state.
When CPOL=0, SCK signal line is in idle state and at low level
When CPOL=1, SCK signal line is in idle state and at high level
Clock phase CPHA means the sampling moment of data
When CPHA=0, the signal on MOSI or MISO data line will be sampled
by the "odd edge" on SCK clock line.
When CPHA=1, the signal on MOSI or MISO data line will be sampled
by the "even edge" on SCK clock line.
SPI can be divided into four modes according to the states of clock phase CPHA
and clock polarity CPOL.