Skip to main content
Fghas.1
Associate
July 27, 2021
Question

Hello everyone. I wanted to know how can I put the stm32f4xx in sleep mode and wake it with internal interrupt. i want it to go in sleep mode for 2ms and be awake for 2ms.

  • July 27, 2021
  • 3 replies
  • 1162 views

..

This topic has been closed for replies.

3 replies

waclawek.jan
Super User
July 27, 2021

Read the "Low power modes" subchapter of PWR chapter in RM.

You can simply use the __WFI(); intrinsic go to to sleep, any interrupt will wake up.

JW

Fghas.1
Fghas.1Author
Associate
July 27, 2021

thank you so much, but is it possible to use timers to wake the micro?

Nikita91
Lead II
July 27, 2021

Of course!

Any interrupt can wake up from WFI. If you configure the timer to generate an interrupt, it will wake up the MCU.

ChahinezC
Associate II
July 27, 2021

Hello @Fghas.1​,

You can refer to the examples provides by the STM32CubeF4 package.

As an example, the project under the "STM32Cube_FW_F4_V.XX\Projects\STM32F411E-Discovery\Examples\PWR\PWR_CurrentConsumption" path can help you configure the sleep mode and use the RTC configuration to set the timer to wake up from the low power mode.

Chahinez.