STM32F407 - Low power mode wake-up from standby

Publisher:平凡幸福Latest update time:2018-09-10 Source: eefocusKeywords:STM32F407 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

By default, after a system reset or power-on reset, the microcontroller enters the Run mode. In the Run mode, the CPU is clocked by HCLK and executes program code.

The STM32F407 offers several low-power modes to save power when the CPU does not need to run (for example, when waiting for external events). 


Low Power Mode


Low Power Mode:Power consumption comparison:
Sleep mode (Cortex™-M4F core stops, peripherals keep running) -
Stop mode (all clocks stopped)Sub-low power consumption
Standby mode (1.2 V domain powered down)Lowest power consumption


Ways to reduce run mode power consumption in addition to the above:

● Reduce system clock speed

● When APBx and AHBx are not used, turn off the corresponding peripheral clocks (an effective way to reduce power consumption in run mode)


Standby mode (due to limited space, this article only introduces the standby mode)

How to enter and exit Standby mode:



I/O status in standby mode:

In standby mode, all I/O pins are in high-impedance state except for the following:

● Reset pin (still available)

● RTC_AF1 pin (PC13) (if configured for tamper, timestamp, RTC alarm output, or RTC clock calibration output) 

● WKUP pin (PA0) (if enabled)

※High impedance state: An output state of a circuit, which is neither a high level nor a low level. If the high impedance state is input into the next level circuit, it will have no effect on the next level circuit, just like it is not connected. If measured with a multimeter, it may be a high level or a low level, depending on what is connected to it.

Debug mode (If debugging is required in low power mode, please refer to the section [Debug support for low power mode])

By default, if the application puts the MCU into stop mode or standby mode while the debug features are in use, the debug connection will be lost. This is because the Cortex™-M4F core clock is stopped.

However, by setting some configuration bits in the DBGMCU_CR register, the MCU can still be debugged using software even when it enters low-power mode.


The simplest demo (library function configuration)

demo:

Similar to the power on and off behavior of a mobile phone, long press to turn on (wake up from standby), and long press again to turn off (enter standby mode).

Demo design ideas:

-- Reset --

System reset -> Various initializations -> Long press to judge (whether it is a high level for 3 seconds) -> If not, enter standby mode

                                                                     -> If yes, boot normally (do not enter standby mode)

-- Standby wake-up --

WK_UP pin generates a wake-up event (rising edge) -> wake-up (reset)


-- Enter standby mode --

Run mode -> WK_UP pin generates external event (rising edge) -> External interrupt -> Long press judgment (whether it is high level for 3 seconds) -> If yes, enter standby mode

                                                                                                           -> If not, an invalid event is returned

Two things I have to mention (for this demo):

1) Setting the WK_UP pin as an event source:

● Before entering standby mode (executing the WFI instruction), WK_UP needs to be set as the wake-up event (for power-on).

● During initialization, set WK_UP to be used for external events (for implementing shutdown).


2) The rising edge of the WK_UP pin generates different events in different modes:

● In standby mode, the rising edge of the WK_UP pin generates a wake-up event

● In run mode, the rising edge of the WK_UP pin generates an external event


Specific design based on library functions:

-- Initialization --

1) Enable the power clock.

RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); 


2) Set the WK_UP pin as the wakeup source.

PWR_WakeUpPinCmd(ENABLE); 


3) Set the SLEEPDEEP bit and PDDS bit, execute the WFI instruction, and enter the standby mode. (For SLEEPDEEP, refer to "STM32F407 Programming manual.pdf")

For library functions, the above configuration is implemented by the function PWR_EnterSTANDBYMode.

void PWR_EnterSTANDBYMode(void);


4) Interrupt service of WK_UP external event

Function, enter standby mode 


Keywords:STM32F407 Reference address:STM32F407 - Low power mode wake-up from standby

Previous article:STM32--Read and write internal Flash
Next article:STM32l151 low power chip serial communication

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号