4. Power control (PWR)

Low-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 16 and 32 Kbytes.

Medium-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 64 and 128 Kbytes.

High-density value line devices are STM32F100xx microcontrollers where the flash memory density ranges between 256 and 512 Kbytes.

This section applies to the whole STM32F100xx family, unless otherwise specified.

4.1 Power supplies

The device requires a 2.0 to 3.6 V operating voltage supply ( \( V_{DD} \) ). An embedded regulator is used to supply the internal 1.8 V digital power.

The real-time clock (RTC) and backup registers can be powered from the \( V_{BAT} \) voltage when the main \( V_{DD} \) supply is powered off.

Figure 4. Power supply overview

Figure 4. Power supply overview diagram showing the internal power domains and connections for the STM32F100xx microcontroller. The diagram illustrates the VDDA domain (connected to VREF+ and VREF-), the VDD domain (connected to VDD and VSS), the 1.8 V domain (connected to the Voltage Regulator), and the Backup domain (connected to VBAT).

The diagram shows the internal power architecture of the microcontroller. On the left, external pins are labeled: \( (V_{SSA}) V_{REF-} \) , \( V_{REF+} \) (from 2.4 V up to \( V_{DDA} \) ), \( (V_{DD}) V_{DDA} \) , \( (V_{SS}) V_{SSA} \) , \( V_{SS} \) , \( V_{DD} \) , and \( V_{BAT} \) . The \( V_{DDA} \) domain contains an A/D converter, D/A converter, Temp. sensor, Reset block, and PLL. The \( V_{DD} \) domain contains an I/O Ring, Standby circuitry (Wakeup logic, IWDG), and a Voltage Regulator. The 1.8 V domain contains Core Memories and digital peripherals, which are connected to the Voltage Regulator. The Backup domain contains an LSE crystal 32K osc, BKP registers, RCC BDCR register, and RTC, which is connected to \( V_{BAT} \) via a switch. A Low voltage detector is also shown, connected to the \( V_{DD} \) line.

Figure 4. Power supply overview diagram showing the internal power domains and connections for the STM32F100xx microcontroller. The diagram illustrates the VDDA domain (connected to VREF+ and VREF-), the VDD domain (connected to VDD and VSS), the 1.8 V domain (connected to the Voltage Regulator), and the Backup domain (connected to VBAT).
  1. 1. \( V_{DDA} \) and \( V_{SSA} \) must be connected to \( V_{DD} \) and \( V_{SS} \) , respectively.

4.1.1 Independent A/D and D/A converter supply and reference voltage

To improve conversion accuracy, the ADC and the DAC have an independent power supply that can be separately filtered and shielded from noise on the PCB.

When available (according to package), \( V_{REF-} \) must be tied to \( V_{SSA} \) .

On 100-pin packages

To ensure a better accuracy on low-voltage inputs and outputs, the user can connect a separate external reference voltage on \( V_{REF+} \) . \( V_{REF+} \) is the highest voltage, represented by the full scale value, for an analog input (ADC) or output (DAC) signal. The voltage on \( V_{REF+} \) can range from 2.4 V to \( V_{DDA} \) .

On 64-pin packages and packages with less pins

The \( V_{REF+} \) and \( V_{REF-} \) pins are not available, they are internally connected to the ADC voltage supply ( \( V_{DDA} \) ) and ground ( \( V_{SSA} \) ).

4.1.2 Battery backup domain

To retain the content of the Backup registers and supply the RTC function 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.

The \( V_{BAT} \) pin powers the RTC unit, the LSE oscillator and the PC13 to PC15 IOs, allowing the RTC to operate even when the main digital supply ( \( V_{DD} \) ) is turned off. 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} \) externally to \( V_{DD} \) with a 100 nF external ceramic decoupling capacitor (for more details refer to AN2586).

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

Note: Because the switch only sinks a limited amount of current (3 mA), the use of GPIOs PC13 to PC15 in output mode is restricted: the speed has to be limited to 2 MHz with a maximum load of 30 pF and these IOs must not be used as a current source (e.g. to drive a 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:

4.1.3 Voltage regulator

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

4.2 Power supply supervisor

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

The device has an integrated POR/PDR circuitry that allows proper operation starting from/down to 2 V.

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 5. Power on reset/power down reset waveform

Figure 5: Power on reset/power down reset waveform. The diagram shows the relationship between the VDD/VDDA power supply voltage and the Reset signal during power-up and power-down. The top graph plots VDD/VDDA against time. It shows a rising edge where the voltage crosses the VPOR/PDR rising edge threshold, and a falling edge where it crosses the VPOR/PDR falling edge threshold. The difference between these two thresholds is labeled '40 mV hysteresis'. The time interval between the rising and falling edges is labeled 'Temporization tRSTTEMPO'. The bottom graph shows the Reset signal, which is a step function that goes high when the voltage rises above the VPOR/PDR rising edge threshold and goes low when the voltage falls below the VPOR/PDR falling edge threshold. The diagram is labeled MS30431V2 in the bottom right corner.

The diagram illustrates the power on reset/power down reset waveform. The top graph shows the VDD/VDDA power supply voltage over time. The rising edge of the voltage crosses the VPOR/PDR rising edge threshold, and the falling edge crosses the VPOR/PDR falling edge threshold. The difference between these two thresholds is labeled '40 mV hysteresis'. The time interval between the rising and falling edges is labeled 'Temporization tRSTTEMPO'. The bottom graph shows the Reset signal, which is a step function that goes high when the voltage rises above the VPOR/PDR rising edge threshold and goes low when the voltage falls below the VPOR/PDR falling edge threshold. The diagram is labeled MS30431V2 in the bottom right corner.

Figure 5: Power on reset/power down reset waveform. The diagram shows the relationship between the VDD/VDDA power supply voltage and the Reset signal during power-up and power-down. The top graph plots VDD/VDDA against time. It shows a rising edge where the voltage crosses the VPOR/PDR rising edge threshold, and a falling edge where it crosses the VPOR/PDR falling edge threshold. The difference between these two thresholds is labeled '40 mV hysteresis'. The time interval between the rising and falling edges is labeled 'Temporization tRSTTEMPO'. The bottom graph shows the Reset signal, which is a step function that goes high when the voltage rises above the VPOR/PDR rising edge threshold and goes low when the voltage falls below the VPOR/PDR falling edge threshold. The diagram is labeled MS30431V2 in the bottom right corner.

4.2.2 Programmable voltage detector (PVD)

The PVD can be used to monitor the \( V_{DD}/V_{DDA} \) power supply by comparing it to a threshold selected by the PLS[2:0] bits in the Power control register (PWR_CR) .

The PVD is enabled by setting the PVDE bit.

A PVDO flag is available, in the Power control/status register (PWR_CSR) , to indicate if \( V_{DD}/V_{DDA} \) is higher or lower than the PVD threshold. This event is internally connected to the EXTI line16 and can generate an interrupt if enabled through the EXTI registers. The PVD output interrupt can be generated when \( V_{DD}/V_{DDA} \) drops below the PVD threshold and/or when \( V_{DD}/V_{DDA} \) rises above the PVD threshold depending on EXTI line16 rising/falling edge configuration. As an example the service routine could perform emergency shutdown tasks.

Figure 6. PVD thresholds

Timing diagram showing VDD and PVD output over time. The VDD signal rises to a plateau and then falls. The PVD output is shown as a pulse that goes low when VDD falls below the falling edge threshold and returns high when VDD rises above the rising edge threshold. The diagram indicates VPVD rising edge, VPVD falling edge, PVD threshold, and 100 mV hysteresis.

The figure illustrates the relationship between the supply voltage (VDD) and the Power Voltage Detector (PVD) output. The top graph shows VDD rising from 0V to a maximum level, staying constant for some time, and then falling. The PVD output, shown below, is initially high. When VDD falls, the PVD output goes low at the 'VPVD falling edge' threshold. When VDD rises again, the PVD output returns to high at the 'VPVD rising edge' threshold. The 'PVD threshold' is indicated between these two edges. A '100 mV hysteresis' is shown as the voltage difference between the rising and falling edges. The diagram is labeled with 'VDD', 'VPVD rising edge', 'VPVD falling edge', 'PVD threshold', '100 mV hysteresis', 'PVD output', and 'MS30432V3'.

Timing diagram showing VDD and PVD output over time. The VDD signal rises to a plateau and then falls. The PVD output is shown as a pulse that goes low when VDD falls below the falling edge threshold and returns high when VDD rises above the rising edge threshold. The diagram indicates VPVD rising edge, VPVD falling edge, PVD threshold, and 100 mV hysteresis.

4.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 wakeup sources.

The STM32F100xx devices feature three low-power modes:

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

Table 8. Low-power mode summary

Mode nameEntryWakeupEffect on 1.8V 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
WFEWakeup event
StopPDDS and LPDS
bits + SLEEPDEEP
bit + WFI or WFE
Any EXTI line
(configured in the
EXTI registers)
All 1.8V domain
clocks OFF
HSI and HSE
oscillators OFF
ON or in
low-power mode
(depends on Power
control register
(PWR_CR)
)
PDDS bit +
SLEEPDEEP bit +
WFI or WFE
WKUP pin rising
edge, RTC alarm,
external reset in
NRST pin,
IWDG reset
OFF

4.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.2: Clock configuration register (RCC_CFGR) .

4.3.2 Peripheral clock gating

In Run mode, the HCLK 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 , APB1 peripheral clock enable register (RCC_APB1ENR) and APB2 peripheral clock enable register (RCC_APB2ENR) .

4.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 Cortex®-M3 System Control register:

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

Refer to Table 9 and Table 10 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 wakeup event can be generated either by:

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

Refer to Table 9 and Table 10 for more details on how to exit Sleep mode.

Table 9. Sleep-now

Sleep-now modeDescription
Mode entryWFI (Wait for Interrupt) or WFE (Wait for Event) while:
– SLEEPDEEP = 0 and
– SLEEPONEXIT = 0
Refer to the Cortex®-M3 System Control register.
Mode exitIf WFI was used for entry:
Interrupt: Refer to Table 50: Vector table for STM32F100xx devices
If WFE was used for entry
Wakeup event: Refer to Section 8.2.3: Wakeup event management
Wakeup latencyNone

Table 10. Sleep-on-exit

Sleep-on-exitDescription
Mode entryWFI (wait for interrupt) while:
– SLEEPDEEP = 0 and
– SLEEPONEXIT = 1
Refer to the Cortex®-M3 System Control register.
Mode exitInterrupt: refer to Table 50: Vector table for STM32F100xx devices .
Wakeup latencyNone

4.3.4 Stop mode

The Stop mode is based on the Cortex®-M3 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.8 V domain are stopped, the PLL, the HSI and the HSE RC 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 11 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 or DAC can also consume power during the Stop mode, unless they are disabled before entering it. To disable them, the ADON bit in the ADC_CR2 register and the ENx bit in the DAC_CR register must both 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 remains enabled and the external clock (external oscillator) is removed when 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

Refer to Table 11 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 11. Stop mode

Stop modeDescription
Mode entry

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

  • – Set SLEEPDEEP bit in Cortex®-M3 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 peripheral interrupt pending bits, and RTC Alarm flag must be reset. Otherwise, the Stop mode entry procedure is ignored and program execution continues.

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 50: Vector table for STM32F100xx devices .

If WFE was used for entry:

Any EXTI Line configured in event mode. Refer to Section 8.2.3: Wakeup event management

Wakeup latencyHSI RC wakeup time + regulator wakeup time from Low-power mode

4.3.5 Standby mode

The Standby mode allows to achieve the lowest power consumption. It is based on the Cortex ® -M3 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 Backup domain and Standby circuitry (see Figure 4 ).

Entering Standby mode

Refer to Table 12 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 the WKUP pin or the rising edge of an RTC alarm occurs (see Figure 196: RTC simplified block diagram ). All registers are reset after wakeup 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 pins sampling, vector reset 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 12 for more details on how to exit Standby mode.

Table 12. Standby mode

Standby modeDescription
Mode entryWFI (Wait for Interrupt) or WFE (Wait for Event) while:
  • – Set SLEEPDEEP in Cortex ® -M3 System Control register
  • – Set PDDS bit in Power Control register (PWR_CR)
  • – Clear WUF bit in Power Control/Status register (PWR_CSR)
  • – No interrupt (for WFI) or event (for WFI) is pending
Mode exitWKUP pin rising edge, RTC alarm event's rising edge, 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:

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

4.3.6 Auto-wakeup (AWU) from low-power mode

The RTC can be used to wakeup the MCU from low-power mode without depending on an external interrupt (Auto-wakeup mode). The RTC provides a programmable time base for waking up from Stop or Standby mode at regular intervals. For this purpose, two of the three alternative RTC clock sources can be selected by programming the RTCSEL[1:0] bits in the Backup domain control register (RCC_BDCR) :

To wakeup from Stop mode with an RTC alarm event, it is necessary to:

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

4.4 Power control registers

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

4.4.1 Power control register (PWR_CR)

Address offset: 0x00

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

31302928272625242322212019181716
Reserved
1514131211109876543210
ReservedDBPPLS[2:0]PVDECSBFCWUFPDDSLPDS
rwrwrwrwrc_w1rc_w1rwrw

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

Bit 8 DBP : Disable backup domain write protection.

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

0: Access to RTC and Backup registers disabled

1: Access to RTC and Backup registers enabled

Note: If the HSE divided by 128 is used as the RTC clock, this bit must remain set to 1.

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.2V

001: 2.3V

010: 2.4V

011: 2.5V

100: 2.6V

101: 2.7V

110: 2.8V

111: 2.9V

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 . (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 Deep sleep. The regulator status depends on the LPDS bit.

1: Enter Standby mode when the CPU enters Deep sleep.

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

4.4.2 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
Reserved
1514131211109876543210
ReservedEWUPReservedPVDOSBFWUF
rwrrr

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

Bit 8 EWUP : Enable WKUP pin

Note: This bit is reset by a system Reset.

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

Bit 2 PVDO : PVD output

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

Bit 0 WUF : Wakeup flag

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.

4.4.3 PWR register map

The following table summarizes the PWR registers.

Table 13. PWR register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
0x000PWR_CRReservedDBPPLS [2:0]PVDECSBFCWUFPDDSLPDS
Reset value000000000
0x004PWR_CSRReservedEWUPReservedPVDOSBFWUF
Reset value0000

Refer to Table 1 on page 37 and Table 2 on page 38 for the register boundary addresses.