
Rev. 1.00
426 of 486
July 31, 2018
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F50231/HT32F50241
20 Serial Peripheral Interface (SPI)
20 Serial Peripheral Interface (SPI)
Status Flags
TX Buffer Empty – TXBE
This TXBE flag is set when the TX buffer is empty in the non-FIFO mode or when the TX FIFO
data length is equal to or less than the TX FIFO threshold level as defined by the TXFTLS field in
the SPIFCR register in the FIFO mode. The following data to be transmitted can then be loaded
into the buffer again. After this, the TXBE flag will be reset when the TX buffer already contains
new data in the non-FIFO mode or when the TX FIFO data length is greater than the TX FIFO
threshold level determined by the TXFTLS bits in the FIFO mode.
Transmission Register Empty – TXE
This TXE flag is set when both the TX buffer and the TX shift registers are empty. It will be reset
when the TX buffer or the TX shift register contains new transmitted data.
RX Buffer Not Empty – RXBNE
This RXBNE flag is set when there is valid received data in the RX buffer in the non-FIFO mode
or the RX FIFO data length is equal to or greater than the RX FIFO threshold level as defined by
the RXFTLS field in the SPIFCR register in the SPI FIFO mode. This flag will be automatically
cleared by hardware when the received data have been read out from the RX buffer totally in the
non-FIFO mode or when the RX FIFO data length is less than the RX FIFO threshold level set in
the RXFTLS field.
Time Out Flag – TO
The time out function is only available in the SPI FIFO mode and is disabled by loading a zero
value into the TOC field in the Time Out Counter register. The timeout counter will start counting
if the SPI RX FIFO is not empty, once data is read from the SPIDR register or new data is received,
the timeout counter will be reset to 0 and count again. When the timeout counter value is equal to
the value specified by the TOC field in the SPIFTOCR register, the TO flag will be set. The flag is
cleared by writing 1 to this bit.
Mode Fault – MF
The mode fault flag can be used to detect SPI bus usage in the SPI multi-master mode. For the
multi-master mode, the SPI module is configured as a master device and the SEL signal is setup as
an input signal. The mode fault flag is set when the SPI SEL pin is suddenly changed to an active
level by another SPI master. This means that another SPI master is requesting to use the SPI bus.
Therefore, when an SPI mode fault occurs, it will force the SPI module to operate in the slave mode
and also disable all of the SPI interface signals to avoid SPI bus signal collisions. For the same
reason, if the SPI master wants to transfer data, it also needs to inform other SPI masters by driving
its SEL signal to an active state. The detailed configuration diagram for the SPI multi-master mode
is shown in the following figure.