![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 502](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794502.webp)
GD32E23x User Manual
502
(SWNSSEN=1). Then, once the NSS pin (in hardware NSS mode) or the SWNSS bit (in
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 18-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.
18.3.6.
SPI operation modes
Table 18-5. SPI operation 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