![GigaDevice Semiconductor GD32A50 Series Скачать руководство пользователя страница 559](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32a50-series/gd32a50-series_user-manual_2225782559.webp)
GD32A50x User Manual
559
Figure 21-12. Timing diagram of quad write operation in Quad-SPI mode
MOSI
MISO
D0[4]
D0[0]
D1[4]
D1[0]
D0[5]
D0[1]
D1[5]
D1[1]
sample
IO2
IO3
D0[6]
D0[2]
D1[6]
D1[2]
D0[7]
D0[3]
D1[7]
D1[3]
TBE
Software write SPI_DATA
Hardware sets TBE again
SCK
Quad read operation
SPI works in quad read mode when QMOD and QRD bits are both set in SPI_QCTL register.
In this mode, MOSI, MISO, IO2 and IO3 are all used as input pins. SPI begins to generate
clock on SCK line as soon as a data is written into SPI_DATA (TBE is cleared) and SPIEN is
set. Writing data into SPI_DATA is only to generate SCK clocks, so the written data can be
any value. Once SPI starts transmission, it always checks SPIEN and TBE status at the end
of a frame and stops when condition is not met. So, dummy data should always be written
into SPI_DATA to generate SCK.
The operation flow for receiving in quad mode is shown below:
1.
Configure clock prescaler, clock polarity, phase, etc. It based on application
requirements in SPI_CTL0 and SPI_CTL1 register.
2.
Set QMOD and QRD bits in SPI_QCTL register and then enable SPI by setting SPIEN
in SPI_CTL0 register.
3.
Write an arbitrary byte (for example, 0xFF) to SPI_DATA register.
4.
Wait until the RBNE flag is set and read SPI_DATA to get the received byte.
5.
Write an arbitrary byte (for example, 0xFF) to SPI_DATA to receive the next byte.