
Rev. 1.00
447 of 576
January 28, 2022
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F54231/HT32F54241/HT32F54243/HT32F54253
21 Serial Peripheral Interface (SPI)
21 Serial Peripheral Interface (SPI)
SPI Serial Frame Format
The SPI interface format is based on the Clock Polarity, CPOL, and the Clock Phase, CPHA,
configurations.
▆
Clock Polarity Bit – CPOL
When the Clock Polarity bit is cleared to 0, the SCK line idle state is low. When the Clock
Polarity bit is set to 1, the SCK line idle state is high.
▆
Clock Phase Bit – CPHA
When the Clock Phase bit is cleared to 0, the data is sampled on the first SCK clock transition.
When the Clock Phase bit is set to 1, the data is sampled on the second SCK clock transition.
There are four formats contained in the SPI interface. The accompanying table shows how to
configure these formats by setting the FORMAT field in the SPICR1 register.
Table 50. SPI Interface Format Setup
FORMAT [2:0]
CPOL
CPHA
001
0
0
010
0
1
110
1
0
101
1
1
Others
Reserved
CPOL = 0, CPHA = 0
In this format, the received data is sampled on the SCK line rising edge while the transmitted data is
changed on the SCK line falling edge. In the master mode, the first bit is driven when data is written
into the SPIDR Register. In the slave mode, the first bit is driven when the SEL signal goes to an
active level. The accompanying figure shows the single byte data transfer timing of this format.
TX[7]
TX[6]
TX[5]
TX[4]
TX[3]
TX[2]
TX[1]
TX[0]
RX[7]
RX[6]
RX[5]
RX[4]
RX[3]
RX[2]
RX[1]
RX[0]
½ SCK
SEL (SELAP=1)
MOSI
MISO
SCK
SEL (SELAP=0)
Data sampled
Figure 155. SPI Single Byte Transfer Timing Diagram – CPOL = 0, CPHA = 0