5. Power controller (PWR)
5.1 Power supplies
There are two main power supply schemes:
- • VDD = 1.7 to 3.6 V: external power supply for I/Os with the internal regulator disabled, provided externally through VDD pins. Requires the use of an external power supply supervisor connected to the VDD and PDR_ON pins.
- • VDD = 1.8 to 3.6 V: external power supply for I/Os and the internal regulator (when enabled), provided externally through VDD pins.
The real-time clock (RTC) and the RTC backup registers can be powered from the V BAT voltage when the main V DD supply is powered off.
Note: Depending on the operating power supply range, some peripheral may be used with limited functionality and performance. For more details refer to section “General operating conditions” in STM32F4xx datasheets.
Figure 7. Power supply overview

The diagram illustrates the power supply architecture of the microcontroller. Key components and connections include:
- V BAT (1.65 to 3.6V): Connected to a power switch and the backup circuitry (OSC32K, RTC, Wakeup logic, Backup registers).
- V DD pins (1/2/.../6): Connected to a voltage regulator and bypassed with 6 × 100 nF + 1 × 4.7 µF capacitors.
- V SS pins (1/2/.../5): Connected to the voltage regulator and bypassed with 2 × 2.2 µF or 1 × 4.7 µF capacitors.
- V CAP_1 and V CAP_2 pins: Connected to the voltage regulator.
- BYPASS_REG pin: Connected to the voltage regulator.
- PDR_ON pin: Connected to the reset controller.
- V DDA pin: Connected to the ADC and bypassed with 100 nF + 1 µF capacitors.
- V REF+ and V REF- pins: Connected to the ADC and bypassed with 100 nF + 1 µF capacitors.
- V SSA pin: Connected to the ADC.
- Internal Components:
- Power switch: Selects between V DD and V BAT for the backup circuitry.
- Level shifter: Interfaces between IO Logic and the internal voltage levels.
- IO Logic: Input/Output logic blocks.
- Kernel logic (CPU, digital & RAM): The main processing core.
- Flash memory: Non-volatile storage.
- Reset controller: Manages system reset signals.
- ADC: Analog-to-Digital Converter.
- Analog: RCs, PLL, ...: Analog peripherals.
MS32658V2
- 1. V DDA and V SSA must be connected to V DD and V SS , respectively.
5.1.1 Independent A/D converter supply and reference voltage
To improve conversion accuracy, the ADC has an independent power supply which can be separately filtered and shielded from noise on the PCB.
- • The ADC voltage supply input is available on a separate VDDA pin.
- • An isolated supply ground connection is provided on VSSA pin.
To ensure a better accuracy of low voltage inputs, the user can connect a separate external reference voltage ADC input on V REF . The voltage on V REF ranges from 1.7 V to V DDA .
5.1.2 Battery backup domain
Backup domain description
To retain the content of the RTC backup registers and supply the RTC when V DD is turned off, VBAT pin can be connected to an optional standby voltage supplied by a battery or by another source.
To allow the RTC to operate even when the main digital supply (V DD ) is turned off, the VBAT pin powers the following blocks:
- • The RTC
- • The LSE oscillator
- • PC13 to PC15 I/Os
The switch to the V BAT supply is controlled by the power-down reset embedded in the Reset block.
Warning: During \( t_{RSTTEMPO} \) (temporization at V DD startup) or after a PDR is detected, the power switch between V BAT and V DD remains connected to V BAT . During the startup phase, if V DD is established in less than \( t_{RSTTEMPO} \) (Refer to the datasheet for the value of \( t_{RSTTEMPO} \) ) and \( V_{DD} > V_{BAT} + 0.6 \) V, a current may be injected into V BAT through an internal diode connected between V DD and the power switch (V BAT ). If the power supply/battery connected to the VBAT pin cannot support this current injection, it is strongly recommended to connect an external low-drop diode between this power supply and the VBAT pin.
If no external battery is used in the application, it is recommended to connect VBAT pin to V DD supply, and add a 100 nF ceramic decoupling capacitor on VBAT pin.
When the backup domain is supplied by V DD (analog switch connected to V DD ), the following functions are available:
- • PC14 and PC15 can be used as either GPIO or LSE pins
- • PC13 can be used as a GPIO or additional functions can be configured (refer to Table 25: RTC additional functions for more details about this pin configuration)
Note: Due to the fact that the switch only sinks a limited amount of current (3 mA), the use of PC13 to PC15 GPIOs in output mode is restricted: the speed has to be limited to 2 MHz with
a maximum load of 30 pF and these I/Os must not be used as a current source (e.g. to drive an LED).
When the backup domain is supplied by \( V_{BAT} \) (analog switch connected to \( V_{BAT} \) because \( V_{DD} \) is not present), the following functions are available:
- • PC14 and PC15 can be used as LSE pins only
- • PC13 can be used as the RTC additional function pin (refer to Table 25: RTC additional functions for more details about this pin configuration)
Backup domain access
After reset, the backup domain (RTC registers and RTC backup register) is protected against possible unwanted write accesses. To enable access to the backup domain, proceed as follows:
- • Access to the RTC and RTC backup registers
- 1. Enable the power interface clock by setting the PWREN bits in the RCC_APB1ENR register (see Section 6.3.11: RCC APB1 peripheral clock enable register (RCC_APB1ENR) )
- 2. Set the DBP bit in the Section 5.4.1 to enable access to the backup domain
- 3. Select the RTC clock source: see Section 7.2.8: RTC/AWU clock
- 4. Enable the RTC clock by programming the RTCEN [15] bit in the Section 7.3.20: RCC Backup domain control register (RCC_BDCR)
RTC and RTC backup registers
The real-time clock (RTC) is an independent BCD timer/counter. The RTC provides a time-of-day clock/calendar, two programmable alarm interrupts, and a periodic programmable wake-up flag with interrupt capability. The RTC contains 20 backup data registers (80 bytes) which are reset when a tamper detection event occurs. For more details refer to Section 17: Real-time clock (RTC) .
5.1.3 Voltage regulator
An embedded linear voltage regulator supplies all the digital circuitries except for the backup domain and the Standby circuitry. The regulator output voltage is around 1.2 V.
This voltage regulator requires one or two external capacitors to be connected to one or two dedicated pins, \( V_{CAP\_1} \) and for some packages \( V_{CAP\_2} \) . Specific pins must be connected either to \( V_{SS} \) or \( V_{DD} \) to activate or deactivate the voltage regulator. These pins depend on the package.
When activated by software, the voltage regulator is always enabled after Reset. It works in three different modes depending on the application modes.
- • In
Run mode
, the regulator supplies full power to the 1.2 V domain (core, memories and digital peripherals). In this mode, the regulator output voltage (around 1.2 V) can be scaled by software to different voltage values:
Scale 1, scale 2, or scale 3 can be configured through the VOS[1:0] bits of the PWR_CR register. After reset the VOS register is set to scale 2. When the PLL is OFF, the voltage regulator is set to scale 3 independently of the VOS register
content. The VOS register content is only taken into account once the PLL is activated and the HSI or HSE is selected as clock source.
The voltage scaling allows optimizing the power consumption when the device is clocked below the maximum system frequency.
- • In Stop mode , the main regulator or the low-power regulator supplies low power to the 1.2 V domain, thus preserving the content of registers and internal SRAM. The voltage regulator can be put either in main regulator mode (MR) or in low-power mode (LPR). The programmed voltage scale remains the same during Stop mode:
Voltage scale 3 is automatically selected when the microcontroller enters Stop mode (see Section 5.4.1: PWR power control register (PWR_CR) ).
- • In Standby mode , the regulator is powered down. The content of the registers and SRAM are lost except for the Standby circuitry and the backup domain.
Note: For more details, refer to the voltage regulator section in the STM32F411xC/E datasheet.
5.2 Power supply supervisor
5.2.1 Power-on reset (POR)/power-down reset (PDR)
The device has an integrated POR/PDR circuitry that allows proper operation starting from 1.8 V.
To use the device below 1.8 V, the internal power supervisor must be switched off using the PDR_ON pin (please refer to section Power supply supervisor of the STM32F411xC/E datasheet). The device remains in Reset mode when \( V_{DD}/V_{DDA} \) is below a specified threshold, \( V_{POR/PDR} \) , without the need for an external reset circuit. For more details concerning the power on/power-down reset threshold, refer to the electrical characteristics of the datasheet.
Figure 8. Power-on reset/power-down reset waveform

The figure is a timing diagram showing the power-on reset (POR) and power-down reset (PDR) behavior. The top part of the diagram shows the supply voltage \( V_{DD}/V_{DDA} \) over time. The voltage rises from 0 V to a peak value and then falls back towards 0 V. The bottom part shows the Reset signal level over the same time period. The Reset signal is active (low) when the supply voltage is below the POR threshold and becomes inactive (high) when the supply voltage rises above the POR threshold. The POR threshold is indicated by a horizontal dashed line. The hysteresis is shown as the vertical difference between the rising and falling POR thresholds, labeled "40 mV hysteresis". The temporization \( t_{RSTTEMPO} \) is indicated by the horizontal time interval between the start of the voltage rise and the falling edge of the Reset signal.
5.2.2 Brownout reset (BOR)
During power on, the Brownout reset (BOR) keeps the device under reset until the supply voltage reaches the specified \( V_{BOR} \) threshold.
\( V_{BOR} \) is configured through device option bytes. By default, BOR is off. 3 programmable \( V_{BOR} \) threshold levels can be selected:
- • BOR Level 3 ( \( V_{BOR3} \) ). Brownout threshold level 3.
- • BOR Level 2 ( \( V_{BOR2} \) ). Brownout threshold level 2.
- • BOR Level 1 ( \( V_{BOR1} \) ). Brownout threshold level 1.
Note: For full details about BOR characteristics, refer to the "Electrical characteristics" section in the device datasheet.
When the supply voltage ( \( V_{DD} \) ) drops below the selected \( V_{BOR} \) threshold, a device reset is generated.
The BOR can be disabled by programming the device option bytes. In this case, the power-on and power-down is then monitored by the POR/ PDRor by an external power supervisor if the PDR is switched off through the PDR_ON pin (see Section 5.2.1: Power-on reset (POR)/power-down reset (PDR) ).
The BOR threshold hysteresis is \( \sim 100 \) mV (between the rising and the falling edge of the supply voltage).
Figure 9. BOR thresholds

The figure is a timing diagram illustrating the Brownout Reset (BOR) behavior. The top graph plots the supply voltage ( \( V_{DD}/V_{DDA} \) ) against time. The voltage rises linearly from a low value to a maximum level and then falls linearly. A horizontal dashed line represents the BOR threshold. Two points on the falling edge of the voltage are marked with vertical dashed lines, and the vertical distance between them is labeled "100 mV hysteresis". The bottom graph shows the "Reset" signal as a digital pulse. The signal is initially high (inactive). When the supply voltage falls below the BOR threshold, the Reset signal goes low (active). It remains low until the supply voltage rises back above the BOR threshold, at which point the Reset signal returns to high. Vertical dashed lines connect the voltage threshold crossings to the corresponding transitions in the Reset signal.
5.2.3 Programmable voltage detector (PVD)
You can use the PVD to monitor the \( V_{DD} \) power supply by comparing it to a threshold selected by the PLS[2:0] bits in the PWR power control register (PWR_CR) .
The PVD is enabled by setting the PVDE bit.
A PVDO flag is available, in the PWR power control/status register (PWR_CSR) , to indicate if \( V_{DD} \) is higher or lower than the PVD threshold. This event is internally connected to the EXTI line 16 and can generate an interrupt if enabled through the EXTI registers. The PVD output interrupt can be generated when \( V_{DD} \) drops below the PVD threshold and/or when \( V_{DD} \) rises above the PVD threshold depending on EXTI line 16 rising/falling edge configuration. As an example the service routine could perform emergency shutdown tasks.
Figure 10. PVD thresholds

The figure illustrates the relationship between the supply voltage \( V_{DD} \) and the PVD output. The top part of the graph shows \( V_{DD} \) rising to a peak and then falling. The bottom part shows the PVD output as a rectangular pulse. Two horizontal dashed lines represent the PVD threshold levels. The upper threshold is the level at which the PVD output goes low as \( V_{DD} \) rises. The lower threshold is the level at which the PVD output goes high as \( V_{DD} \) falls. The difference between these two thresholds is labeled as '100 mV hysteresis'. The PVD output is high when \( V_{DD} \) is below the lower threshold and low when \( V_{DD} \) is above the upper threshold. The graph is labeled MS30432V2 in the bottom right corner.
5.3 Low-power modes
By default, the microcontroller is in Run mode after a system or a power-on reset. In Run mode the CPU is clocked by HCLK and the program code is executed. Several low-power modes are available to save power when the CPU does not need to be kept running, for example when waiting for an external event. It is up to the user to select the mode that gives the best compromise between low-power consumption, short startup time and available wake-up sources.
The devices feature three low-power modes:
- • Sleep mode (Cortex ® -M4 with FPU core stopped, peripherals kept running)
- • Stop mode (all clocks are stopped)
- • Standby mode (1.2 V domain powered off)
In addition, the power consumption in Run mode can be reduced by one of the following means:
- • Slowing down the system clocks
- • Gating the clocks to the APBx and AHBx peripherals when they are unused.
Entering low-power mode
Low-power modes are entered by the MCU by executing the WFI (Wait For Interrupt), or WFE (Wait for Event) instructions, or when the SLEEPONEXIT bit in the Cortex ® -M4 with FPU System Control register is set on Return from ISR.
Entering Low-power mode through WFI or WFE is executed only if no interrupt is pending or no event is pending.
Exiting low-power mode
The MCU exits from Sleep and Stop modes low-power mode depending on the way the low-power mode was entered:
- • If the WFI instruction or Return from ISR was used to enter the low-power mode, any peripheral interrupt acknowledged by the NVIC can wake up the device.
- • If the WFE instruction is used to enter the low-power mode, the MCU exits the low-power mode as soon as an event occurs. The wake-up event can be generated either by:
- – NVIC IRQ interrupt:
When SEVONPEND = 0 in the Cortex ® -M4 with FPU System Control register: by enabling an interrupt in the peripheral control register and in the NVIC. When the MCU resumes from WFE, the peripheral interrupt pending bit and the NVIC peripheral IRQ channel pending bit (in the NVIC interrupt clear pending register) have to be cleared. Only NVIC interrupts with sufficient priority wakes up and interrupts the MCU.
When SEVONPEND = 1 in the Cortex ® -M4 with FPU System Control register: by enabling an interrupt in the peripheral control register and optionally in the NVIC. When the MCU resumes from WFE, the peripheral interrupt pending bit and when enabled the NVIC peripheral IRQ channel pending bit (in the NVIC interrupt clear pending register) have to be cleared. All NVIC interrupts wakes up the MCU, even the disabled ones. Only enabled NVIC interrupts with sufficient priority wakes up and interrupts the MCU.
- – Event
This is done by configuring a EXTI line in event mode. When the CPU resumes from WFE, it is not necessary to clear the EXTI peripheral interrupt pending bit or the NVIC IRQ channel pending bit as the pending bits corresponding to the event line is not set. It may be necessary to clear the interrupt flag in the peripheral.
The MCU exits from Standby low-power mode through an external reset (NRST pin), an IWDG reset, a rising edge on one of the enabled WKUPx pins or a RTC event occurs (see Figure 159: RTC block diagram ).
After waking up from Standby mode, program execution restarts in the same way as after a Reset (boot pin sampling, option bytes loading, reset vector is fetched, etc.).
Only enabled NVIC interrupts with sufficient priority wakes up and interrupts the MCU.
Table 14. Low-power mode summary
| Mode name | Entry | Wake-up | Effect on 1.2 V domain clocks | Effect on V DD domain clocks | Voltage regulator |
|---|---|---|---|---|---|
| Sleep (Sleep now or Sleep-on-exit) | WFI or Return from ISR | Any interrupt | CPU CLK OFF no effect on other clocks or analog clock sources | None | ON |
| WFE | Wake-up event | ||||
| Stop | SLEEPDEEP bit + WFI, Return from ISR or WFE | Any EXTI line (configured in the EXTI registers, internal and external lines) | All 1.2 V domain clocks OFF | HSI and HSE oscillators OFF | Main regulator or Low-Power regulator (depends on PWR power control register (PWR_CR) ) |
| PDDS bit + SLEEPDEEP bit + WFI, Return from ISR or WFE | WKUP pin rising edge, RTC alarm (Alarm A or Alarm B), RTC Wake-up event, RTC tamper events, RTC time stamp event, external reset in NRST pin, IWDG reset | OFF |
5.3.1 Slowing down system clocks
In Run mode the speed of the system clocks (SYSCLK, HCLK, PCLK1, PCLK2) can be reduced by programming the prescaler registers. These prescalers can also be used to slow down peripherals before entering Sleep mode.
For more details refer to Section 7.3.3: RCC clock configuration register (RCC_CFGR) .
5.3.2 Peripheral clock gating
In Run mode, the HCLKx and PCLKx for individual peripherals and memories can be stopped at any time to reduce power consumption.
To further reduce power consumption in Sleep mode the peripheral clocks can be disabled prior to executing the WFI or WFE instructions.
Peripheral clock gating is controlled by the AHB1 peripheral clock enable register (RCC_AHB1ENR), AHB2 peripheral clock enable register (RCC_AHB2ENR) (see Section 7.3.10: RCC AHB1 peripheral clock enable register (RCC_AHB1ENR) , Section 7.3.11: RCC AHB2 peripheral clock enable register (RCC_AHB2ENR) ).
Disabling the peripherals clocks in Sleep mode can be performed automatically by resetting the corresponding bit in RCC_AHBxLPENR and RCC_APBxLPENR registers.
5.3.3 Sleep mode
Entering Sleep mode
The Sleep mode is entered according to Section : Entering low-power mode , when the SLEEPDEEP bit in the Cortex ® -M4 with FPU System Control register is cleared.
Refer to Table 15 and Table 16 for details on how to enter Sleep mode.
Note: All interrupt pending bits must be cleared before the sleep mode entry.
Exiting Sleep mode
The Sleep mode is exited according to Section : Exiting low-power mode .
Refer to Table 15 and Table 16 for more details on how to exit Sleep mode.
Table 15. Sleep-now entry and exit
| Sleep-now mode | Description |
|---|---|
| Mode entry | WFI (Wait for Interrupt) or WFE (Wait for Event) while:
|
| Mode exit | If WFI or Return from ISR was used for entry: Interrupt: Refer to Table 37: Vector table for STM32F411xC/E If WFE was used for entry and SEVONPEND = 0 Wake-up event: Refer to Section 10.2.3: Wake-up event management If WFE was used for entry and SEVONPEND = 1 Interrupt even when disabled in NVIC: refer to Table 37: Vector table for STM32F411xC/E or Wake-up event (see Section 10.2.3: Wake-up event management ). |
| Wake-up latency | None |
Table 16. Sleep-on-exit entry and exit
| Sleep-on-exit | Description |
|---|---|
| Mode entry | WFI (Wait for Interrupt) or WFE (Wait for Event) while:
|
Table 16. Sleep-on-exit entry and exit (continued)
| Sleep-on-exit | Description |
|---|---|
| Mode exit | Interrupt: refer to Table 37: Vector table for STM32F411xC/E |
| Wake-up latency | None |
5.3.4 Stop mode
The Stop mode is based on the Cortex ® -M4 with FPU deepsleep mode combined with peripheral clock gating. The voltage regulator can be configured either in normal or low-power mode. In Stop mode, all clocks in the 1.2 V domain are stopped, the PLLs, the HSI and the HSE RC oscillators are disabled. Internal SRAM and register contents are preserved.
Some settings in the PWR_CR register allow to further reduce the power consumption. When the Flash memory is in power-down mode, an additional startup delay is incurred when waking up from Stop mode (see Table 17: Stop operating modes and Section 5.4.1: PWR power control register (PWR_CR) ).
Table 17. Stop operating modes
| Stop mode | MRLV bit | LPLV bit | FPDS bit | LPDS bit | Wake-up latency | |
|---|---|---|---|---|---|---|
| Normal mode | STOP MR | 0 | - | 0 | 0 | HSI RC startup time |
| STOP MRFPD | 0 | - | 1 | 0 | HSI RC startup time + Flash wake-up time from Deep Power Down mode | |
| STOP LP | 0 | 0 | 0 | 1 | HSI RC startup time + regulator wake-up time from LP mode | |
| STOP LPFPD | - | 0 | 1 | 1 | HSI RC startup time + Flash wake-up time from Deep Power Down mode + regulator wake-up time from LP mode | |
| STOP MRLV | 1 | - | - | 0 | HSI RC startup time + Flash wake-up time from Deep Power Down mode + Main regulator from low voltage mode | |
| STOP LPLV | - | 1 | - | 1 | HSI RC startup time + Flash wake-up time from Deep Power Down mode + regulator wake-up time from Low Voltage LP mode |
Entering Stop mode
The Stop mode is entered according to Section : Entering low-power mode , when the SLEEPDEEP bit in the Cortex ® -M4 with FPU System Control register is set.
Refer to Table 18 for details on how to enter the Stop mode.
To further reduce power consumption in Stop mode, the internal voltage regulator can be put in low-power mode. This is configured by the LPDS bit of the PWR power control register (PWR_CR) .
If Flash memory programming is ongoing, the Stop mode entry is delayed until the memory access is finished.
If an access to the APB domain is ongoing, The Stop mode entry is delayed until the APB access is finished.
In Stop mode, the following features can be selected by programming individual control bits:
- • Independent watchdog (IWDG): the IWDG is started by writing to its Key register or by hardware option. Once started it cannot be stopped except by a Reset. See Section 15.3 in Section 15: Independent watchdog (IWDG) .
- • Real-time clock (RTC): this is configured by the RTCEN bit in the Section 7.3.20: RCC Backup domain control register (RCC_BDCR)
- • Internal RC oscillator (LSI RC): this is configured by the LSION bit in the Section 7.3.21: RCC clock control & status register (RCC_CSR) .
- • External 32.768 kHz oscillator (LSE OSC): this is configured by the LSEON bit in the Section 7.3.20: RCC Backup domain control register (RCC_BDCR) .
The ADC can also consume power during the Stop mode, unless it is disabled before entering it. To disable it, the ADON bit in the ADC_CR2 register must be written to 0.
Note: If the application needs to disable the external clock before entering Stop mode, the HSEON bit must first be disabled and the system clock switched to HSI.
Otherwise, if the HSEON bit is kept enabled while the external clock (external oscillator) can be removed before entering stop mode, the clock security system (CSS) feature must be enabled to detect any external oscillator failure and avoid a malfunction behavior when entering stop mode.
Exiting Stop mode
The Stop mode is exited according to Section : Exiting low-power mode .
Refer to Table 18 for more details on how to exit Stop mode.
When exiting Stop mode by issuing an interrupt or a wake-up event, the HSI RC oscillator is selected as system clock.
When the voltage regulator operates in low-power mode, an additional startup delay is incurred when waking up from Stop mode. By keeping the internal regulator ON during Stop mode, the consumption is higher although the startup time is reduced.
Table 18. Stop mode entry and exit
| Stop mode | Description |
|---|---|
| Mode entry | WFI (Wait for Interrupt) or WFE (Wait for Event) while:
On Return from ISR:
Note: To enter Stop mode, all EXTI Line pending bits (in Pending register (EXTI_PR)), all peripheral interrupts pending bits, the RTC Alarm (Alarm A and Alarm B), RTC wake-up, RTC tamper, and RTC time stamp flags, must be reset. Otherwise, the Stop mode entry procedure is ignored and program execution continues. |
| Mode exit | If WFI or Return from ISR was used for entry: Any EXTI lines configured in Interrupt mode (the corresponding EXTI Interrupt vector must be enabled in the NVIC). The interrupt source can be external interrupts or peripherals with wake-up capability. Refer to Table 37: Vector table for STM32F411xC/E . If WFE was used for entry and SEVONPEND = 0 Any EXTI lines configured in event mode. Refer to Section 10.2.3: Wake-up event management on page 206 . If WFE was used for entry and SEVONPEND = 1:
|
| Wake-up latency | Table 17: Stop operating modes |
5.3.5 Standby mode
The Standby mode allows to achieve the lowest power consumption. It is based on the Cortex ® -M4 with FPU deepsleep mode, with the voltage regulator disabled. The 1.2 V domain is consequently powered off. The PLLs, the HSI oscillator and the HSE oscillator are also switched off. SRAM and register contents are lost except for registers in the backup domain (RTC registers and RTC backup register), and Standby circuitry (see Figure 7 ).
Entering Standby mode
The Standby mode is entered according to Section : Entering low-power mode , when the SLEEPDEEP bit in the Cortex ® -M4 with FPU System Control register is set.
Refer to Table 19 for more details on how to enter Standby mode.
In Standby mode, the following features can be selected by programming individual control bits:
- • Independent watchdog (IWDG): the IWDG is started by writing to its Key register or by hardware option. Once started it cannot be stopped except by a reset. See Section 15.3 in Section 15: Independent watchdog (IWDG) .
- • Real-time clock (RTC): this is configured by the RTCEN bit in the backup domain control register (RCC_BDCR)
- • Internal RC oscillator (LSI RC): this is configured by the LSION bit in the Control/status register (RCC_CSR).
- • External 32.768 kHz oscillator (LSE OSC): this is configured by the LSEON bit in the backup domain control register (RCC_BDCR)
Exiting Standby mode
The Standby mode is exited according to Section : Exiting low-power mode . The SBF status flag in PWR_CR (see Section 5.4.2: PWR power control/status register (PWR_CSR) ) indicates that the MCU was in Standby mode. All registers are reset after wake-up from Standby except for PWR_CR.
Refer to Table 19 for more details on how to exit Standby mode.
Table 19. Standby mode entry and exit
| Standby mode | Description |
|---|---|
| Mode entry | WFI (Wait for Interrupt) or WFE (Wait for Event) while:
On return from ISR while:
|
| Mode exit | WKUP pin rising edge, RTC alarm (Alarm A and Alarm B), RTC wake-up, tamper event, time stamp event, external reset in NRST pin, IWDG reset. |
| Wake-up latency | Reset phase. |
I/O states in Standby mode
In Standby mode, all I/O pins are high impedance except for:
- • Reset pad (still available)
- • RTC_AF1 pin (PC13) if configured for tamper, time stamp, RTC Alarm out, or RTC clock calibration out
- • WKUP pin (PA0), if enabled
Debug mode
By default, the debug connection is lost if the application puts the MCU in Stop or Standby mode while the debug features are used. This is due to the fact that the Cortex ® -M4 with FPU core is no longer clocked.
However, by setting some configuration bits in the DBGMCU_CR register, the software can be debugged even when using the low-power modes extensively. For more details, refer to Section 23.16.1: Debug support for low-power modes .
5.3.6 Programming the RTC alternate functions to wake up the device from the Stop and Standby modes
The MCU can be woken up from a low-power mode by an RTC alternate function.
The RTC alternate functions are the RTC alarms (Alarm A and Alarm B), RTC wake-up, RTC tamper event detection and RTC time stamp event detection.
These RTC alternate functions can wake up the system from the Stop and Standby low-power modes.
The system can also wake up from low-power modes without depending on an external interrupt (Auto-wake-up mode), by using the RTC alarm or the RTC wake-up events.
The RTC provides a programmable time base for waking up from the Stop or Standby mode at regular intervals.
For this purpose, two of the three alternate RTC clock sources can be selected by programming the RTCSEL[1:0] bits in the Section 7.3.20: RCC Backup domain control register (RCC_BDCR) :
- • Low-power 32.768 kHz external crystal oscillator (LSE OSC)
This clock source provides a precise time base with a very low-power consumption (additional consumption of less than 1 µA under typical conditions) - • Low-power internal RC oscillator (LSI RC)
This clock source has the advantage of saving the cost of the 32.768 kHz crystal. This internal RC oscillator is designed to use minimum power.
RTC alternate functions to wake up the device from the Stop mode
- • To wake up the device from the Stop mode with an RTC alarm event, it is necessary to:
- a) Configure the EXTI Line 17 to be sensitive to rising edges (Interrupt or Event modes)
- b) Enable the RTC Alarm Interrupt in the RTC_CR register
- c) Configure the RTC to generate the RTC alarm
- • To wake up the device from the Stop mode with an RTC tamper or time stamp event, it is necessary to:
- a) Configure the EXTI Line 21 to be sensitive to rising edges (Interrupt or Event modes)
- b) Enable the RTC time stamp Interrupt in the RTC_CR register or the RTC tamper interrupt in the RTC_TAFCR register
- c) Configure the RTC to detect the tamper or time stamp event
- • To wake up the device from the Stop mode with an RTC wake-up event, it is necessary to:
- a) Configure the EXTI Line 22 to be sensitive to rising edges (Interrupt or Event modes)
- b) Enable the RTC wake-up interrupt in the RTC_CR register
- c) Configure the RTC to generate the RTC Wake-up event
RTC alternate functions to wake up the device from the Standby mode
- • To wake up the device from the Standby mode with an RTC alarm event, it is necessary to:
- a) Enable the RTC alarm interrupt in the RTC_CR register
- b) Configure the RTC to generate the RTC alarm
- • To wake up the device from the Standby mode with an RTC tamper or time stamp event, it is necessary to:
- a) Enable the RTC time stamp interrupt in the RTC_CR register or the RTC tamper interrupt in the RTC_TAFCR register
- b) Configure the RTC to detect the tamper or time stamp event
- • To wake up the device from the Standby mode with an RTC wake-up event, it is necessary to:
- a) Enable the RTC wake-up interrupt in the RTC_CR register
- b) Configure the RTC to generate the RTC wake-up event
Safe RTC alternate function wake-up flag clearing sequence
If the selected RTC alternate function is set before the PWR wake-up flag (WUTF) is cleared, it is not detected on the next event as detection is made once on the rising edge.
To avoid bouncing on the pins onto which the RTC alternate functions are mapped, and exit correctly from the Stop and Standby modes, it is recommended to follow the sequence below before entering the Standby mode:
- • When using RTC alarm to wake up the device from the low-power modes:
- a) Disable the RTC alarm interrupt (ALRAIE or ALRBIE bits in the RTC_CR register)
- b) Clear the RTC alarm (ALRAF/ALRBF) flag
- c) Clear the PWR Wake-up (WUF) flag
- d) Enable the RTC alarm interrupt
- e) Re-enter the low-power mode
- • When using RTC wake-up to wake up the device from the low-power modes:
- a) Disable the RTC Wake-up interrupt (WUTIE bit in the RTC_CR register)
- b) Clear the RTC Wake-up (WUTF) flag
- c) Clear the PWR Wake-up (WUF) flag
- d) Enable the RTC Wake-up interrupt
- e) Re-enter the low-power mode
- • When using RTC tamper to wake up the device from the low-power modes:
- a) Disable the RTC tamper interrupt (TAMPIE bit in the RTC_TAFCR register)
- b) Clear the Tamper (TAMP1F/TSF) flag
- c) Clear the PWR Wake-up (WUF) flag
- d) Enable the RTC tamper interrupt
- e) Re-enter the low-power mode
- • When using RTC time stamp to wake up the device from the low-power modes:
- a) Disable the RTC time stamp interrupt (TSIE bit in RTC_CR)
- b) Clear the RTC time stamp (TSF) flag
- c) Clear the PWR Wake-up (WUF) flag
- d) Enable the RTC TimeStamp interrupt
- e) Re-enter the low-power mode
5.4 Power control registers
5.4.1 PWR power control register (PWR_CR)
Address offset: 0x00
Reset value: 0x0000 8000 (reset by wake-up from Standby mode)
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reserved | FISSR | FMSSR | Reserved | ||||||||||||
| rw | rw | ||||||||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| VOS | ADCDC1 | Res | MRLV DS | LPLV DS | FPDS | DBP | PLS[2:0] | PVDE | CSBF | CWUF | PDDS | LPDS | |||
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | w | w | rw | rw | |
Bits 31:22 Reserved, must be kept at reset value.
Bit 21 FISSR : Flash Interface Stop while System Run
0: Flash Interface clock run (Default value).
1: Flash Interface clock off.
Note: This bit could not be set while executing with the Flash itself. It should be done with specific routine executed from RAM.
Bit 20 FMSSR : Flash Memory Sleep System Run.
0: Flash standard mode (Default value)
1: Flash forced to be in STOP or DeepPower Down mode (depending of FPDS value bit) by hardware.
Note: This bit could not be set while executing with the Flash itself. It should be done with specific routine executed from RAM.
Bits 19:16 Reserved, must be kept at reset value.
Bits 15:14 VOS[1:0] : Regulator voltage scaling output selection
These bits control the main internal voltage regulator output voltage to achieve a trade-off between performance and power consumption when the device does not operate at the maximum frequency (refer to the corresponding datasheet for more details).
These bits can be modified only when the PLL is OFF. The new value programmed is active only when the PLL is ON. When the PLL is OFF, the voltage regulator is set to scale 3 independently of the VOS register content.
00: Reserved (Scale 3 mode selected)
01: Scale 3 mode \( \leq 64 \) MHz
10: Scale 2 mode (reset value) \( \leq 84 \) MHz
11: Scale 1 mode \( \leq 100 \) MHz
Bit 13 ADCDC1 :
0: No effect.
1: Refer to AN4073 for details on how to use this bit.
Note: This bit can only be set when operating at supply voltage range 2.7 to 3.6V and when the Prefetch is OFF.
Bit 12 Reserved, must be kept at reset value.
Bit 11 MRLVDS : Main regulator Low Voltage in Deep Sleep
0: Main regulator in Voltage scale 3 when the device is in Stop mode.
1: Main regulator in Low Voltage and Flash memory in Deep Sleep mode when the device is in Stop mode.
Bit 10 LPLVDS : Low-power regulator Low Voltage in Deep Sleep
0: Low-power regulator on if LPDS bit is set when the device is in Stop mode.
1: Low-power regulator in Low Voltage and Flash memory in Deep Sleep mode if LPDS bit is set when device is in Stop mode.
Bit 9 FPDS : Flash power-down in Stop mode
When set, the Flash memory enters power-down mode when the device enters Stop mode. This allows to achieve a lower consumption in stop mode but a longer restart time.
0: Flash memory not in power-down when the device is in Stop mode or the Flash Memory is in Stop mode (FMSSR bit)
1: Flash memory in power-down when the device is in Stop mode or the Flash Memory is in Stop mode (FMSSR bit)
Bit 8 DBP : Disable backup domain write protection
In reset state, the RCC_BDCR register, the RTC registers (including the backup registers), and the BRE bit of the PWR_CSR register, are protected against parasitic write access. This bit must be set to enable write access to these registers.
0: Access to RTC and RTC Backup registers.
1: Access to RTC and RTC Backup registers.
Note: Depending on the APB1 prescaler, there is a delay between writing to DBP and the effective disabling/enabling of the backup domain protection. Therefore, a dummy read operation to the PWR_CR register is required just after writing to the DBP bit.
Bits 7:5 PLS[2:0] : PVD level selection
These bits are written by software to select the voltage threshold detected by the programmable voltage detector
000: 2.2 V
001: 2.3 V
010: 2.4 V
011: 2.5 V
100: 2.6 V
101: 2.7 V
110: 2.8 V
111: 2.9 V
Note: Refer to the electrical characteristics of the datasheet for more details.
Bit 4 PVDE : Programmable voltage detector enable
This bit is set and cleared by software.
0: PVD disabled
1: PVD enabled
Bit 3 CSBF : Clear standby flag
This bit is always read as 0.
0: No effect.
1: Clear the SBF Standby Flag (write).
Bit 2 CWUF : Clear wake-up flag
This bit is always read as 0.
0: No effect.
1: Clear the WUF Wake-up Flag after 2 System clock cycles.
Bit 1 PDDS : Power-down deepsleep
This bit is set and cleared by software. It works together with the LPDS bit.
0: Enter Stop mode when the CPU enters deepsleep. The regulator status depends on the LPDS bit.
1: Enter Standby mode when the CPU enters deepsleep.
Bit 0 LPDS : Low-power deepsleep
This bit is set and cleared by software. It works together with the PDDS bit.
0: Voltage regulator on during Stop mode.
1: Low-power Voltage regulator on during Stop mode.
5.4.2 PWR power control/status register (PWR_CSR)
Address offset: 0x04
Reset value: 0x0000 0000 (not reset by wake-up from Standby mode)
Additional APB cycles are needed to read this register versus a standard APB read.
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reserved | |||||||||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res | VOS RDY | Reserved | BRE | EWUP | Reserved | BRR | PVDO | SBF | WUF | ||||||
| r | rw | rw | r | r | r | r | |||||||||
Bits 31:15 Reserved, must be kept at reset value.
Bit 14 VOSRDY : Regulator voltage scaling output selection ready bit
0: Not ready
1: Ready
Bits 13:10 Reserved, must be kept at reset value.
Bit 9 BRE : Backup regulator enable
When set, the Backup regulator (used to maintain the backup domain content) is enabled. If BRE is reset, the backup regulator is switched off. Once set, the application must wait that the Backup Regulator Ready flag (BRR) is set to indicate that the data written into the backup registers is maintained in the Standby and V BAT modes.
0: Backup regulator disabled
1: Backup regulator enabled
Note: This bit is not reset when the device wakes up from Standby mode, by a system reset, or by a power reset. This bit is reset by a backup domain reset.
The DBP bit of the PWR_CR register must be set before BRE can be written.
Bit 8 EWUP : Enable WKUP pinThis bit is set and cleared by software.
0: WKUP pin is used for general purpose I/O. An event on the WKUP pin does not wake up the device from Standby mode.
1: WKUP pin is used for wake-up from Standby mode and forced in input pull down configuration (rising edge on WKUP pin wakes-up the system from Standby mode).
Note: This bit is reset by a system reset.
Bits 7:4 Reserved, must be kept at reset value.
Bit 3 BRR : Backup regulator readySet by hardware to indicate that the Backup Regulator is ready.
0: Backup Regulator not ready
1: Backup Regulator ready
Note: This bit is not reset when the device wakes up from Standby mode or by a system reset or power reset. This bit is reset by a backup domain reset.
Bit 2 PVDO : PVD outputThis bit is set and cleared by hardware. It is valid only if PVD is enabled by the PVDE bit.
0: V DD is higher than the PVD threshold selected with the PLS[2:0] bits.
1: V DD is lower than the PVD threshold selected with the PLS[2:0] bits.
Note: The PVD is stopped by Standby mode. For this reason, this bit is equal to 0 after Standby or reset until the PVDE bit is set.
Bit 1 SBF : Standby flagThis bit is set by hardware and cleared only by a POR/PDR (power-on reset/power-down reset) or by setting the CSBF bit in the PWR_CR register.
0: Device has not been in Standby mode
1: Device has been in Standby mode
Bit 0 WUF : Wake-up flagThis bit is set by hardware and cleared either by a system reset or by setting the CWUF bit in the PWR_CR register.
0: No wake-up event occurred
1: A wake-up event was received from the WKUP pin or from the RTC alarm (Alarm A or Alarm B), RTC Tamper event, RTC TimeStamp event or RTC Wake-up).
Note: An additional wake-up event is detected if the WKUP pin is enabled (by setting the EWUP bit) when the WKUP pin level is already high.
5.5 PWR register map
The following table summarizes the PWR registers.
Table 20. PWR - register map and reset values
| Offset | Register | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x000 | PWR_CR | Reserved | FISSR | FMSSR | Reserved | VOS[1:0] | ADCDC1 | MRLVDS | LPLVDS | FPDS | DBP | PLS[2:0] | PVDE | CSBF | CWUF | PDDS | LPDS | ||||||||||||||||
| Reset value | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||||||||||||
Table 20. PWR - register map and reset values (continued)
| Offset | Register | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x004 | PWR_CSR | Reserved | BRE | EWUP | Reserved | BRR | PVDO | SBF | WUF | ||||||||||||||||||||||||
| Reset value | Reserved | 0 | 0 | Reserved | 0 | 0 | 0 | 0 | |||||||||||||||||||||||||
Refer to Table 3 on page 42 Section 2.3: Memory map for the register boundary addresses.