
Rev. 1.00
446 of 576
January 28, 2022
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F54231/HT32F54241/HT32F54243/HT32F54253
21 Serial Peripheral Interface (SPI)
Features
▆
Master or slave mode
▆
Master mode speed up to f
PCLK
/2
▆
Slave mode speed up to f
PCLK
/3
▆
Programmable data frame length up to 16 bits
▆
FIFO Depth: 8 levels
▆
MSB or LSB first shift selection
▆
Programmable slave select high or low active polarity
▆
Multi-master and multi-slave operation
▆
Master mode supports dual output read mode of SPI series NOR Flash
▆
Four error flags with individual interrupt
●
Read overrun
●
Write collision
●
Mode fault
●
Slave abort
▆
Support PDMA interface, the PDMA related describes are only available for the HT32F54243/
HT32F54253 devices
Functional Descriptions
Master Mode
Each data frame can range from 1 to 16 bits in data length. The first bit of the transmitted data
can be either an MSB or LSB determined by the FIRSTBIT bit in the SPICR1 register. The SPI
module is configured as a master or a slave by setting the MODE bit in the SPICR1 register. When
the MODE bit is set, the SPI module is configured as a master and will generate the serial clock
on the SPI_SCK pin. The data stream will transmit data in the shift register to the SPI_MOSI pin
on the serial clock edge. The SPI_SEL pin is active during the full data transmission. When the
SELAP bit in the SPICR1 register is set, the SPI_SEL pin is active high during the complete data
transactions. When the SELM bit in the SPICR1 register is set, the SPI_SEL pin will be driven by
the hardware automatically and the time interval between the active SEL edge and the first edge of
SCK is equal to half an SCK period.
Slave Mode
In the slave mode, the SPI_SCK pin acts as an input pin and the serial clock will be derived from
the external master device. The SPI_SEL pin also acts as an input. When the SELAP bit is cleared
to 0, the SEL signal is active low during the full data stream reception. When the SELAP bit is set
to 1, the SEL signal will be active high during the full data stream reception.
Note: For the slave mode, the APB clock, known as f
PCLK
, must be at least 3 times faster than the
external SCK clock input frequency.