![Geehy SEMICONDUCTOR APM32F405 Series Скачать руководство пользователя страница 365](http://html1.mh-extra.com/html/geehy-semiconductor/apm32f405-series/apm32f405-series_user-manual_573630365.webp)
www.geehy.com Page 364
Slave mode: The SCK signal on the SCK pin starts to jump, while the NSS pin
level is low, and the transmission process starts (before starting data
transmission, make sure that the data has been written to the transmit buffer in
advance).
When SPI is transmitting a data frame, it will load the data frame from the data
buffer to the shift register, and then start to transmit data. After one bit of data
frame is sent, TXBEFLG is set to 1. If you need to continue to transmit data, the
software needs to wait until TXBEFLG=1 writes data to the SPI_DATA register.
(TXBEFLG flag is set to 1 by hardware and cleared by software).
Data receiving
BSYFLG flag is always set to 1 in the data transmission process.
At the last edge of the sampling clock, the received data is transferred from the
shift register to the receive buffer; set the RXBNEFLG flag, and the software
reads the data in data register (SPI_DATA) to obtain the content of the receive
buffer; if RXBNEIEN bit of SPI_CTRL2 register is set, an interrupt will be
generated, and after data is read, the BSYFLG flag will be automatically
cleared.
Full duplex transmitting and receiving mode in master/slave device
Full duplex mode in master device
After writing data to SPI_ DATA register (transmit buffer), data
transmission starts.
When SPI transmits the first bit of data, the data is transferred from
the transmit buffer to the shift register and then transferred to the
MOSI pin serially according to the sequence.
The data received on MISO pin is serially transferred to SPI_DATA
register (receive buffer) according to the sequence.
Transmitting and receiving are synchronous.
Full duplex mode under slave device
When the slave device receives the clock signal and the first data bit
appears on the MOSI pin, data transmission starts, and the
subsequent data bits will be transferred to the shift register in turn.
When SPI transmits the first bit of data, the data is transferred from
the transmit buffer to the shift register, and then transferred to the
MISO pin serially according to the sequence.
The software must ensure that the data to be sent is written before
the SPI master device starts to transmit data.
Transmitting and receiving are synchronous.