www.geehy.com Page 368
Wait until TXBEFLG flag bit is set to 1
Wait for clearing BSYFLG flag bit
Close SPI (set SPIEN=0 of SPI_CTRL1 register)
One-way transmit-only/bidirectional transmitting mode of master mode/slave
mode
After the last data is written into SPI_DATA register:
Wait until TXBEFLG flag bit is set to 1
Wait for clearing BSYFLG flag bit
Close SPI (set SPIEN=0 of SPI_CTRL1 register)
One-way receive-only/bidirectional receiving mode of master mode/slave mode
Wait No. n-1 RXBNEFLG flag bit is set to 1
Wait for one SPI clock cycle before SPI is disabled (set SPIEN=0 of
SPI_CTRL1 register)
Before entering the stop mode, wait until the last RXBNEFLG flag bit is
set to 1
Receive-only/bidirectional receiving mode in slave mode
SPI can be disabled at any time (set SPIEN=0 of SPI_CTRL1 register) and it will
be disabled when the transmission is over. If you want to enter the stop mode,
wait until BSYFLG flag bit is cleared.
SPI interrupt
State flag bit
Transmit buffer empty flag TXBEFLG
TXBEFLG=1 indicates that the transmit buffer bit is empty, and the next data to
be sent can be written. When the data is written to SPI_DATA register, clear the
TXBEFLG flag bit.
Receive buffer non-empty flag RXBNEFLG
RXBNEFLG=1 indicates that the receive buffer contains valid data and the data
can be read through SPI_DATA register; and the RXBNEFLG flag can be
cleared.
Busy flag BSYFLG
BSYFLG flag is set and cleared by hardware, which can indicate the state of