6. Power control (PWR)

6.1 Power supplies

The STM32F030/STM32F070 subfamily embeds a voltage regulator in order to supply the internal 1.8 V digital power domain.

Figure 7. Power supply overview

Figure 7. Power supply overview diagram showing the internal power domains and connections for STM32F030/STM32F070.

The diagram illustrates the power supply architecture for the STM32F030 and STM32F070 microcontrollers. It shows two main power domains: the \( V_{DDA} \) domain and the \( V_{DD} \) domain. The \( V_{DDA} \) domain includes the A/D converter, temperature sensor, reset block, and PLL. The \( V_{DD} \) domain includes the I/O ring, standby circuitry (Wakeup logic, IWDG), voltage regulator, core, memories, and digital peripherals. The LSE crystal 32 K osc and RTC are also shown. External pins are labeled \( V_{SSA} \) , \( V_{DDA} \) , \( V_{SS} \) , and \( V_{DD} \) . The diagram is labeled with 'STM32F030' and 'STM32F070' at the top right, and 'MS32604V1' at the bottom right.

Figure 7. Power supply overview diagram showing the internal power domains and connections for STM32F030/STM32F070.

6.1.1 Independent A/D converter supply and reference voltage

To improve conversion accuracy and to extend the supply flexibility, the ADC has an independent power supply that can be separately filtered and shielded from noise on the PCB.

The \( V_{DDA} \) supply/reference voltage must be equal or higher than \( V_{DD} \) .

When a single supply is used, \( V_{DDA} \) can be externally connected to \( V_{DD} \) , through the external filtering circuit in order to ensure a noise free \( V_{DDA} \) reference voltage.

When \( V_{DDA} \) is different from \( V_{DD} \) , \( V_{DDA} \) must always be higher or equal to \( V_{DD} \) . To keep safe potential difference in between \( V_{DDA} \) and \( V_{DD} \) during power-up/power-down, an external Schottky diode may be used between \( V_{DD} \) and \( V_{DDA} \) . Refer to the datasheet for the maximum allowed difference.

6.1.2 Voltage regulator

The voltage regulator is always enabled after Reset. It works in three different modes depending on the application modes.

6.2 Power supply supervisor

6.2.1 Power on reset (POR) / power down reset (PDR)

STM32F0x1xx and STM32F0x2xx devices feature integrated power-on reset (POR) and power-down reset (PDR) circuits, which are always active and ensure proper operation above a threshold of 2 V.

The device remains in Reset mode when the monitored supply voltage is below a specified threshold, \( V_{POR/PDR} \) , without the need for an external reset circuit.

For more details on the power on / power down reset threshold, refer to the electrical characteristics section in the datasheet.

Figure 8. Power on reset/power down reset waveform

Figure 8: Power on reset/power down reset waveform. The graph shows the relationship between supply voltage (VDD/VDDA) and the Reset signal over time. The voltage rises from 0V to a peak and then falls back to 0V. The Reset signal is high (active) when the voltage is below the Power Down Reset (PDR) threshold and low (inactive) when the voltage is above the Power Up Reset (POR) threshold. The POR threshold is higher than the PDR threshold by 40 mV. The time interval between the voltage crossing the POR threshold and the Reset signal going low is labeled as Temporization t_RSTTEMPO.

The figure is a waveform diagram showing the relationship between supply voltage ( \( V_{DD}/V_{DDA} \) ) and the Reset signal. The top part of the graph shows the supply voltage rising from 0V to a peak and then falling back to 0V. The bottom part shows the Reset signal, which is high (active) when the voltage is below the Power Down Reset (PDR) threshold and low (inactive) when the voltage is above the Power Up Reset (POR) threshold. The POR threshold is higher than the PDR threshold by 40 mV. The time interval between the voltage crossing the POR threshold and the Reset signal going low is labeled as Temporization \( t_{RSTTEMPO} \) . The diagram is labeled MS31444V2.

Figure 8: Power on reset/power down reset waveform. The graph shows the relationship between supply voltage (VDD/VDDA) and the Reset signal over time. The voltage rises from 0V to a peak and then falls back to 0V. The Reset signal is high (active) when the voltage is below the Power Down Reset (PDR) threshold and low (inactive) when the voltage is above the Power Up Reset (POR) threshold. The POR threshold is higher than the PDR threshold by 40 mV. The time interval between the voltage crossing the POR threshold and the Reset signal going low is labeled as Temporization t_RSTTEMPO.

6.3 Low-power modes

By default, the microcontroller is in Run mode after a system or a power Reset. 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 device features three low-power modes:

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

Table 15. Low-power mode summary

Mode nameEntryWake-upEffect on 1.8 V domain clocksEffect on V DD domain clocksVoltage regulator
Sleep
(Sleep now or Sleep-on - exit)
WFIAny interruptCPU clock OFF
no effect on other clocks or analog clock sources
NoneON
WFEWake-up event
StopPDDS and LPDS bits + SLEEPDEEP bit + WFI or WFEAny EXTI line (configured in the EXTI registers)All 1.8V domain clocks OFFHSI and HSE oscillators OFFON or in low-power mode (depends on Power control register (PWR_CR) )
PDDS bit + SLEEPDEEP bit + WFI or WFEWKUP pin rising edge, RTC alarm, external reset in NRST pin, IWDG reset
StandbyPDDS bit + SLEEPDEEP bit + WFI or WFEWKUP pin rising edge, RTC alarm, external reset in NRST pin, IWDG resetOFF

6.3.1 Slowing down system clocks

In Run mode the speed of the system clocks (SYSCLK, HCLK, PCLK) 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.4.2: Clock configuration register (RCC_CFGR) .

6.3.2 Peripheral clock gating

In Run mode, the AHB clock (HCLK) and the APB clock (PCLK) 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 AHB peripheral clock enable register (RCC_AHBENR) , the APB peripheral clock enable register 2 (RCC_APB2ENR) and the APB peripheral clock enable register 1 (RCC_APB1ENR) .

6.3.3 Sleep mode

Entering Sleep mode

The Sleep mode is entered by executing the WFI (Wait For Interrupt) or WFE (Wait for Event) instructions. Two options are available to select the Sleep mode entry mechanism, depending on the SLEEPONEXIT bit in the Arm ® Cortex ® -M0 System Control register:

In the Sleep mode, all I/O pins keep the same state as in the Run mode.

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

Exiting Sleep mode

If the WFI instruction is used to enter Sleep mode, any peripheral interrupt acknowledged by the nested vectored interrupt controller (NVIC) can wake up the device from Sleep mode.

If the WFE instruction is used to enter Sleep mode, the MCU exits Sleep mode as soon as an event occurs. The wake-up event can be generated either by:

This mode offers the lowest wake-up time as no time is wasted in interrupt entry/exit.

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

Table 16. Sleep-now

Sleep-now modeDescription
Mode entryWFI (Wait for Interrupt) or WFE (Wait for Event) while:
– SLEEPDEEP = 0 and
– SLEEPONEXIT = 0
Refer to the Arm ® Cortex ® -M0 System Control register.
Mode exitIf WFI was used for entry:
Interrupt: Refer to Table 31: Vector table
If WFE was used for entry
Wake-up event: Refer to Section 11.2.3: Event management
Wake-up latencyNone

Table 17. Sleep-on-exit

Sleep-on-exitDescription
Mode entryWFI (wait for interrupt) while:
– SLEEPDEEP = 0 and
– SLEEPONEXIT = 1
Refer to the Arm ® Cortex ® -M0 System Control register.
Mode exitInterrupt: Refer to Table 31: Vector table .
Wake-up latencyNone

6.3.4 Stop mode

The Stop mode is based on the Arm ® Cortex ® -M0 deep sleep 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.8 V domain are stopped, the PLL, the HSI and the HSE oscillators are disabled. SRAM and register contents are preserved.

In the Stop mode, all I/O pins keep the same state as in the Run mode.

Entering Stop mode

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 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 Stop mode, unless it is disabled before entering this mode. Refer to ADC control register (ADC_CR) for details on how to disable it.

Exiting Stop 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 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

Stop modeDescription
Mode entry

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

  • – Set SLEEPDEEP bit in Arm ® Cortex ® -M0 System Control register
  • – Clear PDDS bit in Power Control register (PWR_CR)
  • – Select the voltage regulator mode by configuring LPDS bit in PWR_CR

Note: To enter Stop mode, all EXTI line pending bits (in Pending register (EXTI_PR) ), all peripherals interrupt pending bits and RTC Alarm flag must be reset. Otherwise, the Stop mode entry procedure is ignored and program execution continues.

If the application needs to disable the external oscillator (external clock) before entering Stop mode, the system clock source must be first switched to HSI and then clear the HSEON bit.

Otherwise, if before entering Stop mode the HSEON bit is kept at 1, the security system (CSS) feature must be enabled to detect any external oscillator (external clock) failure and avoid a malfunction when entering Stop mode.

Mode exit

If WFI was used for entry:

  • – Any EXTI line configured in Interrupt mode (the corresponding EXTI Interrupt vector must be enabled in the NVIC).

Refer to Table 31: Vector table .

If WFE was used for entry:

Any EXTI line configured in event mode. Refer to Section 11.2.3: Event management on page 174

Wake-up latencyHSI wake-up time + regulator wake-up time from Low-power mode

6.3.5 Standby mode

The Standby mode allows to achieve the lowest power consumption. It is based on the Arm® Cortex®-M0 deepsleep mode, with the voltage regulator disabled. The 1.8 V domain is consequently powered off. The PLL, the HSI oscillator and the HSE oscillator are also switched off. SRAM and register contents are lost except for registers in the Standby circuitry (see Figure 7 ).

Entering Standby mode

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:

Exiting Standby mode

The microcontroller exits the Standby mode when an external reset (NRST pin), an IWDG reset, a rising edge on one of the enabled WKUPx pins or an RTC event occurs. All registers are reset after wake-up from Standby except for Power control/status register (PWR_CSR) .

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.). The SBF status flag in the Power control/status register (PWR_CSR) indicates that the MCU was in Standby mode.

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

Table 19. Standby mode

Standby modeDescription
Mode entryWFI (Wait for Interrupt) or WFE (Wait for Event) while:
  • – Set SLEEPDEEP in Arm® Cortex®-M0 System Control register
  • – Set PDDS bit in Power Control register (PWR_CR)
  • – Clear WUF bit in Power Control/Status register (PWR_CSR)
Mode exitWKUP pin rising edge, RTC alarm event's rising edge, external Reset in NRST pin, IWDG Reset.
Wake-up latencyReset phase

I/O states in Standby mode

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

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 Arm ® Cortex ® -M0 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.

6.3.6 RTC wakeup from low-power mode

The RTC can be used to wake-up the MCU from low-power mode by means of the RTC alarm. For this purpose, two of the three alternative RTC clock sources can be selected by programming the RTCSEL[1:0] bits in the RTC domain control register (RCC_BDCR) :

To wake-up from Stop mode with an RTC alarm event, it is necessary to:

To wake-up from Standby mode, there is no need to configure the EXTI Line 17.

6.4 Power control registers

The peripheral registers can be accessed by half-words (16-bit) or words (32-bit).

6.4.1 Power control register (PWR_CR)

Address offset: 0x00

Reset value: 0x0000 0000 (reset by wake-up from Standby mode)

31302928272625242322212019181716
ResResResResResResResResResResResResResResResRes
1514131211109876543210
ResResResResResResResDBPResResResResCSBFCWUFPDDSLPDS
rwrc_w1rc_w1rwrw

Bits 31:9 Reserved, must be kept at reset value.

Bit 8 DBP : Disable RTC domain write protection.

In reset state, the RTC registers are protected against parasitic write access. This bit must be set to enable write access to these registers.

0: Access to RTC disabled

1: Access to RTC enabled

Bits 7:4 Reserved, must be kept at reset value

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 . (write)

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: Voltage regulator in low-power mode during Stop mode

Note: When a peripheral that can work in STOP mode requires a clock, the Power controller automatically switch the voltage regulator from Low-power mode to Normal mode and remains in this mode until the request disappears.

6.4.2 Power control/status register (PWR_CSR)

Address offset: 0x04

Reset value: 0x0000 000X (not reset by wake-up from Standby mode)

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

31302928272625242322212019181716
ResResResResResResResResResResResResResResResRes
1514131211109876543210
Res.EWUP 7EWUP 6EWUP 5EWUP 4Res.EWUP 2EWUP 1ResResResResResResSBFWUF
rwrwrwrwrwrwrr

Bits 31:15 Reserved, must be kept at reset value.

Bits 14:11 EWUPx : Enable WKUPx pin (available only on STM32F070xB and STM32F030xC devices)

These bits are set and cleared by software.

0: WKUPx pin is used for general purpose I/O. An event on the WKUPx pin does not wake-up the device from Standby mode.

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

Note: These bits are reset by a system Reset.

Bit 10 Reserved, must be kept at reset value.

Bits 9:8 EWUPx : Enable WKUPx pin

These bits are set and cleared by software.

0: WKUPx pin is used for general purpose I/O. An event on the WKUPx pin does not wake-up the device from Standby mode.

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

Note: These bits are reset by a system Reset.

Bits 7:2 Reserved, must be kept at reset value.

Bit 1 SBF : Standby flag

This bit is set by hardware when the device enters Standby mode and it is cleared only by a POR/PDR (power on reset/power down reset) or by setting the CSBF bit in the Power control register (PWR_CR)

0: Device has not been in Standby mode

1: Device has been in Standby mode

Bit 0 WUF : Wake-up flag

This bit is set by hardware to indicate that the device received a wake-up event. It is cleared by a system reset or by setting the CWUF bit in the Power control register (PWR_CR)

0: No wake-up event occurred

1: A wake-up event was received from one of the enabled WKUPx pins or from the RTC alarm.

Note: An additional wake-up event is detected if one WKUPx pin is enabled (by setting the EWUPx bit) when its pin level is already high.

6.4.3 PWR register map

The following table summarizes the PWR register map and reset values.

Table 20. PWR register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
0x000PWR_CRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CSBFCWUFPDDSLPDS
Reset value0000
0x004PWR_CSRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.EWUP7 (1)EWUP6 (1)EWUP5 (1)EWUP4 (1)Res.EWUP2EWUP1Res.Res.Res.Res.Res.Res.Res.SBFWUF
Reset value00000000

1. Available on STM32F070xB and STM32F030xC devices only.

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