
Rev. 1.00
420 of 486
July 31, 2018
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F50231/HT32F50241
19 Inter-Integrated Circuit (I2C)
20 Serial Peripheral Interface (SPI)
20
Serial Peripheral Interface (SPI)
Introduction
The Serial Peripheral Interface, SPI, provides an SPI protocol data transmit and receive functions
in both master or slave mode. The SPI interface uses 4 pins, among which are serial data input and
output lines MISO and MOSI, the clock line SCK, and the slave select line SEL. One SPI device
acts as a master who controls the data flow using the SEL and SCK signals to indicate the start of
the data communication and the data sampling rate. To receive the data bits, the streamlined data
bits which range from 1 bit to 16 bits specified by the DFL field in the SPICR1 register are latched
on a specific clock edge and stored in the data register or in the RX FIFO. Data transmission
is carried in a similar way but with the reverse sequence. The mode fault detection provides a
capability for multi-master applications.
SPI_TXFIFO
SPI_RXFIFO
MOSI
MISO
SEL
SCK
SPICR0
SPICR1
SPIFCR
Control
TX Buffer
RX Buffer
SPISR
SPIFSR
SPICPR
SPIFTOCR
Status
APB
Bus
SPIDR
SPIIER
Transmit/Receive
Logic
Shift
Register
Figure 152. SPI Block Diagram