Figure 255. Txe/Rxne/Bsy Behavior In Master / Full-Duplex Mode - ST STM32F205 series Reference Manual

Advanced arm-based 32-bit mcus
Hide thumbs Also See for STM32F205 series:
Table of Contents

Advertisement

RM0033
1.
Enable the SPI by setting the SPE bit to 1.
2.
Write the first data item to be transmitted into the SPI_DR register (this clears the TXE
flag).
3.
Wait until TXE=1 and write the second data item to be transmitted. Then wait until
RXNE=1 and read the SPI_DR to get the first received data item (this clears the RXNE
bit). Repeat this operation for each data item to be transmitted/received until the n–1
received data.
4.
Wait until RXNE=1 and read the last received data.
5.
Wait until TXE=1 and then wait until BSY=0 before disabling the SPI.
This procedure can also be implemented using dedicated interrupt subroutines launched at
each rising edges of the RXNE or TXE flag.
Figure 255. TXE/RXNE/BSY behavior in Master / full-duplex mode (BIDIMODE=0 and
Example in Master mode with CPOL=1, CPHA=1
SCK
MISO/MOSI (out)
TXE flag
Tx buffer
(write SPI_DR)
BSY flag
MISO/MOSI (in)
RXNE flag
Rx buffer
(read SPI_DR)
software
software waits
writes 0xF1
until TXE=1 and
into SPI_DR
writes 0xF2 into
SPI_DR
RXONLY=0) in case of continuous transfers
DATA1 = 0xF1
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
set by hardware
cleared by software
0xF1
0xF2
set by hardware
DATA 1 = 0xA1
b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7 b0 b1 b2 b3 b4 b5 b6 b7
set by hardware
software waits
software waits
until RXNE=1
until TXE=1 and
and reads 0xA1
writes 0xF3 into
from SPI_DR
SPI_DR
DATA2 = 0xF2
set by hardware
cleared by software
0xF3
DATA 2 = 0xA2
cleared by software
0xA1
software waits
until RXNE=1
and reads 0xA2
from SPI_ DR
RM0033 Rev 8
Serial peripheral interface (SPI)
DATA3 = 0xF3
set by hardware
DATA 3 = 0xA3
0xA2
software waits
until RXNE=1
and reads 0xA3
from SPI_DR
reset by hardware
0xA3
ai17343
697/1378
735

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F205 series and is the answer not in the manual?

This manual is also suitable for:

Stm32f207 seriesStm32f215 seriesStm32f217 series

Table of Contents