Standby mode (due to limited space, this article only introduces the 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
- Popular Resources
- Popular amplifiers
Latest Microcontroller Articles
- Learn ARM development(16)
There are many things to learn about ARM, and interrupts are definitely something that needs to be learned. Since the CPU introduced interrupts, it has truly entered the multi-tasking system and greatly improved work efficiency. ...
- Learn ARM development(17)
Because all embedded systems use interrupts, how does my S3C44B0 interrupt the process? Then I need to understand the whole process. To understand it in depth, the best way is to write a program ...
- Learn ARM development(18)
Last time, we have learned about the interrupt handling process of ARM and how to set the interrupt function. So, does it work like this? The answer is no. Because S3C44B0 has several registers that control ...
- Embedded system debugging simulation tool
After the embedded hardware system is designed, it needs to be debugged. Whether it is hardware debugging, software debugging or program solidification, debugging simulation tools are needed. ...
- A small question that has been bothering me recently has finally been solved~~
Recently, I have not been able to understand the concept of drivers very well. Sometimes I can get a feel for it by combining some USB examples written by others, but because the ARM system does not directly explain the pins like the microcontroller ...
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
MoreSelected Circuit Diagrams