AN4365
Application note
Using STM32F4 MCU power modes with best dynamic efficiency
Introduction
Power consumption presents a major challenge for recent embedded applications.
This application note is split into two main parts:
•
•
The first part describes how to best configure the STM32F4 power modes and
measure the corresponding current consumptions specified in the datasheet.
The second part describes a use case that highlights the power efficiency of STM32F4
for the competitive applications of the embedded system market.
This application note is provided with the STSW-STM32142 firmware package that contains
two projects:
•
STM32F4_Current_Consumption_Measuring:
gives a measuring application that can
be customized to measure the current consumption of different STM32F4 power
modes, and shows how to best configure the system for each mode.
STM32F4_Low_Power_Application_Case:
this is an example of an application based
on the ADC, I2C and DMA peripherals using STM32F4 low-power modes and features.
•
For more details about these examples, please refer to the “readme” files inside this
firmware package.
Table 1. Applicable products and tools
Type
Part numbers
Microcontrollers
STM32F401 line
STM32F405/415 line
STM32F407/417 line
STM32F427/437 line
STM32F429/439 line
STSW-STM32142
Firmware
May 2014
DocID025303 Rev 2
1/35
www.st.com
Contents
AN4365
Contents
1
STM32F4 power consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1
Power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.1
1.1.2
Low-power mode overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Power mode power consumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
System clock configuration and management . . . . . . . . . . . . . . . . . . . . . 9
Dynamic voltage and frequency scaling . . . . . . . . . . . . . . . . . . . . . . . . . 9
Voltage regulator bypass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Voltage regulator power tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
ART configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
I/O configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Using direct memory access (DMA) . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Power mode switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Code optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2
Power-saving methods and features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.1
1.2.2
1.2.3
1.2.4
1.2.5
1.2.6
1.2.7
1.2.8
1.2.9
2
STM32F4 current consumption measuring . . . . . . . . . . . . . . . . . . . . . 12
2.1
Current consumption measuring firmware . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.1
2.1.2
2.1.3
Current consumption application description . . . . . . . . . . . . . . . . . . . . . 12
Firmware architecture description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
How to use the current consumption firmware . . . . . . . . . . . . . . . . . . . 19
Hardware/software environment description . . . . . . . . . . . . . . . . . . . . . 20
Consumption measuring best practices . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.2
Current consumption measuring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.1
2.2.2
3
STM32F4 low-power application case . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1
Application overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1.1
3.1.2
Application functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Firmware architecture description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Software requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Hardware requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Measuring current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Current consumption results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
DocID025303 Rev 2
3.2
How to use the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2.1
3.2.2
3.3
Current consumption measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.3.1
3.3.2
2/35
AN4365
Contents
4
5
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
DocID025303 Rev 2
3/35
3
List of tables
AN4365
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Applicable products and tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Used pins description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Average measurement results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4/35
DocID025303 Rev 2
AN4365
List of figures
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Figure 13.
Figure 14.
Figure 15.
Figure 16.
Figure 17.
Figure 18.
Figure 19.
Power mode switch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Current consumption of STM32F4 MCU power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Main power mode switching menu firmware flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Run mode flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Sleep mode flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Stop mode flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Standby mode flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Current consumption measuring project overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Jumper for Idd consumption measuring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Hardware/software environment setting for V
DD
=1.8 V . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
STM32F4 sensor hub example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Application modules and data flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Application state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Firmware architecture overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
MDK-ARM application workspaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Hardware connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Application waveform overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Calculating Master average current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Calculating sensor average current consumption. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
DocID025303 Rev 2
5/35
5