GD32A50x User Manual
562
21.3.8.
SPI interrupts
Status flags
Transmit buffer empty flag (TBE)
This bit is set when the transmit buffer is empty, the software can write the next data to the
transmit buffer by writing the SPI_DATA register.
Receive buffer not empty flag (RBNE)
This bit is set when receive buffer is not empty, which means that one data is received and
stored in the receive buffer.And software can read the data by reading the SPI_DATA register.
SPI transmitting ongoing flag (TRANS)
TRANS is a status flag to indicate whether the transfer is ongoing or not. It is set and cleared
by hardware and not controlled by software. This flag doesn’t generate any interrupt.
Error flags
Configuration fault error (CONFERR)
CONFERR is an error flag in master mode. In NSS hardware mode and if the NSSDRV is not
enabled, the CONFERR is set when the NSS pin is pulled low. In NSS software mode, the
CONFERR is set when the SWNSS bit is 0. When the CONFERR is set, the SPIEN bit and
the MSTMOD bit are cleared by hardware, the SPI is disabled and the device is forced into
slave mode.
The SPIEN bit and MSTMOD bit are write protected until the CONFERR is cleared. The
CONFERR bit of the slave cannot be set. In a multi-master configuration, the device can be
in slave mode with CONFERR bit set, which means there might have been a multi-master
conflict for system control.
Rx overrun error (RXORERR)
The RXORERR bit is set if a data is received when the RBNE is set. That means, the last
data has not been read out and the newly incoming data is received. The receive buffer
contents won’t be covered with the newly incoming data, so the newly incoming data is lost.
Format error (FERR)
In slave TI mode, the slave also monitors the NSS signal and set an error flag if it detects an
incorrect NSS behavior, for example: toggles at the middle bit of a byte.
CRC error (CRCERR)
When the CRCEN bit is set, the CRC calculation result of the received data in the SPI_RCRC
register is compared with the received CRC value after the last data, the CRCERR is set
when they are different.