Power profiles API set_power

This routine configures the device’s internal power control settings according to the calling arguments. The goal is to reduce active power consumption while maintaining the feature of interest to the application close to its optimum.

Note: Use the set_power routine with SYSAHBCLKDIV = 1 (System clock divider register, see SYSCON registerName = SYSAHBCLKDIV addressOffset = 0x078 and c-Generaldescription.html#BABJIGIB__CJADFGIG).

set_power returns a result code that reports whether the power setting was successfully changed or not.



Power profiles usage

Table 1. Power profiles API set_power routine
Routine set_power
Input

Param0: main clock (in MHz)

Param1: mode (PWR_DEFAULT, PWR_CPU_PERFORMANCE, PWR_ EFFICIENCY, PWR_LOW_CURRENT)

Param2: system clock (in MHz)

Result

Result0: PWR_CMD_SUCCESS | PWR_INVALID_FREQ | PWR_INVALID_MODE

The following definitions are needed for set_power routine calls:

/* set_power mode options */-->
#define		PWR_DEFAULT				0-->
#define		PWR_CPU_PERFORMANCE				1-->
#define		PWR_EFFICIENCY				2-->
#define		PWR_LOW_CURRENT				3-->
/* set_power result0 options */-->
#define		PWR_CMD_SUCCESS				0-->
#define		PWR_INVALID_FREQ				1-->
#define		PWR_INVALID_MODE				2-->

For a simplified clock configuration scheme see c-Generaldescription.html#BABJIGIB__CJADFGIG

Power profiles API Param0: main clock

The main clock is the clock rate the microcontroller uses to source the system’s and the peripherals’ clock. It is configured by either a successful execution of the clocking routine call or a similar code provided by the user. This operand must be an integer between 1 to 30 MHz inclusive. If a value out of this range is supplied, set_power returns PWR_INVALID_FREQ and does not change the power control system.

Power profiles API Param1: mode

The input parameter mode (Param1) specifies one of four available power settings. If an illegal selection is provided, set_power returns PWR_INVALID_MODE and does not change the power control system.

PWR_DEFAULT keeps the device in a baseline power setting similar to its reset state.

PWR_CPU_PERFORMANCE configures the microcontroller so that it can provide more processing capability to the application. CPU performance is 30% better than the default option.

PWR_EFFICIENCY setting was designed to find a balance between active current and the CPU’s ability to execute code and process data. In this mode the device outperforms the default mode both in terms of providing higher CPU performance and lowering active current.

PWR_LOW_CURRENT is intended for those solutions that focus on lowering power consumption rather than CPU performance.

Power profiles API Param2: system clock

The system clock is the clock rate at which the microcontroller core is running when set_power is called. This parameter is an integer between from 1 and 30 MHz inclusive.


-->