
GD32L23x User Manual
518
Figure 22-4. SPI0 timing diagram in Quad-SPI mode (CKPL=1, CKPH=1, LF=0)
D[5]
D[4]
D[6]
D[7]
D[0]
D[1]
D[2]
D[3]
D[5]
D[4]
D[6]
D[7]
D[0]
D[1]
D[2]
D[3]
SCK
MOSI
MISO
IO2
IO3
NSS
sample
In SPI0 normal mode, the length of data is configured by the DZ bits in the SPI_CTL1 register.
It can be set from 4-bit up to 16-bit length and the setting applies for both transmission and
reception, and the read access to the FIFO must be aligned with the BYTEN bit setting in the
SPI_CTL1 register. The data frame length is fixed to 8 bits in Quad-SPI mode.
Data order is configured by LF bit in SPI_CTL0 register, and SPI will first send the LSB if
LF=1, or the MSB if LF=0. The data order is fixed to MSB first in TI mode.
When the SPI_DATA register is accessed, data frames are always right-aligned into either a
byte (if the data fits into a byte) or a half-word. During communication, only bits within the data
frame are clocked and transferred.
Figure 22-5. SPI0 data frame right-aligned diagram
Data
frame
xx
7
6
0
5
Data
frame
00
7
6
0
5
Data
frame
xxxx
15
12
0
11
Data
frame
0000
0
15
12 11
Rx
Tx
Rx
Tx
DZ=5,data size is 6-bit
DZ=11,data size is 12-bit
22.5.2.
RXFIFO and TXFIFO
RXFIFO and TXFIFO are used in different directions for SPI data transactions, and they can
enable the SPI to work in a continuous flow (only available in SPI0).