GD32VF103 User Manual
386
In master mode, software should write the next data into SPI_DATA register before the
transmission of current data frame is completed if it desires to generate continuous
transmission.
Reception sequence
After the last valid sample clock, the incoming data will be moved from shift register to the
receive buffer and RBNE (receive buffer not empty) will be set. The application should read
SPI_DATA register to get the received data and this will clear the RBNE flag automatically.
In MRU and MRB modes, hardware continuously sends clock signal to receive the next data
frame, while in full-duplex master mode (MFD), hardware only receives the next data frame
when the transmit buffer is not empty.
SPI operation sequence in different modes (Not TI mode or NSSP mode)
In full-duplex mode, either MFD or SFD, the RBNE and TBE flags should be monitored and
then follow the sequences described above.
The transmission mode (MTU, MTB, STU or STB) is similar to the transmission sequence of
full-duplex mode regardless of the RBNE and OVRE bits.
The master reception mode (MRU or MRB) is different from the reception sequence of full-
duplex mode. In MRU or MRB mode, after SPI is enabled, the SPI continuously generates
SCK until the SPI is disabled. So the application should ignore the TBE flag and read out
reception buffer in time after the RBNE flag is set, otherwise a data overrun fault will occur.
The slave reception mode (SRU or SRB) is similar to the reception sequence of full-duplex
mode regardless of the TBE flag.
SPI TI mode
SPI TI mode takes NSS as a special frame header flag signal and its operation sequence is
similar to normal mode described above. The modes described above (MFD, MTU, MRU,
MTB, MRB, SFD, STU, SRU, STB and SRB) are still supported in TI mode. While, in TI mode
the CKPL and CKPH bits in SPI_CTL0 registers take no effect and the SCK sample edge is
falling edge.
Figure
18
-
7
. Timing diagram of TI master mode with discontinuous transfer
SCK
MOSI
MISO
NSS
D7
D0
D0
D7
D7
D7