Serial peripheral interface/ inter-IC sound (SPI/I2S) RM0390
860/1328 RM0390 Rev 4
Figure 313. TXE/RXNE/BSY behavior in slave / full-duplex mode (BIDIMODE=0,
RXONLY=0) in the case of continuous transfers
26.3.10 Procedure for disabling the SPI
When SPI is disabled, it is mandatory to follow the disable procedures described in this
paragraph. It is important to do this before the system enters a low-power mode when the
peripheral clock is stopped. Ongoing transactions can be corrupted in this case. In some
modes the disable procedure is the only way to stop continuous communication running.
Master in full-duplex or transmit only mode can finish any transaction when it stops
providing data for transmission. In this case, the clock stops after the last data transaction.
Standard disable procedure is based on pulling BSY status together with TXE flag to check
if a transmission session is fully completed. This check can be done in specific cases, too,
when it is necessary to identify the end of ongoing transactions, for example:
• When NSS signal is managed by an arbitrary GPIO toggle and the master has to
provide proper end of NSS pulse for slave, or
• When transactions’ streams from DMA are completed while the last data frame or CRC
frame transaction is still ongoing in the peripheral bus.
The correct disable procedure is (except when receive-only mode is used):
1. Wait until RXNE=1 to receive the last data.
2. Wait until TXE=1 and then wait until BSY=0 before disabling the SPI.
3. Read received data.
[)
VHWE\FOHDUHGE\VRIWZDUH
0,62026,LQ
7[EXIIHU
'$7$ [$
7;(IODJ
[)
%6<IODJ
[)
VRIWZDUH
ZULWHV[)
LQWR63,B'5
VRIWZDUHZDLWV
XQWLO7;( DQG
ZULWHV[)LQWR
63,B'5
VRIWZDUHZDLWV
XQWLO5;1(
DQGUHDGV[$
IURP63,B'5
VHWE\KDUGZDUH
FOHDUHGE\VRIWZDUH
VHWE\KDUGZDUH
FOHDUHGE\VRIWZDUH
VHWE\KDUGZDUH
6&.
'$7$ [$
'$7$ [$
UHVHWE\KDUGZDUH
([DPSOHLQ6ODYHPRGHZLWK&32/ &3+$
5;1(IODJ
ZULWHWR63,B'5
5[EXIIHU
VHWE\KDUGZDUH
0,62026,RXW
'$7$ [)
'$7$ [)
'$7$ [)
UHDGIURP63,B'5
[$
[$ [$
VRIWZDUHZDLWV
XQWLO7;( DQG
ZULWHV[)LQWR
63,B'5
VRIWZDUHZDLWV
XQWLO5;1(
DQGUHDGV[$
IURP63,B'5
VRIWZDUHZDLWV
XQWLO5;1(
DQGUHDGV[$
IURP63,B'5
E E E E E E E E E E E E E E E E E E E E E E E E
E E E E E E E E E E E E E E E E E E E E E E E E
FOHDUHGE\VRIWZDUH
DL