RM0008
enters the master mode fault state: the MSTR bit is automatically cleared and the
device is configured in slave mode (refer to
A basic example of interconnections between a single master and a single slave is
illustrated in
1. Here, the NSS pin is configured as an input.
The MOSI pins are connected together and the MISO pins are connected together. In this
way data is transferred serially between master and slave (most significant bit first).
The communication is always initiated by the master. When the master device transmits
data to a slave device via the MOSI pin, the slave device responds via the MISO pin. This
implies full-duplex communication with both data out and data in synchronized with the
same clock signal (which is provided by the master device via the SCK pin).
Slave select (NSS) pin management
Hardware or software slave select management can be set using the SSM bit in the
SPI_CR1 register.
•
Software NSS management (SSM = 1)
The slave select information is driven internally by the value of the SSI bit in the
SPI_CR1 register. The external NSS pin remains free for other application uses.
•
Hardware NSS management (SSM = 0)
Two configurations are possible depending on the NSS output configuration (SSOE bit
in register SPI_CR2).
–
–
Figure
238.
Figure 238. Single master/ single slave application
Master
MSBit
LSBit
8-bit shift register
SPI clock
generator
NSS output enabled (SSM = 0, SSOE = 1)
This configuration is used only when the device operates in master mode. The
NSS signal is driven low when the master starts the communication and is kept
low until the SPI is disabled.
NSS output disabled (SSM = 0, SSOE = 0)
This configuration allows multimaster capability for devices operating in master
mode. For devices set as slave, the NSS pin acts as a classical NSS input: the
slave is selected when NSS is low and deselected when NSS high.
DocID13902 Rev 15
Serial peripheral interface (SPI)
Section 25.3.10: Error flags on page
MISO
MISO
MOSI
MOSI
SCK
SCK
(1)
(1)
NSS
NSS
V
DD
Slave
MSBit
LSBit
8-bit shift register
Not used if NSS is managed
by software
712).
ai14745
694/1128
742
Need help?
Do you have a question about the STM32F101 series and is the answer not in the manual?
Questions and answers