
GD32F403xx User Manual
459
Figure 19-3. SPI timing diagram in Quad-SPI mode (CKPL=1, CKPH=1, LF=0)
SCK (CKPH=0 CKPL=0)
SCK (CKPH=0 CKPL=1)
SCK (CKPH=1 CKPL=0)
SCK (CKPH=1 CKPL=1)
LF=1
FF16=0
MOSI
MISO
NSS
D[0]
D[1]
D[2]
D[3]
D[4]
D[5]
D[6]
D[7]
sample
D[0]
D[1]
D[2]
D[3]
D[4]
D[5]
D[6]
D[7]
In normal mode, the length of data is configured by the FF16 bit in the SPI_CTL0 register.
Data length is 16 bits if FF16=1, otherwise is 8 bits. 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.
19.3.4.
NSS function
Slave Mode
When slave mode is configured (MSTMOD=0), SPI gets NSS level from NSS pin in hardware
NSS mode (SWNSSEN = 0) or from SWNSS bit in software NSS mode (SWNSSEN = 1) and
transmits/receives data only when NSS level is low. In software NSS mode, NSS pin is not
used.
Table 19-3. NSS function in slave mode
Mode
Register configuration
Description
Slave hardware NSS mode
MSTMOD = 0
SWNSSEN = 0
SPI slave gets NSS level from NSS
pin.
Slave software NSS mode
MSTMOD = 0
SWNSSEN = 1
SPI slave NSS level is determined by
the SWNSS bit.
SWNSS = 0: NSS level is low
SWNSS = 1: NSS level is high
Master mode
In master mode (MSTMOD=1) if the application uses multi-master connection, NSS can be
configured to hardware input mode (SWNSSEN=0, NSSDRV=0) or software mode