![GigaDevice Semiconductor GD32E23 Series User Manual Download Page 510](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794510.webp)
GD32E23x User Manual
510
Figure 18-15. Timing diagram of 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 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. in SPI_CTL0 and SPI_CTL1
register based on application requirements.
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.