Error Flags - ST STM32F101 Series Reference Manual

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

Advertisement

Serial peripheral interface (SPI)
18.3.8

Error flags

Master mode fault (MODF)
Master mode fault occurs when the master device has its NSS pin pulled low (in hardware
mode) or SSI bit low (in software mode), this automatically sets the MODF bit. Master mode
fault affects the SPI peripheral in the following ways:
The MODF bit is set and an SPI interrupt is generated if the ERRIE bit is set.
The SPE bit is reset. This blocks all output from the device and disables the SPI
interface.
The MSTR bit is reset, thus forcing the device into slave mode.
Use the following software sequence to clear the MODF bit:
1.
Make a read or write access to the SPI_SR register while the MODF bit is set.
2.
Then write to the SPI_CR1 register.
To avoid any multiple slave conflicts in a system comprising several MCUs, the NSS pin
must be pulled high during the MODF bit clearing sequence. The SPE and MSTR bits can
be restored to their original state during or after this clearing sequence.
As a security, hardware does not allow the setting of the SPE and MSTR bits while the
MODF bit is set.
In a slave device the MODF bit cannot be set. However, in a multimaster configuration, the
device can be in slave mode with this MODF bit set. In this case, the MODF bit indicates that
there might have been a multimaster conflict for system control. An interrupt routine can be
used to recover cleanly from this state by performing a reset or returning to a default state.
Overrun condition
An overrun condition occurs when the master device has sent data bytes and the slave
device has not cleared the RXNE bit resulting from the previous data byte transmitted.
When an overrun condition occurs:
OVR bit is set and an interrupt is generated if the ERRIE bit is set.
In this case, the receiver buffer contents will not be updated with the newly received data
from the master device. A read to the SPI_DR register returns this byte. All other
subsequently transmitted bytes are lost.
Clearing the OVR bit is done by a read of the SPI_DR register followed by a read access to
the SPI_SR register.
CRC error
This flag is used to verify the validity of the value received when the CRCEN bit in the
SPI_CR1 register is set. In full-duplex mode, the CRCERR flag in the SPI_SR register is set
if the value received in the shift register (after transmission of the transmitter SPI_TXCRCR
value) does not match the receiver SPI_RXCRCR value.
422/501
RM0008

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F101 Series and is the answer not in the manual?

This manual is also suitable for:

Stm32f103 series

Table of Contents