OXO
OXO

Reputation: 61

STM32F0 exit from STOP on SPI receive interrupt

Am I correct in assuming that it's not possible to exit from STOP mode on SPI receive interrupt, because all the clocks are stopped?

Upvotes: 1

Views: 1586

Answers (2)

Bence Kaulics
Bence Kaulics

Reputation: 7281

You are correct, SPI receive interrupt cannot be used to wake up the controller from STOP mode.

But any EXTI Line configured in Interrupt mode can wake up the microcontroller. (Table source)

enter image description here

The complete EXTI line mapping can be found in the reference manual, page 176. From GPIOs are mapped to EXTI0 - EXTI15. And the remaining usable lines are the following:

  • EXTI line 17 is connected to the RTC Alarm event
  • EXTI line 18 is connected to the internal USB wakeup event
  • EXTI line 19 is connected to the RTC Tamper and TimeStamp events
  • EXTI line 20 is connected to the RTC Wakeup event (available only on STM32F070xB and STM32F030xC devices)
  • EXTI line 23 is connected to the internal I2C1 wakeup event

What you can do is configuring an external interrupt on the GPIO pin of the corresponding SPI line which will wake up the controller. After that the proper SPI RX interrupt can be used. Note that you will lose the early data on the SPI as you will only have a GPIO interrupt and the SPI peripheral will be stopped until wake up.

Upvotes: 2

Yes, SPI is stopped in STOP mode.

If your MCU is the SPI slave, and you can afford to lose the first packet, i.e. the master will restart if it doesn't get the right answer, then you can reconfigure the NSS pin as an EXTI activated on falling edge, it will work even in STOP mode.

Upvotes: 2

Related Questions