5. Power controller (PWR)

5.1 Power supplies

There are two main power supply schemes:

Note: \( V_{DD\_USB} \) value does not dependent on \( V_{DD} \) and \( V_{DDA} \) . However, \( V_{DD\_USB} \) must be the last supply to be delivered to the device and the first to be switched off. When the three power supplies are shut down, if \( V_{DD\_USB} \) remains active for a short period of time and \( V_{DDA}/V_{DDIO} \) fall below the functional range, the device is not be damaged.

The device is still functional when \( V_{DD\_USB} \) is switched off.

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 the datasheet.

Figure 8. Power supply overview

Figure 8. Power supply overview. This block diagram illustrates the power distribution and regulation for a microcontroller system. At the top, a battery (V<sub>BAT</sub> = 1.65 to 3.6V) is connected to a power switch. The switch output feeds into the backup circuitry (OSC32K, RTC, Wakeup logic, Backup registers) and a level shifter. The level shifter has 'OUT' and 'IN' pins connected to 'IO Logic'. Below the switch, a voltage regulator is shown with multiple output pins labeled V<sub>DD</sub>, V<sub>SS</sub>, V<sub>CAP_1</sub>, and V<sub>CAP_2</sub>. The V<sub>DD</sub> output is connected to 'Kernel logic (CPU, digital & RAM)' and 'Flash memory'. The V<sub>SS</sub> output is connected to ground through a bypass capacitor (11 x 100 nF + 1 x 4.7 µF). The V<sub>CAP_1</sub> and V<sub>CAP_2</sub> outputs are connected to ground through capacitors (2 x 2.2 µF). A 'BYPASS_REG' pin is also shown. Below the voltage regulator, an 'OTG FS PHY' and a 'Reset controller' are connected to the V<sub>DD</sub> line. The 'PDR_ON' pin is connected to the V<sub>DD</sub> line. At the bottom, an 'ADC' block is shown with its own independent supply pins: V<sub>DDA</sub>, V<sub>REF+</sub>, V<sub>REF-</sub>, and V<sub>SSA</sub>. The V<sub>DDA</sub> pin is connected to V<sub>DD</sub> through a capacitor (100 nF + 1 µF). The V<sub>REF+</sub> pin is connected to V<sub>REF</sub> through a capacitor (100 nF + 1 µF). The V<sub>REF-</sub> pin is connected to V<sub>SSA</sub> through a capacitor (100 nF + 1 µF). The V<sub>SSA</sub> pin is connected to ground through a capacitor (100 nF + 1 µF). The ADC is connected to 'Analog: RCs, PLL...'. Other pins shown include GPIOs, V<sub>DD_USB</sub>, and V<sub>SSA</sub>. The diagram is labeled MSv39022V1.
Figure 8. Power supply overview. This block diagram illustrates the power distribution and regulation for a microcontroller system. At the top, a battery (V BAT = 1.65 to 3.6V) is connected to a power switch. The switch output feeds into the backup circuitry (OSC32K, RTC, Wakeup logic, Backup registers) and a level shifter. The level shifter has 'OUT' and 'IN' pins connected to 'IO Logic'. Below the switch, a voltage regulator is shown with multiple output pins labeled V DD , V SS , V CAP_1 , and V CAP_2 . The V DD output is connected to 'Kernel logic (CPU, digital & RAM)' and 'Flash memory'. The V SS output is connected to ground through a bypass capacitor (11 x 100 nF + 1 x 4.7 µF). The V CAP_1 and V CAP_2 outputs are connected to ground through capacitors (2 x 2.2 µF). A 'BYPASS_REG' pin is also shown. Below the voltage regulator, an 'OTG FS PHY' and a 'Reset controller' are connected to the V DD line. The 'PDR_ON' pin is connected to the V DD line. At the bottom, an 'ADC' block is shown with its own independent supply pins: V DDA , V REF+ , V REF- , and V SSA . The V DDA pin is connected to V DD through a capacitor (100 nF + 1 µF). The V REF+ pin is connected to V REF through a capacitor (100 nF + 1 µF). The V REF- pin is connected to V SSA through a capacitor (100 nF + 1 µF). The V SSA pin is connected to ground through a capacitor (100 nF + 1 µF). The ADC is connected to 'Analog: RCs, PLL...'. Other pins shown include GPIOs, V DD_USB , and V SSA . The diagram is labeled MSv39022V1.
  1. 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.

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, V BAT 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 \( V_{BAT} \) pin powers the following blocks:

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 \( V_{BAT} \) pin cannot support this current injection, it is strongly recommended to connect an external low-drop diode between this power supply and the \( V_{BAT} \) pin.


If no external battery is used in the application, it is recommended to connect \( V_{BAT} \) to \( V_{DD} \) supply and add a 100 nF ceramic decoupling capacitor on \( V_{BAT} \) pin.

When the backup domain is supplied by \( V_{DD} \) (analog switch connected to \( V_{DD} \) ), the following functions are available:

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:

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. 1. Enable the power interface clock by setting the PWREN bits in the RCC_APB1ENR register (see Section 6.3.12: RCC AHB3 peripheral clock enable register (RCC_AHB3ENR) )
    2. 2. Set the DBP bit in the Section 5.4.1 to enable access to the backup domain
    3. 3. Select the RTC clock source: see Section 6.2.8: RTC/AWU clock
    4. 4. Enable the RTC clock by programming the RTCEN [15] bit in the Section 6.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 wakeup 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 22: 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.

The voltage scaling allows optimizing the power consumption when the device is clocked below the maximum system frequency.

Voltage scale 3 is automatically selected when the microcontroller enters Stop mode (see Section 5.4.1: PWR power control register (PWR_CR) ).

Note: For more details, refer to the voltage regulator section in the STM32F412xx 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 STM32F412xx 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 9. Power-on reset/power-down reset waveform

Figure 9: Power-on reset/power-down reset waveform. The graph shows the supply voltage VDD/VDDA rising and then falling. The rising edge triggers a Power-on Reset (POR) at a threshold voltage. The falling edge triggers a Power-down Reset (PDR) at a lower threshold voltage. The difference between these two thresholds is labeled '40 mV hysteresis'. The time interval between the start of the reset and the release of the reset is labeled 'Temporization tRSTTEMPO'. The Reset signal is shown as a pulse that goes high when the voltage is below the POR threshold and goes low when the voltage is above the PDR threshold.

The figure is a waveform diagram illustrating the Power-on Reset (POR) and Power-down Reset (PDR) behavior. The top part shows the supply voltage \( V_{DD}/V_{DDA} \) rising from 0V to a maximum level and then falling. During the rising phase, a horizontal dashed line indicates the POR threshold. During the falling phase, another horizontal dashed line indicates the PDR threshold. The vertical distance between these two thresholds is labeled "40 mV hysteresis". The time interval from the start of the reset (when voltage is below POR) to the release of the reset (when voltage is above PDR) is labeled "Temporization \( t_{RSTTEMPO} \) ". The bottom part shows the "Reset" signal as a digital pulse that is high (active) when the voltage is below the POR threshold and goes low when the voltage is above the PDR threshold. The diagram is labeled "MS30431V1" in the bottom right corner.

Figure 9: Power-on reset/power-down reset waveform. The graph shows the supply voltage VDD/VDDA rising and then falling. The rising edge triggers a Power-on Reset (POR) at a threshold voltage. The falling edge triggers a Power-down Reset (PDR) at a lower threshold voltage. The difference between these two thresholds is labeled '40 mV hysteresis'. The time interval between the start of the reset and the release of the reset is labeled 'Temporization tRSTTEMPO'. The Reset signal is shown as a pulse that goes high when the voltage is below the POR threshold and goes low when the voltage is above the PDR threshold.

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:

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/ PDR or 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 10. BOR thresholds

Figure 10. BOR thresholds. A graph showing the supply voltage (VDD/VDDA) over time. The voltage rises linearly, then drops linearly. A horizontal dashed line indicates the BOR threshold. The hysteresis is shown as the vertical distance between the rising and falling edges of the voltage curve at the threshold level, labeled '100 mV hysteresis'. Below the graph, a 'Reset' signal is shown as a horizontal line that goes high when the voltage drops below the threshold and returns low when it rises above it. The diagram is labeled MS30433V1.

The figure illustrates the BOR thresholds and hysteresis. The top graph shows the supply voltage ( \( V_{DD}/V_{DDA} \) ) over time. The voltage rises linearly and then drops linearly. A horizontal dashed line represents the BOR threshold. The hysteresis is indicated by the vertical distance between the rising and falling edges of the voltage curve at the threshold level, labeled "100 mV hysteresis". Below the graph, a "Reset" signal is shown as a horizontal line that goes high when the voltage drops below the threshold and returns low when it rises above it. The diagram is labeled MS30433V1.

Figure 10. BOR thresholds. A graph showing the supply voltage (VDD/VDDA) over time. The voltage rises linearly, then drops linearly. A horizontal dashed line indicates the BOR threshold. The hysteresis is shown as the vertical distance between the rising and falling edges of the voltage curve at the threshold level, labeled '100 mV hysteresis'. Below the graph, a 'Reset' signal is shown as a horizontal line that goes high when the voltage drops below the threshold and returns low when it rises above it. The diagram is labeled MS30433V1.

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 rising/falling edge sensitivity of the EXTI line 16 should be configured according to PVD output behavior. For example, if the EXTI line 16 is configured to rising edge sensitivity, the interrupt will be generated when \( V_{DD} \) drops below the PVD threshold. As an example the service routine could perform emergency shutdown tasks.

Figure 11. PVD thresholds

Figure 11. PVD thresholds. A graph showing VDD on the y-axis and time on the x-axis. The VDD curve rises to a peak and then falls. Two horizontal dashed lines represent the PVD threshold and a lower threshold, with a 100 mV hysteresis indicated between them. Below the graph, the PVD output is shown as a digital signal that is high when VDD is below the lower threshold and low otherwise. The identifier MS30432V2 is in the bottom right corner.
Figure 11. PVD thresholds. A graph showing VDD on the y-axis and time on the x-axis. The VDD curve rises to a peak and then falls. Two horizontal dashed lines represent the PVD threshold and a lower threshold, with a 100 mV hysteresis indicated between them. Below the graph, the PVD output is shown as a digital signal that is high when VDD is below the lower threshold and low otherwise. The identifier MS30432V2 is 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 wakeup sources.

The devices feature four low-power modes:

In addition, the power consumption in Run mode can be reduce by one of the following means:

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 will be 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:

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 will wakeup and interrupt 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 will wakeup the MCU, even the disabled ones. Only enabled NVIC interrupts with sufficient priority will wakeup and interrupt the MCU.

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 207: 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 will wakeup and interrupt the MCU.

Table 15. Low-power mode summary

Mode nameEntryWakeupEffect on 1.2 V domain clocksEffect on V DD domain clocksVoltage regulator
Sleep and BAM (1)
(Sleep now or Sleep-on-exit)
WFI or Return from ISRAny interruptCPU CLK OFF
no effect on other clocks or analog clock sources
NoneON
WFEWakeup event
StopSLEEPDEEP bit + WFI, Return from ISR or WFEAny EXTI line (configured in the EXTI registers, internal and external lines)All 1.2 V domain clocks OFFHSI and HSE oscillators OFFMain regulator or Low-Power regulator (depends on PWR power control register (PWR_CR) )
StandbyPDDS bit + SLEEPDEEP bit + WFI, Return from ISR or WFEWKUP pin rising edge, RTC alarm (Alarm A or Alarm B), RTC Wakeup event, RTC tamper events, RTC time stamp event, external reset in NRST pin, IWDG resetOFF

1. Refer to Section 5.3.4: Batch acquisition mode for specific BAM entry and exit requirements.

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 6.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 6.3.10: RCC AHB1 peripheral clock enable register (RCC_AHB1ENR) , Section 6.3.11: RCC AHB2 peripheral clock enable register (RCC_AHB2ENR) and Section 6.3.12: RCC AHB3 peripheral clock enable register (RCC_AHB3ENR) ).

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 Entering low-power mode , when the SLEEPDEEP bit in the Cortex ® -M4 with FPU System Control register is cleared.

Refer to Table 16 and Table 17 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 Exiting low-power mode .

Refer to Table 16 and Table 17 for more details on how to exit Sleep mode.

Table 16. Sleep-now entry and exit

Sleep-now modeDescription
Mode entryWFI (Wait for Interrupt) or WFE (Wait for Event) while:
  • – SLEEPDEEP = 0, and
  • – No interrupt (for WFI) or event (for WFE) is pending.
Refer to the Cortex ® -M4 with FPU System Control register.
On Return from ISR while:
  • – SLEEPDEEP = 0 and
  • – SLEEPONEXIT = 1,
  • – No interrupt is pending.
Refer to the Cortex ® -M4 with FPU System Control register.
Mode exitIf WFI or Return from ISR was used for entry:
Interrupt: Refer to Table 40: Vector table for STM32F412xx
If WFE was used for entry and SEVONPEND = 0
Wakeup event: Refer to Section 10.2.3: Wakeup event management
If WFE was used for entry and SEVONPEND = 1
Interrupt even when disabled in NVIC: refer to Table 40: Vector table for STM32F412xx or Wakeup event (see Section 10.2.3: Wakeup event management ).
Wakeup latencyNone

Table 17. Sleep-on-exit entry and exit

Sleep-on-exitDescription
Mode entryWFI (Wait for Interrupt) or WFE (Wait for Event) while:
  • – SLEEPDEEP = 0, and
  • – No interrupt (for WFI) or event (for WFE) is pending.
Refer to the Cortex ® -M4 with FPU System Control register.
On Return from ISR while:
  • – SLEEPDEEP = 0, and
  • – SLEEPONEXIT = 1, and
  • – No interrupt is pending.
Refer to the Cortex ® -M4 with FPU System Control register.

Table 17. Sleep-on-exit entry and exit (continued)

Sleep-on-exitDescription
Mode exitInterrupt: refer to Table 40: Vector table for STM32F412xx
Wakeup latencyNone

5.3.4 Batch acquisition mode

Entering BAM

The BAM 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 18 and Table 19 for details on how to enter Sleep mode.

Before entering Sleep mode, the flash memory must be configured by software to operate in the required low-power mode. If data need to be transferred from peripheral to RAM during BAM, the DMA must be enabled before entering Sleep mode.

Exiting BAM

The BAM is exited according to Section : Exiting low-power mode .

Refer to Table 18 and Table 19 for more details on how to exit Sleep mode.

After waking up from BAM, the flash memory must first to be waked up if code execution restarts from flash memory.

This wakeup time must be managed by software running from the internal SRAM.

Table 18. BAM-now entry and exit

Sleep-now modeDescription
Mode entry

Set the flash memory in low-power mode:

  • – FISSR/FMSSR and FPDS bits of the PWR_CR register

WFI (Wait for Interrupt) or WFE (Wait for Event) while:

  • – SLEEPDEEP = 0 and
  • – SLEEPONEXIT = 0

Refer to the Cortex ® -M4 with FPU System Control register.

Mode exit

If WFI was used for entry:

Interrupt: Refer to Table 40: Vector table for STM32F412xx

If WFE was used for entry

Wakeup event: Refer to Section 10.2.3: Wakeup event management

If flash memory wakeup time is needed, FISSR/FMSSR bits of PWR_CR register must be set

Wakeup latency

None if code executed from RAM

Low-power mode flash memory wakeup time, before restarting code execution from flash memory (refer to the flash memory wakeup time in the Electrical characteristics section of the datasheet).

Table 19. BAM-on-exit entry and exit

Sleep-on-exitDescription
Mode entrySet the flash memory in low-power mode:
– FISSR/FMSSR and FPDS bits of the PWR_CR register
WFI (wait for interrupt) while:
– SLEEPDEEP = 0 and
– SLEEPONEXIT = 1
Refer to the Cortex®-M4 with FPU System Control register.
Mode exitInterrupt: refer to Table 40: Vector table for STM32F412xx
If flash memory wakeup time is needed, FISSR/FMSSR bits of PWR_CR register must be set
Wakeup latencyNone when code executed from internal SRAM
Low-power mode flash memory wakeup time, before restarting code execution from flash memory (refer to the flash memory wakeup time in the Electrical characteristics section of the datasheet).

5.3.5 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 20: Stop operating modes and Section 5.4.1: PWR power control register (PWR_CR) ).

Table 20. Stop operating modes

Stop modeMRLV bitLPLV bitFPDS bitLPDS bitWakeup latency
Normal modeSTOP MR0-00HSI RC startup time
STOP MRFPD0-10HSI RC startup time +
flash wakeup time from Deep Power Down mode
STOP LP0001HSI RC startup time +
regulator wakeup time from LP mode
STOP LPFPD-011HSI RC startup time +
flash wakeup time from Deep Power Down mode +
regulator wakeup time from LP mode
STOP MRLV1--0HSI RC startup time +
flash wakeup time from Deep Power Down mode +
Main regulator from low voltage mode
STOP LPLV-1-1HSI RC startup time +
flash wakeup time from Deep Power Down mode +
regulator wakeup 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 21 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:

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 21 for more details on how to exit Stop mode.

When exiting Stop mode by issuing an interrupt or a wakeup 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 21. Stop mode entry and exit

Stop modeDescription
Mode entry

WFI (Wait for Interrupt) or WFE (Wait for Event) while:

  • – No interrupt (for WFI) or event (for WFE) is pending,
  • – SLEEPDEEP bit is set in Cortex®-M4 with FPU System Control register,
  • – PDDS bit is cleared in Power Control register (PWR_CR),
  • – Select the voltage regulator mode by configuring LPDS bit in PWR_CR.

On Return from ISR:

  • – No interrupt is pending,
  • – SLEEPDEEP bit is set in Cortex®-M4 with FPU System Control register,
  • – SLEEPONEXIT = 1,
  • – PDDS bit is cleared in Power Control register (PWR_CR).

Note: To enter Stop mode, all EXTI Line pending bits (in Section 10.3.6: Pending register (EXTI_PR) ), all peripheral interrupts pending bits, the RTC Alarm (Alarm A and Alarm B), RTC wakeup, RTC tamper, and RTC time stamp flags, must be reset. Otherwise, the Stop mode entry procedure is ignored and program execution continues.

Table 21. Stop mode entry and exit
Stop modeDescription
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 wakeup capability. Refer to Table 40: Vector table for STM32F412xx .

If WFE was used for entry and SEVONPEND = 0:
Any EXTI lines configured in event mode. Refer to Section 10.2.3: Wakeup event management .

If WFE was used for entry and SEVONPEND = 1:

Wakeup latencySee Table 20: Stop operating modes

5.3.6 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 8 ).

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 22 for more details on how to enter Standby mode.

In Standby mode, the following features can be selected by programming individual control bits:

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 wakeup from Standby except for PWR_CR.

Refer to Table 22 for more details on how to exit Standby mode.

Table 22. Standby mode entry and exit

Standby modeDescription
Mode entry

WFI (Wait for Interrupt) or WFE (Wait for Event) while:

  • – SLEEPDEEP is set in Cortex ® -M4 with FPU System Control register,
  • – PDDS bit is set in Power Control register (PWR_CR),
  • – No interrupt (for WFI) or event (for WFE) is pending,
  • – WUF bit is cleared in Power Control register (PWR_CR),
  • – the RTC flag corresponding to the chosen wakeup source (RTC Alarm A, RTC Alarm B, RTC wakeup, Tamper or Timestamp flags) is cleared

On return from ISR while:

  • – SLEEPDEEP bit is set in Cortex ® -M4 with FPU System Control register, and
  • – SLEEPONEXIT = 1, and
  • – PDDS bit is set in Power Control register (PWR_CR), and
  • – No interrupt is pending,
  • – WUF bit is cleared in Power Control/Status register (PWR_SR),
  • – The RTC flag corresponding to the chosen wakeup source (RTC Alarm A, RTC Alarm B, RTC wakeup, Tamper or Timestamp flags) is cleared.
Mode exitWKUP pin rising edge, RTC alarm (Alarm A and Alarm B), RTC wakeup, tamper event, time stamp event, external reset in NRST pin, IWDG reset.
Wakeup latencyReset phase.

I/O states in Standby mode

In Standby mode, all I/O pins are high impedance except for:

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 30.16.1: Debug support for low-power modes .

5.3.7 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 wakeup, 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-wakeup mode), by using the RTC alarm or the RTC wakeup 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 6.3.20: RCC Backup domain control register (RCC_BDCR) :

RTC alternate functions to wake up the device from the Stop mode

RTC alternate functions to wake up the device from the Standby mode

Safe RTC alternate function wakeup flag clearing sequence

If the selected RTC alternate function is set before the PWR wakeup flag (WUTF) is cleared, it will not be 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:

5.4 Power control registers

5.4.1 PWR power control register (PWR_CR)

Address offset: 0x00

Reset value: 0x0000 8000 (reset by wakeup from Standby mode)

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.FISSRFMSSRRes.Res.Res.Res.
1514131211109876543210
VOSADCD1Res.MRLV
DS
LPLV
DS
FPDSDBPPLS[2:0]PVDECSBFCWUFPDDSLPDS
rwrwrwrwrwrwrwrwrwrwrwwwrwrw

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 <= 64 MHz

10: Scale 2 mode (reset value) <= 84 MHz

11: Scale 1 mode <= 100 MHz

Bit 13 ADCD1 :

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

1: Flash memory in power-down when the device is in Stop mode

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.

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 wakeup flag

This bit is always read as 0.

0: No effect.

1: Clear the WUF Wakeup 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 wakeup from Standby mode)

Additional APB cycles are needed to read this register versus a standard APB read.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
14131211109876543210
Res.VOS
RDY
Res.Res.Res.Res.BREEWUP
1
EWUP
2
EWUP
3
Res.Res.BRRPVDOSBFWUF
rrwrwrwrwrrrr

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 will be maintained in the Standby and \( V_{BAT} \) modes. The DBP bit of PWR_CR register must be set to 1 before PWR_CSR.BRE can be written.

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.

Bit 8 EWUP1 : Enable WKUP1 pin (PA0)

This bit is set and cleared by software.

0: WKUP1 pin is used for general purpose I/O. An event on the WKUP1 pin does not wakeup the device from Standby mode.

1: WKUP1 pin is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP1 pin wakes-up the system from Standby mode).

Note: This bit is reset by a system reset.

Bit 7 EWUP2: Enable WKUP2 pin (PC0)

This bit is set and cleared by software.

0: WKUP2 pin is used for general purpose I/O. An event on the WKUP2 pin does not wakeup the device from Standby mode.

1: WKUP2 pin is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP2 pin wakes-up the system from Standby mode).

Note: This bit is reset by a system reset.

Bit 6 EWUP3: Enable WKUP3 pin (PC1)

This bit is set and cleared by software.

0: WKUP3 pin is used for general purpose I/O. An event on the WKUP3 pin does not wakeup the device from Standby mode.

1: WKUP3 pin is used for wakeup from Standby mode and forced in input pull down configuration (rising edge on WKUP3 pin wakes-up the system from Standby mode).

Note: This bit is reset by a system reset.

Bits 5:4 Reserved, must be kept at reset value.

Bit 3 BRR: Backup regulator ready

Set 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 output

This 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 flag

This 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: Wakeup flag

This 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 wakeup event occurred

1: A wakeup 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 Wakeup).

Note: An additional wakeup 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 23. PWR - register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.FISSRFMSSRRes.Res.Res.Res.VOS[1:0]ADDCDC1Res.Res.MRLVDSLPLVDSFPDSDBPPLS[2:0]PVDECSBFCWUFPDDSLPDS
0x000PWR_CR
Reset value00100000000000000
0x004PWR_CSRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.VOSRDYRes.Res.Res.Res.BREEWUP1EWUP2EWUP3Res.Res.BRRPVDOSBFWUF
Reset value000000000

Refer to Section 2.2 on page 49 for the register boundary addresses.