MCUXpresso SDK API Reference Manual  Rev 2.16.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Power Driver

Overview

Power driver provides APIs to control peripherals power and control the system power mode.

Data Structures

struct  _power_pad_vrange
 pad voltage range configuration. More...
 

Macros

#define PMIC_VDDCORE_RECOVERY_TIME_IGNORE   (0xFFFFFFFFU)
 PMIC is used but vddcore supply is always above LVD threshold. More...
 
#define SYSCTL0_TUPLE_REG(reg)   (*((volatile uint32_t *)(((uint32_t)(SYSCTL0)) + (((uint32_t)(reg)) & 0xFFFU))))
 PMIC mode pin configuration API parameter.
 

Typedefs

typedef enum _power_mode_config power_mode_cfg_t
 Power mode configuration API parameter.
 
typedef enum _body_bias_mode body_bias_mode_t
 Body Bias mode definition.
 
typedef enum _power_deep_sleep_clk power_deep_sleep_clk_t
 Clock source of main clock before entering deep sleep. More...
 
typedef enum _power_vddcore_src power_vddcore_src_t
 VDDCORE supply source. More...
 
typedef enum _power_pad_vrange_val power_pad_vrange_val_t
 pad voltage range value. More...
 
typedef struct _power_pad_vrange power_pad_vrange_t
 pad voltage range configuration.
 
typedef enum
_power_lvd_falling_trip_vol_val 
power_lvd_falling_trip_vol_val_t
 LVD falling trip voltage value.
 
typedef enum
_power_control_for_pmic_mode 
power_control_for_pmic_mode
 vddcore or vdd1v8 power on selection for different PMIC mode. More...
 
typedef void(* power_vddcore_set_func_t )(uint32_t millivolt)
 Callback function used to change VDDCORE when the VDDCORE is supplied by external PMIC. More...
 

Enumerations

enum  _pmc_interrupt {
  kPMC_INT_LVDCORE = PMC_CTRL_LVDCOREIE_MASK,
  kPMC_INT_HVDCORE = PMC_CTRL_HVDCOREIE_MASK,
  kPMC_INT_HVD1V8 = PMC_CTRL_HVD1V8IE_MASK,
  kPMC_INT_AUTOWK = PMC_CTRL_AUTOWKEN_MASK,
  kPMC_INT_INTRPAD
}
 PMC event flags. More...
 
enum  _pmc_event_flags {
  kPMC_FLAGS_PORCORE = PMC_FLAGS_PORCOREF_MASK,
  kPMC_FLAGS_POR1V8,
  kPMC_FLAGS_PORAO18,
  kPMC_FLAGS_LVDCORE,
  kPMC_FLAGS_HVDCORE,
  kPMC_FLAGS_HVD1V8,
  kPMC_FLAGS_RTC,
  kPMC_FLAGS_AUTOWK,
  kPMC_FLAGS_INTNPADF = PMC_FLAGS_INTNPADF_MASK,
  kPMC_FLAGS_RESETNPAD = PMC_FLAGS_RESETNPADF_MASK,
  kPMC_FLAGS_DEEPPD = PMC_FLAGS_DEEPPDF_MASK
}
 PMC event flags. More...
 
enum  _power_mode_config
 Power mode configuration API parameter.
 
enum  _body_bias_mode
 Body Bias mode definition.
 
enum  _power_deep_sleep_clk
 Clock source of main clock before entering deep sleep. More...
 
enum  _power_vddcore_src {
  kVddCoreSrc_LDO = 0U,
  kVddCoreSrc_PMIC = 1U
}
 VDDCORE supply source. More...
 
enum  _power_pad_vrange_val {
  kPadVol_171_360 = 0U,
  kPadVol_Continuous = 0U,
  kPadVol_171_198 = 1U,
  kPadVol_300_360 = 2U
}
 pad voltage range value. More...
 
enum  _power_lvd_falling_trip_vol_val {
  kLvdFallingTripVol_720 = 0U,
  kLvdFallingTripVol_735 = 1U,
  kLvdFallingTripVol_750 = 2U,
  kLvdFallingTripVol_765 = 3U,
  kLvdFallingTripVol_780 = 4U,
  kLvdFallingTripVol_795 = 5U,
  kLvdFallingTripVol_810 = 6U,
  kLvdFallingTripVol_825 = 7U,
  kLvdFallingTripVol_840 = 8U,
  kLvdFallingTripVol_855 = 9U,
  kLvdFallingTripVol_870 = 10U,
  kLvdFallingTripVol_885 = 11U,
  kLvdFallingTripVol_900 = 12U,
  kLvdFallingTripVol_915 = 13U,
  kLvdFallingTripVol_930 = 14U,
  kLvdFallingTripVol_945 = 15U
}
 LVD falling trip voltage value. More...
 
enum  _power_control_for_pmic_mode {
  kVddCoreOnMode1 = 0x2U,
  kVddCoreOnMode2 = 0x4U,
  kVddCoreOnMode3 = 0x8U,
  kVdd1v8OnMode1 = 0x20U,
  kVdd1v8OnMode2 = 0x40U,
  kVdd1v8OnMode3 = 0x80U
}
 vddcore or vdd1v8 power on selection for different PMIC mode. More...
 

Functions

void POWER_PmicPowerModeSelectControl (uint32_t vddSelect)
 API to set vddcore or vdd1v8 power on for PMIC modes which is responded to PDRUNCFG0[PMIC_MODE] or PDSLEEPCFG0[PMIC_MODE] select pin values. More...
 
void POWER_EnablePD (pd_bit_t en)
 API to enable PDRUNCFG bit in the Sysctl0. More...
 
void POWER_DisablePD (pd_bit_t en)
 API to disable PDRUNCFG bit in the Sysctl0. More...
 
static void POWER_EnableDeepSleep (void)
 API to enable deep sleep bit in the ARM Core.
 
static void POWER_DisableDeepSleep (void)
 API to disable deep sleep bit in the ARM Core.
 
void POWER_UpdateOscSettlingTime (uint32_t osc_delay)
 API to update XTAL oscillator settling time . More...
 
void POWER_UpdatePmicRecoveryTime (uint32_t pmic_delay)
 API to update on-board PMIC vddcore recovery time. More...
 
void POWER_ApplyPD (void)
 API to apply updated PMC PDRUNCFG bits in the Sysctl0.
 
void POWER_ClearEventFlags (uint32_t statusMask)
 Clears the PMC event flags state. More...
 
uint32_t POWER_GetEventFlags (void)
 Get the PMC event flags state. More...
 
void POWER_EnableInterrupts (uint32_t interruptMask)
 Enable the PMC interrupt requests. More...
 
void POWER_DisableInterrupts (uint32_t interruptMask)
 Disable the PMC interrupt requests. More...
 
void POWER_SetAnalogBuffer (bool enable)
 Set the PMC analog buffer for references or ATX2. More...
 
static uint32_t POWER_GetPmicMode (pmic_mode_reg_t reg)
 Get PMIC_MODE pins configure value. More...
 
static body_bias_mode_t POWER_GetBodyBiasMode (pmic_mode_reg_t reg)
 Get RBB/FBB bit value. More...
 
void POWER_SetPadVolRange (const power_pad_vrange_t *config)
 Configure pad voltage level. More...
 
void POWER_EnterRbb (void)
 PMC Enter Rbb mode function call.
 
void POWER_EnterFbb (void)
 PMC Enter Fbb mode function call.
 
void POWER_EnterNbb (void)
 PMC exit Rbb & Fbb mode function call.
 
bool POWER_SetLdoVoltageForFreq (uint32_t cm33_clk_freq, uint32_t dsp_clk_freq)
 Deprecated and replaced by POWER_SetVoltageForFreq()! PMC Set Ldo volatage for particular frequency. NOTE: If LVD falling trip voltage is higher than the required core voltage for particular frequency, LVD voltage will be decreased to safe level to avoid unexpected LVD reset or interrupt event. More...
 
void POWER_SetVddCoreSupplySrc (power_vddcore_src_t src)
 Set VDDCORE supply source, PMIC or on-chip regulator. More...
 
void POWER_SetPmicCoreSupplyFunc (power_vddcore_set_func_t func)
 Set the core supply setting function if PMIC is used. The function is not needed and ignored when using the onchip regulator to supply VDDCORE. More...
 
bool POWER_SetVoltageForFreq (uint32_t cm33_clk_freq, uint32_t dsp_clk_freq, uint32_t mini_volt)
 PMC Set volatage for particular frequency with given minimum value. POWER_SetVddCoreSupplySrc should be called in advance to tell power driver the supply source. If PMIC is used, the VDDCORE setting function should be set by POWER_SetPmicCoreSupplyFunc before this API is called. NOTE: If LVD falling trip voltage is higher than the required core voltage for particular frequency, LVD voltage will be decreased to safe level to avoid unexpected LVD reset or interrupt event. More...
 
void POWER_SetLvdFallingTripVoltage (power_lvd_falling_trip_vol_val_t volt)
 Set vddcore low voltage detection falling trip voltage. More...
 
power_lvd_falling_trip_vol_val_t POWER_GetLvdFallingTripVoltage (void)
 Get current vddcore low voltage detection falling trip voltage. More...
 
void POWER_DisableLVD (void)
 Disable low voltage detection, no reset or interrupt is triggered when vddcore voltage drops below threshold. NOTE: This API is for internal use only. Application should not touch it.
 
void POWER_RestoreLVD (void)
 Restore low voltage detection setting. NOTE: This API is for internal use only. Application should not touch it.
 
void POWER_SetPmicMode (uint32_t mode, pmic_mode_reg_t reg)
 Set PMIC_MODE pins configure value. More...
 
void POWER_SetDeepSleepClock (power_deep_sleep_clk_t clk)
 Set deep sleep clock source of main clock. More...
 
void POWER_EnterSleep (void)
 Configures and enters in SLEEP low power mode.
 
void POWER_EnterDeepSleep (const uint32_t exclude_from_pd[4])
 PMC Deep Sleep function call. More...
 
void POWER_EnterDeepPowerDown (const uint32_t exclude_from_pd[4])
 PMC Deep Power Down function call. More...
 
void POWER_EnterFullDeepPowerDown (const uint32_t exclude_from_pd[4])
 PMC Full Deep Power Down function call. More...
 
void POWER_EnterPowerMode (power_mode_cfg_t mode, const uint32_t exclude_from_pd[4])
 Power Library API to enter different power mode. More...
 
void EnableDeepSleepIRQ (IRQn_Type interrupt)
 Enable specific interrupt for wake-up from deep-sleep mode. More...
 
void DisableDeepSleepIRQ (IRQn_Type interrupt)
 Disable specific interrupt for wake-up from deep-sleep mode. More...
 
uint32_t POWER_GetLibVersion (void)
 Power Library API to return the library version. More...
 

Driver version

#define FSL_POWER_DRIVER_VERSION   (MAKE_VERSION(2, 6, 1))
 power driver version 2.6.1. More...
 

Data Structure Documentation

struct _power_pad_vrange

Data Fields

uint32_t Vdde0Range: 2
 VDDE0 voltage range for VDDIO_0. More...
 
uint32_t Vdde1Range: 2
 VDDE1 voltage range for VDDIO_1. More...
 
uint32_t Vdde2Range: 2
 VDDE2 voltage range for VDDIO_2. More...
 
uint32_t Vdde3Range: 2
 VDDE3 voltage range for VDDIO_3. More...
 
uint32_t Vdde4Range: 2
 VDDE4 voltage range for VDDIO_4. More...
 
uint32_t __pad0__: 22
 Reserved. More...
 

Field Documentation

uint32_t _power_pad_vrange::Vdde0Range
uint32_t _power_pad_vrange::Vdde1Range
uint32_t _power_pad_vrange::Vdde2Range
uint32_t _power_pad_vrange::Vdde3Range
uint32_t _power_pad_vrange::Vdde4Range
uint32_t _power_pad_vrange::__pad0__

Macro Definition Documentation

#define FSL_POWER_DRIVER_VERSION   (MAKE_VERSION(2, 6, 1))
#define PMIC_VDDCORE_RECOVERY_TIME_IGNORE   (0xFFFFFFFFU)

Typedef Documentation

Note, refer to Reference Manual PMC GPIO VDDIO Range Selection Control (PADVRANGE) register's description for the supported voltage by different VDDDIO.

vddcore and vdd1v8 are always on in mode0. Refer to PMC->PMICCFG.

typedef void(* power_vddcore_set_func_t)(uint32_t millivolt)

Enumeration Type Documentation

Note
These enums are meant to be OR'd together to form a bit mask.
Enumerator
kPMC_INT_LVDCORE 

Vddcore Low-Voltage Detector Interrupt Enable.

kPMC_INT_HVDCORE 

Vddcore High-Voltage Detector Interrupt Enable.

kPMC_INT_HVD1V8 

Vdd1v8 High-Voltage Detector Interrupt Enable.

kPMC_INT_AUTOWK 

PMC automatic wakeup enable and interrupt enable.

kPMC_INT_INTRPAD 

Interrupt pad deep powerdown and deep sleep wake up & interrupt enable.

Note
These enums are meant to be OR'd together to form a bit mask.
Enumerator
kPMC_FLAGS_PORCORE 

POR triggered by the vddcore POR monitor (0 = no, 1 = yes).

kPMC_FLAGS_POR1V8 

vdd1v8 power on event detected since last cleared(0 = no, 1 = yes).

kPMC_FLAGS_PORAO18 

vdd_ao18 power on event detected since last cleared (0 = no, 1 = yes).

kPMC_FLAGS_LVDCORE 

LVD tripped since last time this bit was cleared (0 = no, 1 = yes).

kPMC_FLAGS_HVDCORE 

HVD tripped since last time this bit was cleared (0 = no, 1 = yes).

kPMC_FLAGS_HVD1V8 

vdd1v8 HVD tripped since last time this bit was cleared (0 = no, 1 = yes).

kPMC_FLAGS_RTC 

RTC wakeup detected since last time flag was cleared (0 = no, 1 = yes).

kPMC_FLAGS_AUTOWK 

PMC Auto wakeup caused a deep sleep wakeup and interrupt (0 = no, 1 = yes).

kPMC_FLAGS_INTNPADF 

Pad interrupt caused a wakeup or interrupt event since the last time this flag was cleared (0 = no, 1 = yes).

kPMC_FLAGS_RESETNPAD 

Reset pad wakeup caused a wakeup or reset event since the last time this bit was cleared.

(0 = no, 1 = yes).

kPMC_FLAGS_DEEPPD 

Deep powerdown was entered since the last time this flag was cleared (0 = no, 1 = yes).

Enumerator
kVddCoreSrc_LDO 

VDDCORE is supplied by onchip regulator.

kVddCoreSrc_PMIC 

VDDCORE is supplied by external PMIC.

Note, refer to Reference Manual PMC GPIO VDDIO Range Selection Control (PADVRANGE) register's description for the supported voltage by different VDDDIO.

Enumerator
kPadVol_171_360 

Deprecated! Voltage from 1.71V to 3.60V.

kPadVol_Continuous 

Continuous mode, VDDE detector on.

kPadVol_171_198 

Voltage from 1.71V to 1.98V.

VDDE detector off.

kPadVol_300_360 

Voltage from 3.00V to 3.60V.

VDDE detector off.

Enumerator
kLvdFallingTripVol_720 

Voltage 720mV.

kLvdFallingTripVol_735 

Voltage 735mV.

kLvdFallingTripVol_750 

Voltage 750mV.

kLvdFallingTripVol_765 

Voltage 765mV.

kLvdFallingTripVol_780 

Voltage 780mV.

kLvdFallingTripVol_795 

Voltage 795mV.

kLvdFallingTripVol_810 

Voltage 810mV.

kLvdFallingTripVol_825 

Voltage 825mV.

kLvdFallingTripVol_840 

Voltage 840mV.

kLvdFallingTripVol_855 

Voltage 855mV.

kLvdFallingTripVol_870 

Voltage 870mV.

kLvdFallingTripVol_885 

Voltage 885mV.

kLvdFallingTripVol_900 

Voltage 900mV.

kLvdFallingTripVol_915 

Voltage 915mV.

kLvdFallingTripVol_930 

Voltage 930mV.

kLvdFallingTripVol_945 

Voltage 945mV.

vddcore and vdd1v8 are always on in mode0. Refer to PMC->PMICCFG.

Enumerator
kVddCoreOnMode1 

VDDCORE is powered in PMIC mode1.

kVddCoreOnMode2 

VDDCORE is powered in PMIC mode2.

kVddCoreOnMode3 

VDDCORE is powered in PMIC mode3.

kVdd1v8OnMode1 

VDD1V8 is powered in PMIC mode1.

kVdd1v8OnMode2 

VDD1V8 is powered in PMIC mode2.

kVdd1v8OnMode3 

VDD1V8 is powered in PMIC mode3.

Function Documentation

void POWER_PmicPowerModeSelectControl ( uint32_t  vddSelect)

If not set, the driver will use default configurations for different PMIC mode. The default configuration is as below. PMIC_MODE: power mode select 0b00 run mode, all supplies on. 0b01 deep sleep mode, all supplies on. 0b10 deep powerdown mode, vddcore off. 0b11 full deep powerdown mode vdd1v8 and vddcore off.

Note, be cautious to modify the VDD state in different PMIC mode. When the default configuration is changed, use exclude_from_pd[0] to configure the PMIC mode for deep sleep and power down mode.

Parameters
vddSelectthe ORd value of power_control_for_pmic_mode. Defines run (all supplies on), deep power-down (VDDCORE off), and true deep power-down (VDD1V8 and VDDCORE off).
void POWER_EnablePD ( pd_bit_t  en)

Note that enabling the bit powers down the peripheral

Parameters
enperipheral for which to enable the PDRUNCFG bit
void POWER_DisablePD ( pd_bit_t  en)

Note that disabling the bit powers up the peripheral

Parameters
enperipheral for which to disable the PDRUNCFG bit
void POWER_UpdateOscSettlingTime ( uint32_t  osc_delay)
Parameters
osc_delay: OSC stabilization time in unit of microsecond
void POWER_UpdatePmicRecoveryTime ( uint32_t  pmic_delay)

NOTE: If LDO is used instead of PMIC, don't call it. Otherwise it must be called to allow power library to well handle the deep sleep process.

Parameters
pmic_delay: PMIC stabilization time in unit of microsecond, or PMIC_VDDCORE_RECOVERY_TIME_IGNORE if not care.
void POWER_ClearEventFlags ( uint32_t  statusMask)
Parameters
statusMask: A bitmask of event flags that are to be cleared.
uint32_t POWER_GetEventFlags ( void  )
Returns
PMC FLAGS register value
void POWER_EnableInterrupts ( uint32_t  interruptMask)
Parameters
interruptMask: A bitmask of of interrupts to enable.
void POWER_DisableInterrupts ( uint32_t  interruptMask)
Parameters
interruptMask: A bitmask of of interrupts to disable.
void POWER_SetAnalogBuffer ( bool  enable)
Parameters
enable: Set to true to enable analog buffer for references or ATX2, false to disable.
static uint32_t POWER_GetPmicMode ( pmic_mode_reg_t  reg)
inlinestatic
Parameters
reg: PDSLEEPCFG0 or PDRUNCFG0 register offset
Returns
PMIC_MODE pins value in PDSLEEPCFG0
static body_bias_mode_t POWER_GetBodyBiasMode ( pmic_mode_reg_t  reg)
inlinestatic
Parameters
reg: PDSLEEPCFG0 or PDRUNCFG0 register offset
Returns
Current body bias mode
void POWER_SetPadVolRange ( const power_pad_vrange_t config)

Wide voltage range cost more power due to enabled voltage detector.

NOTE: BE CAUTIOUS TO CALL THIS API. IF THE PAD SUPPLY IS BEYOND THE SET RANGE, SILICON MIGHT BE DAMAGED.

Parameters
configpad voltage range configuration.
bool POWER_SetLdoVoltageForFreq ( uint32_t  cm33_clk_freq,
uint32_t  dsp_clk_freq 
)
Parameters
cm33_clk_freq: CM33 core frequency value
dsp_clk_freq: dsp core frequency value
Returns
true for success and false for CPU frequency out of available frequency range.
void POWER_SetVddCoreSupplySrc ( power_vddcore_src_t  src)
Parameters
src: power_vddcore_src_t, VDDCore supply source
void POWER_SetPmicCoreSupplyFunc ( power_vddcore_set_func_t  func)
Parameters
func: power_vddcore_set_func_t, the PMIC core supply voltage set function.
bool POWER_SetVoltageForFreq ( uint32_t  cm33_clk_freq,
uint32_t  dsp_clk_freq,
uint32_t  mini_volt 
)
Parameters
cm33_clk_freq: CM33 core frequency value
dsp_clk_freq: dsp core frequency value
mini_volt: minimum voltage in millivolt(mV) for VDDCORE. Should <= 1100mV, 0 means use the core frequency to calculate voltage.
Returns
true for success and false for CPU frequency out of available frequency range or failed to set voltage.
void POWER_SetLvdFallingTripVoltage ( power_lvd_falling_trip_vol_val_t  volt)
Parameters
volttarget LVD voltage to set.
power_lvd_falling_trip_vol_val_t POWER_GetLvdFallingTripVoltage ( void  )
Returns
Current LVD voltage.
void POWER_SetPmicMode ( uint32_t  mode,
pmic_mode_reg_t  reg 
)
Parameters
mode: PMIC MODE pin value
reg: PDSLEEPCFG0 or PDRUNCFG0 register offset
Returns
PMIC_MODE pins value in PDSLEEPCFG0
void POWER_SetDeepSleepClock ( power_deep_sleep_clk_t  clk)
Parameters
clk: clock source of main clock.
void POWER_EnterDeepSleep ( const uint32_t  exclude_from_pd[4])
Parameters
exclude_from_pdBit mask of the PDRUNCFG0 ~ PDRUNCFG3 that needs to be powered on during Deep Sleep mode selected.
void POWER_EnterDeepPowerDown ( const uint32_t  exclude_from_pd[4])
Parameters
exclude_from_pdBit mask of the PDRUNCFG0 ~ PDRUNCFG3 that needs to be powered on during Deep Power Down mode selected.
void POWER_EnterFullDeepPowerDown ( const uint32_t  exclude_from_pd[4])
Parameters
exclude_from_pdBit mask of the PDRUNCFG0 ~ PDRUNCFG3 that needs to be powered on during Full Deep Power Down mode selected.
void POWER_EnterPowerMode ( power_mode_cfg_t  mode,
const uint32_t  exclude_from_pd[4] 
)
Parameters
modePower mode to enter.
exclude_from_pdBit mask of the PDRUNCFG0 ~ PDRUNCFG3 that needs to be powered on during power mode selected.
void EnableDeepSleepIRQ ( IRQn_Type  interrupt)

Enable the interrupt for wake-up from deep sleep mode. Some interrupts are typically used in sleep mode only and will not occur during deep-sleep mode because relevant clocks are stopped. However, it is possible to enable those clocks (significantly increasing power consumption in the reduced power mode), making these wake-ups possible.

Note
This function also enables the interrupt in the NVIC (EnableIRQ() is called internally).
Parameters
interruptThe IRQ number.
void DisableDeepSleepIRQ ( IRQn_Type  interrupt)

Disable the interrupt for wake-up from deep sleep mode. Some interrupts are typically used in sleep mode only and will not occur during deep-sleep mode because relevant clocks are stopped. However, it is possible to enable those clocks (significantly increasing power consumption in the reduced power mode), making these wake-ups possible.

Note
This function also disables the interrupt in the NVIC (DisableIRQ() is called internally).
Parameters
interruptThe IRQ number.
uint32_t POWER_GetLibVersion ( void  )
Returns
version number of the power library