AT32F421
Series Reference Manual
2022.11.11
Page 151
Rev 2.02
Figure 13-4 Single-wire unidirectional receive only in SPI slave mode
SPI master
SCK
MISO
MOSI
CS
SPI slave
SCK
MISO
MOSI
CS
In SPI master mode, it is necessary to wait until the second-to-last RDBF bit is set and then wait another
SPI_CPK cycle before disabling SPI. The last RDBF must be set before entering power-saving mode
(or gating SPI system clock).
In slave mode, there is no need to check any flag before disabling SPI. However, it is mandatory to wait
until the BF becomes 0 before entering power-saving mode.
shows single-wire bidirectional half-duplex mode and SPI IO connection
When the SLBEN is set, the SPI operates in single-wire bidirectional half-duplex mode. In this case,
the SPI supports data reception and transmission alternately. In master mode, the MOSI pin transmits
or receives data, while the IO mapped by MISO is released. In slave mode, the MISO pin transmits or
receives data, but the IO pin mapped by MOSI is released.
The SLBTD bit is used by software to configure transfer direction. When the SLBTD bit is set, the SPI
can be used only for data transmission; when the SLBTD bit is 0, the SPI can be used only for data
reception.
Figure 13-5
Single-wire bidirectional half-duplex mode
SPI master
SCK
MISO
MOSI
CS
SPI slave
SCK
MISO
MOSI
CS
When the SPI is used for data transmission in single-wire bidirectional half-duplex mode (master or
slave), the TDBE bit must be set, and the BF must be 0 before disabling SPI. The power-saving mode
(or gating SPI system clock) cannot be entered unless the SPI is disabled.
In master mode, when the SPI is used for data reception in single-wire bidirectional half-duplex mode, it
is necessary to wait until the second-to-last RDBF is set and then wait another SPI_SCK cycle before
disabling SPI. And the last RDBF must be set before entering power-saving mode (or gating SPI system
clock).
In slave mode, when the SPI is used for data reception in single-wire bidirectional half-duplex mode,
there is no need to check any flags before disabling SPI. However, the BT must be 0 before entering
power-saving mode (or disabling SPI system clock).