In this use case, the BPM module can switch the power scaling modes of the system.
Check the current of the system to see consumptions.
Setup
Prerequisites
Some power scaling modes only work on limited system clock frequency (The maximum CPU frequency under PS1 is 12MHz, other peripherals also have speed limitations), please refer to the electrical characteristics for more details.
- Clock management
Code
Content of conf_clock.h
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RCFAST // Uses Fast RC
#define CONFIG_RCFAST_FRANGE 2 // Fast RC is 12MHz
Workflow
- Ensure that conf_clock.h is available and contains the following parameters which configure system clock to 12MHz fast RC:
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RCFAST // Uses Fast RC
#define CONFIG_RCFAST_FRANGE 2 // Fast RC is 12MHz
- Initialize system clock with
sysclk_init()
.
Use case
Example code
Add to application C-file:
Workflow
- Switch the power scaling mode:
- Wait power scaling done: