MCUXpresso SDK API Reference Manual  Rev 2.12.1
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Framework: Power Manager Framework

This section includes Power Mode macros, System Constraints macros, and Wakeup source macros. More...

Overview

This document consists of sections titled with Framework Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Framework Overview first for it includes a comprehensive description of the framework. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.

Macros

#define AT_ALWAYS_ON_DATA(var)   var
 

Framework Overview

The power manager framework manages the transition of both active-to-sleep and sleep-to-active states of the MCU. More...
 

Power Mode Definition

#define PM_LP_STATE_SLEEP   (0U)
 
#define PM_LP_STATE_DEEP_SLEEP   (1U)
 
#define PM_LP_STATE_POWER_DOWN   (2U)
 
#define PM_LP_STATE_DEEP_POWER_DOWN   (3U)
 
#define PM_LP_STATE_NO_CONSTRAINT   (0xFFU)
 

System basic resource constraints definitions.

#define PM_RESC_CORE_CLK_ON   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 13U)
 Set the constraint that CORE clock should be ON.
 
#define PM_RESC_BUS_SYS_CLK_ON   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 12U)
 Set the constraint that BUS and SYSTEM clock should be ON.
 
#define PM_RESC_CTCM0_ACTIVE   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 0U)
 Set the constraint that CTCM0 should in Active mode.
 
#define PM_RESC_CTCM0_DEEPSLEEP   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON1, 0U)
 Set the constraint that CTCM0 should in DEEPSLEEP mode.
 
#define PM_RESC_CTCM1_ACTIVE   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 1U)
 Set the constraint that CTCM1 should in Active mode.
 
#define PM_RESC_CTCM1_DEEPSLEEP   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON1, 1U)
 Set the constraint that CTCM1 should in DEEPSLEEP mode.
 
#define PM_RESC_STCM0_ACTIVE   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 2U)
 Set the constraint that STCM0 should in Active mode.
 
#define PM_RESC_STCM0_DEEPSLEEP   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON1, 2U)
 Set the constraint that STCM0 should in DEEPSLEEP mode.
 
#define PM_RESC_STCM1_ACTIVE   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 3U)
 Set the constraint that STCM1 should in Active mode.
 
#define PM_RESC_STCM1_DEEPSLEEP   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON1, 3U)
 Set the constraint that STCM1 should in DEEPSLEEP mode.
 
#define PM_RESC_STCM2_ACTIVE   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 4U)
 Set the constraint that STCM2 should in Active mode.
 
#define PM_RESC_STCM2_DEEPSLEEP   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON1, 4U)
 Set the constraint that STCM2 should in DEEPSLEEP mode.
 
#define PM_RESC_STCM3_ACTIVE   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 5U)
 Set the constraint that STCM3 should in Active mode.
 
#define PM_RESC_STCM3_DEEPSLEEP   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON1, 5U)
 Set the constraint that STCM3 should in DEEPSLEEP mode.
 
#define PM_RESC_STCM4_ACTIVE   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 6U)
 Set the constraint that STCM4 should in Active mode.
 
#define PM_RESC_STCM4_DEEPSLEEP   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON1, 6U)
 Set the constraint that STCM4 should in DEEPSLEEP mode.
 
#define PM_RESC_FRO_192M_ON   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 7U)
 Set the constraint that FRO_192M should be ON.
 
#define PM_RESC_FRO_6M_ON   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 8U)
 Set the constraint that FRO_6M should be ON.
 
#define PM_RESC_MAIN_PD_PERI_OPERATIONAL   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 11U)
 Set the constraint that peripherals in CORE_MAIN power domain still be operational.
 
#define PM_RESC_MAIN_PD_PERI_STATE_RETENTION   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 10U)
 Set the constraint that peripherals in CORE_MAIN power domain are state retention, that means CORE_MAIN power domain can not be powered off.
 
#define PM_RESC_WAKE_PD_PERI_ACTIVE   PM_ENCODE_RESC(PM_RESOURCE_FULL_ON, 9U)
 Set the constraint that peripherals in CORE_WAKE power domain are active.
 
#define PM_RESC_WAKE_PD_PERI_OPERATIONAL   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON2, 9U)
 Set the constraint that peripherals in CORE_WAKE power domain are operational.
 
#define PM_RESC_WAKE_PD_PERI_STATE_RETENTION   PM_ENCODE_RESC(PM_RESOURCE_PARTABLE_ON1, 9U)
 Set the constraint that peripherals in CORE_WAKE power domain are state retention, that means CORE_WAKE power domain can not be powered off.
 

System Wakeup source definitions.

#define PM_WSID_PTA0_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 0UL, PORTA_IRQn, 1UL)
 Enable PTA0 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTA0_Falling_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 0UL, PORTA_IRQn, 2UL)
 Enable PTA0 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTA0_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 0UL, PORTA_IRQn, 3UL)
 Enable PTA0 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTA2_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 1UL, PORTA_IRQn, 1UL)
 Enable PTA2 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTA2_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 1UL, PORTA_IRQn, 2UL)
 Enable PTA2 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTA2_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 1UL, PORTA_IRQn, 3UL)
 Enable PTA2 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTA4_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 2UL, PORTA_IRQn, 1UL)
 Enable PTA4 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTA4_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 2UL, PORTA_IRQn, 2UL)
 Enable PTA4 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTA4_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 2UL, PORTA_IRQn, 3UL)
 Enable PTA4 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTA17_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 3UL, PORTA_IRQn, 1UL)
 Enable PTA17 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTA17_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 3UL, PORTA_IRQn, 2UL)
 Enable PTA17 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTA17_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 3UL, PORTA_IRQn, 3UL)
 Enable PTA17 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTA19_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 4UL, PORTA_IRQn, 1UL)
 Enable PTA19 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTA19_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 4UL, PORTA_IRQn, 2UL)
 Enable PTA19 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTA19_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 4UL, PORTA_IRQn, 3UL)
 Enable PTA19 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTA21_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 5UL, PORTA_IRQn, 1UL)
 Enable PTA21 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTA21_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 5UL, PORTA_IRQn, 2UL)
 Enable PTA21 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTA21_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 5UL, PORTA_IRQn, 3UL)
 Enable PTA21 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTA22_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 6UL, PORTA_IRQn, 1UL)
 Enable PTA22 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTA22_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 6UL, PORTA_IRQn, 2UL)
 Enable PTA22 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTA22_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 6UL, PORTA_IRQn, 3UL)
 Enable PTA22 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTC0_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 7UL, PORTC_IRQn, 1UL)
 Enable PTC0 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTC0_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 7UL, PORTC_IRQn, 2UL)
 Enable PTC0 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTC0_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 7UL, PORTC_IRQn, 3UL)
 Enable PTC0 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTC1_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 8UL, PORTC_IRQn, 1UL)
 Enable PTC1 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTC1_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 8UL, PORTC_IRQn, 2UL)
 Enable PTC1 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTC1_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 8UL, PORTC_IRQn, 3UL)
 Enable PTC1 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTC2_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 9UL, PORTC_IRQn, 1UL)
 Enable PTC2 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTC2_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 9UL, PORTC_IRQn, 2UL)
 Enable PTC2 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTC2_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 9UL, PORTC_IRQn, 3UL)
 Enable PTC2 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTC4_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 10UL, PORTC_IRQn, 1UL)
 Enable PTC4 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTC4_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 10UL, PORTC_IRQn, 2UL)
 Enable PTC4 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTC4_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 10UL, PORTC_IRQn, 3UL)
 Enable PTC4 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTC6_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 11UL, PORTC_IRQn, 1UL)
 Enable PTC6 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTC6_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 11UL, PORTC_IRQn, 2UL)
 Enable PTC6 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTC6_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 11UL, PORTC_IRQn, 3UL)
 Enable PTC6 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTC7_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 12UL, PORTC_IRQn, 1UL)
 Enable PTC7 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTC7_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 12UL, PORTC_IRQn, 2UL)
 Enable PTC7 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTC7_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 12UL, PORTC_IRQns, 3UL)
 Enable PTC7 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTB0_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 13UL, PORTB_IRQn, 1UL)
 Enable PTB0 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTB0_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 13UL, PORTB_IRQn, 2UL)
 Enable PTB0 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTB0_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 13UL, PORTB_IRQn, 3UL)
 Enable PTB0 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTB3_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 14UL, PORTB_IRQn, 1UL)
 Enable PTB3 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTB3_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 14UL, PORTB_IRQn, 2UL)
 Enable PTB3 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTB3_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 14UL, PORTB_IRQn, 3UL)
 Enable PTB3 as a wakeup pin, detect on any edge.
 
#define PM_WSID_PTB4_RISING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 15UL, PORTB_IRQn, 1UL)
 Enable PTB4 as a wakeup pin, detect on rising edge.
 
#define PM_WSID_PTB4_FALLING_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 15UL, PORTB_IRQn, 2UL)
 Enable PTB4 as a wakeup pin, detect on falling edge.
 
#define PM_WSID_PTB4_ANY_EDGE   PM_ENCODE_WAKEUP_SOURCE_ID(0UL, 15UL, PORTB_IRQn, 3UL)
 Enable PTB4 as a wakeup pin, detect on any edge.
 
#define PM_WSID_LPTMR0   PM_ENCODE_WAKEUP_SOURCE_ID(1UL, 0UL, LPTMR0_IRQn, 0UL)
 Enable LPTMR0 as a wakeup source.
 
#define PM_WSID_LPTMR1   PM_ENCODE_WAKEUP_SOURCE_ID(1UL, 0UL, LPTMR1_IRQn, 0UL)
 Enable LPTMR1 as a wakeup source.
 
#define PM_WSID_GPIOD_LOW   PM_ENCODE_WAKEUP_SOURCE_ID(1UL, 1UL, GPIOD_INT0_IRQn, 0UL)
 Enable GPIOD Low pins as wakeup source.
 
#define PM_WSID_GPIOD_HIGH   PM_ENCODE_WAKEUP_SOURCE_ID(1UL, 2UL, GPIOD_INT1_IRQn, 0UL)
 Enable GPIOD High pins as wakeup source.
 
#define PM_WSID_WFSPSD   PM_ENCODE_WAKEUP_SOURCE_ID(1UL, 4UL, VBAT_IRQn, 0UL)
 Enable VBAT module as wakeup source.
 
#define PM_WSID_RTC_ALARM   PM_ENCODE_WAKEUP_SOURCE_ID(1UL, 6UL, RTC_Alarm_IRQn, 0UL)
 Enable RTC Alarm as wakeup source.
 
#define PM_WSID_RTC_SECOND   PM_ENCODE_WAKEUP_SOURCE_ID(1UL, 7UL, RTC_Second_IRQn, 0UL)
 Enable RTC Second as wakeup source.
 

Macro Definition Documentation

#define AT_ALWAYS_ON_DATA (   var)    var

It provides the upper layer software the ability to set and release constraints of the hardware basic resources(such as clock, power, ram, etc.) and the ability to register callback functions to be invoked before entering/after exiting the sleep mode. In addition, the upper layer software can register the wakeup source service function to be executed if related wakeup source occurs.

         +-----------------------------------------------------------------+
         |                       Application Software                      |
         +-----------------------------------------------------------------+
         +-----------------------------------------------------------------+
         |                       Stacks and Components                     |
         +-----------------------------------------------------------------+
         +-----------------------------------------------------------------+
         |                       Power Manager Framework                   |
         +-----------------------------------------------------------------+
         +---------------+    +---------------+    +-----------------------+
         | Power Drivers |    | Clock Drivers |    | Wakeup Source Drivers |
         +---------------+    +---------------+    +-----------------------+

As shown above, the power manager framework safely manages the transitions to and from power saving states by using MCUXpresso SDK drivers, and the upper layer software only need to use the APIs of power manager framework. Different MCUs have the same top-level APIs, concepts and conventions.

Definitions and Terms:

  • Constraint A system-level declaration that asks the power manager to prevent a specific action. For example, if the application sets the constraint as that the ARM PLL should not be turned off, then the power manager framework will compute the deepest power state with the ARM PLL being turned on. Otherwise, a decision might be made to transit to a sleep state with ARM PLL being turned off.
  • Notification A callback mechanism that allows the upper layer software to be notified of specific power transitions. Some hardware peripherals may need several steps to enter into or exit the low power mode, so multiple callbacks are necessary to avoid undesired waiting loop. To address this problem, there are 3 groups of notification set in the power manager framework. The power manager will execute registered notification callback functions from group0 to group2 before entering into low power mode while from group2 to group0 after exiting from low power mode.
  • Wakeup Source Structure that contains the wakeup source Id and its service functions. The upper layer software can create the wakeup source object by invoking PM_RegisterWakeupSource() function. The parameter wsId is the MCU wakeup source definition available. If the MCU exits from the low power mode based on the registered wakeup source, the function PM_TriggerWakeSourceService() should be invoked to execute wakeup source service function.

Power Manager Framework Architecture:

The power manager framework consists of four modules: policy module, sequencer module, wakeup source manager module, and notification module.

  • The policy module can gather all the constraints from the whole system and then compute the deepest allowed power state.
  • The sequencer module is in charge of the power mode entry and exit sequences.
  • The wakeup source manager module is in charge of configuring wakeup sources in low power entry and processing registered wakeup source handler callback.
  • The notification module is in charge of notifying the upper layer software of speciic power transitions and events.

To make the power manager framework adapts to different MCU families, the power manager framework adopts a layer-designed idea, extracting common parts as the pm_core level, and separating device-related parts as the pm_device level. In details, the pm_core level contains policy module, wakeup source manager module, and notification module. The pm_device level contains sequencer module.