GD32A50x User Manual
552
software NSS mode) goes low, the SPI automatically enters slave mode and triggers a master
fault flag CONFERR.
If the application wants to use NSS line to control the SPI slave, NSS should be configured
to hardware output mode (SWNSSEN=0, NSSDRV=1). NSS goes low after SPI is enabled.
The application may also use a general purpose IO as NSS pin to realize more flexible NSS.
Table 21-4. NSS function in master mode
Mode
Register configuration
Description
Master hardware NSS
output mode
MSTMOD = 1
SWNSSEN = 0
NSSDRV=1
Applicable to single-master mode. The
master uses the NSS pin to control the
SPI slave device. At this time, the NSS
is configured as the hardware output
mode. NSS goes low after enabling
SPI.
Master hardware NSS input
mode
MSTMOD = 1
SWNSSEN = 0
NSSDRV=0
Applicable to multi-master mode. At
this time, NSS is configured as
hardware input mode. Once the NSS
pin is pulled low, SPI will automatically
enter slave mode, and a master
configuration error will occur and the
CONFERR bit will be set to 1.
Master software NSS mode
MSTMOD = 1
SWNSSEN = 1
SWNSS = 0
NSSDRV: Don’t care
Applicable to multi-master mode. Once
SWNSS = 0, SPI will automatically
enter slave mode, and a master
configuration error will occur and the
CONFERR bit will be 1.
MSTMOD = 1
SWNSSEN = 1
SWNSS = 1
NSSDRV: Don’t care
The slave can use hardware or
software NSS mode.
21.3.5.
SPI operating modes
Table 21-5. SPI operating modes
Mode
Description
Register configuration
Data pin usage
MFD
Master full-duplex
MSTMOD = 1
RO = 0
BDEN = 0
BDOEN: Don’t care
MOSI: Transmission
MISO: Reception
MTU
Master transmission with
unidirectional connection
MSTMOD = 1
RO = 0
BDEN = 0
MOSI: Transmission
MISO: Not used