MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Power: Power driver

Overview

The MCUXpresso SDK provides a power driver for the MCUXpresso SDK devices.

Function description

Power driver and library provides these functions:

Power enable and disable

Power driver provides two API's POWER_EnablePD() and POWER_DisablePD() to enable or disable the PDRUNCFG bits in SYSCON The PDRUNCFG has an inverted logic i.e. the peripheral is powered on when the bit is cleared and powered off when bit is set. So the API POWER_DisablePD() is used to power on a peripheral and POWER_EnablePD() is used to power off a peripheral. The API's take a parameter of type pd_bit_t which organizes the PDRUNCFG bits. The driver also provides two separate API's to power down and power up Flash, POWER_PowerDownFlash() and POWER_PowerUpFlash()

Files

file  fsl_power.h
 

Data Structures

struct  pm_config_t
 Power mode configuration. More...
 

Macros

#define PM_CFG_SRAM_BANK_BIT_BASE   0
 SRAM banks definition list for retention in power down modes !
 
#define POWER_WAKEUPSRC_SYSTEM   LOWPOWER_WAKEUPSRCINT0_SYSTEM_IRQ
 BOD, Watchdog Timer, Flash controller, [DEEP SLEEP] BODVBAT [POWER_DOWN].
 
#define POWER_WAKEUPSRC_DMA   LOWPOWER_WAKEUPSRCINT0_DMA_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_GINT   LOWPOWER_WAKEUPSRCINT0_GINT_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_IRBLASTER   LOWPOWER_WAKEUPSRCINT0_IRBLASTER_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PINT0   LOWPOWER_WAKEUPSRCINT0_PINT0_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PINT1   LOWPOWER_WAKEUPSRCINT0_PINT1_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PINT2   LOWPOWER_WAKEUPSRCINT0_PINT2_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PINT3   LOWPOWER_WAKEUPSRCINT0_PINT3_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_SPIFI   LOWPOWER_WAKEUPSRCINT0_SPIFI_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_TIMER0   LOWPOWER_WAKEUPSRCINT0_TIMER0_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_TIMER1   LOWPOWER_WAKEUPSRCINT0_TIMER1_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_USART0   LOWPOWER_WAKEUPSRCINT0_USART0_IRQ
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_USART1   LOWPOWER_WAKEUPSRCINT0_USART1_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_I2C0   LOWPOWER_WAKEUPSRCINT0_I2C0_IRQ
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_I2C1   LOWPOWER_WAKEUPSRCINT0_I2C1_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_SPI0   LOWPOWER_WAKEUPSRCINT0_SPI0_IRQ
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_SPI1   LOWPOWER_WAKEUPSRCINT0_SPI1_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM0   LOWPOWER_WAKEUPSRCINT0_PWM0_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM1   LOWPOWER_WAKEUPSRCINT0_PWM1_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM2   LOWPOWER_WAKEUPSRCINT0_PWM2_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM3   LOWPOWER_WAKEUPSRCINT0_PWM3_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM4   LOWPOWER_WAKEUPSRCINT0_PWM4_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM5   LOWPOWER_WAKEUPSRCINT0_PWM5_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM6   LOWPOWER_WAKEUPSRCINT0_PWM6_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM7   LOWPOWER_WAKEUPSRCINT0_PWM7_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM8   LOWPOWER_WAKEUPSRCINT0_PWM8_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM9   LOWPOWER_WAKEUPSRCINT0_PWM9_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_PWM10   LOWPOWER_WAKEUPSRCINT0_PWM10_IR
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_I2C2   LOWPOWER_WAKEUPSRCINT0_I2C2_IRQ
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_RTC   LOWPOWER_WAKEUPSRCINT0_RTC_IRQ
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_NFCTAG   LOWPOWER_WAKEUPSRCINT0_NFCTAG_IRQ
 [DEEP SLEEP, POWER DOWN (ES2 Only), DEEP DOWN (ES2 only)]
 
#define POWER_WAKEUPSRC_MAILBOX   LOWPOWER_WAKEUPSRCINT0_MAILBOX_IRQ
 Mailbox, Wake-up from DEEP SLEEP and POWER DOWN low power mode [DEEP SLEEP, POWER DOWN].
 
#define POWER_WAKEUPSRC_ADC_SEQA   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_ADC_SEQA_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_ADC_SEQB   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_ADC_SEQB_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_ADC_THCMP_OVR   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_ADC_THCMP_OVR_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_DMIC   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_DMIC_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_HWVAD   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_HWVAD_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_BLE_DP   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_BLE_DP_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_BLE_DP0   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_BLE_DP0_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_BLE_DP1   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_BLE_DP1_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_BLE_DP2   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_BLE_DP2_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_BLE_LL_ALL   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_BLE_LL_ALL_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_ZIGBEE_MAC   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_ZIGBEE_MAC_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_ZIGBEE_MODEM   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_ZIGBEE_MODEM_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_RFP_TMU   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_RFP_TMU_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_RFP_AGC   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_RFP_AGC_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_ISO7816   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_ISO7816_IRQ << 32)
 [DEEP SLEEP]
 
#define POWER_WAKEUPSRC_ANA_COMP   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_ANA_COMP_IRQ << 32)
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_WAKE_UP_TIMER0   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_WAKE_UP_TIMER0_IRQ << 32)
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_WAKE_UP_TIMER1   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_WAKE_UP_TIMER1_IRQ << 32)
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_BLE_WAKE_TIMER   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_BLE_WAKE_TIMER_IRQ << 32)
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_BLE_OSC_EN   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_BLE_OSC_EN_IRQ << 32)
 [DEEP SLEEP, POWER DOWN]
 
#define POWER_WAKEUPSRC_IO   ((uint64_t)LOWPOWER_WAKEUPSRCINT1_IO_IRQ << 32)
 [POWER DOWN, DEEP DOWN]
 
#define WAKEUP_NONE   (0)
 Programmed sources list for wakeup from POWER_DOWN Modes and DEEP_SLEEP Modes Note : PAD RESET works with All programmed wakeup sources below including WAKEUP_NONE. More...
 
#define WAKEUP_USART1   (1<<9)
 Programmed sources list for wakeup from DEEP_SLEEP Modes only !
 

Typedefs

typedef uint32_t wk_source_t
 Wakeup source definition.
 

Enumerations

enum  pm_mode_t
 Power mode list.
 
enum  reset_cause_t
 Reset Cause definition.
 

Power Configuration

void POWER_Init (void)
 Initialize the sdk power drivers. More...
 
static void POWER_EnablePD (pd_bit_t en)
 API to enable PDRUNCFG bit in the Syscon. More...
 
static void POWER_DisablePD (pd_bit_t en)
 API to disable PDRUNCFG bit in the Syscon. More...
 
static uint32_t POWER_GetIoWakeStatus (void)
 Get IO and Ntag Field detect Wake-up sources from Power Down and Deep Power Down modes. More...
 
bool POWER_SetLowPower (pm_mode_t mode, pm_config_t *config)
 Wrapper function for low power function in ROM API. More...
 
void POWER_GetDefaultConfig (pm_config_t *config)
 obtains power down config structure with default parameters
 
static void POWER_EnterSleep (void)
 Power API to enter sleep mode (Doze mode) More...
 
bool POWER_EnterPowerMode (pm_power_mode_t pm_power_mode, pm_power_config_t *pm_power_config)
 Power Library API to enter different power mode. More...
 
reset_cause_t POWER_GetResetCause (void)
 determine cause of reset More...
 
void POWER_ClearResetCause (void)
 Clear cause of reset.
 
uint32_t POWER_GetLibVersion (void)
 Power Library API to return the library version. More...
 
void POWER_BodVbatGetDefaultConfig (pm_bod_cfg_t *bod_cfg_p)
 Get default Vbat BOD config parameters, level @1.75V, Hysteresis @ 100mV. More...
 
bool POWER_BodVbatConfig (pm_bod_cfg_t *bod_cfg_p)
 Configure the VBAT BOD. More...
 

Data Structure Documentation

struct pm_config_t

Macro Definition Documentation

#define WAKEUP_NONE   (0)

No Wakeup source programmed

Function Documentation

void POWER_Init ( void  )

Optimize the LDO voltage for power saving Initialize the power domains Activate the BOD

Returns
none
static void POWER_EnablePD ( pd_bit_t  en)
inlinestatic

Note that enabling the bit powers down the peripheral

Parameters
enperipheral for which to enable the PDRUNCFG bit
Returns
none
static void POWER_DisablePD ( pd_bit_t  en)
inlinestatic

Note that disabling the bit powers up the peripheral

Parameters
enperipheral for which to disable the PDRUNCFG bit
Returns
none
static uint32_t POWER_GetIoWakeStatus ( void  )
inlinestatic

Allow to identify the wake-up source when waking up from Power-Down modes or Deep Power Down modes. Status is reset by POR, RSTN, WDT. bit in range from 0 to 21 are for DIO0 to DIO21 bit 22 is NTAG field detect wakeup source

Returns
IO and Field detect Wake-up source
bool POWER_SetLowPower ( pm_mode_t  mode,
pm_config_t config 
)

In PM_SLEEP power mode, the application shall program the wakeup sources except for WAKE TIMER0/1 , RTC1KHz, RTC1Hz (field in config->wk_source) sources. Interrupt for these last wake up sources are cleared on resume. On later release, this exception will be removed and application will be responsible to program the wakeup timers. Other wake up sources interrupt are not cleared and will fire if not masked.

In power down and deep down modes, The API handles the programming of the wakeup sources. On wake up, the wakeup source becomes pending and will turn to active if unmasked. Knowing the source of interrupt can be achieved by reading the interrupt status registers in the NVIC.

In Deep sleep, power down, and deep power down modes, the API switches the CPU clock frequency to 12MHz. Application shall turn it back to the desired frequency on wake up from sleep

If RTC1KHz or RTC1Hz is the source of wakeup, the application shall switch OFF the RTC clock if it is no longer used on wakeup : CLOCK_SetClkDiv(clk, 0, false); with clk = kCLOCK_DivRtc1HzClk or kCLOCK_DivRtcClk

Parameters
mode: power mode to switch the chip into
config: configuration structure for wakeup source setting
Returns
false if chip could not go to sleep. Configuration structure is incorrect
static void POWER_EnterSleep ( void  )
inlinestatic
Note
: If the user desires to program a wakeup timer before going to sleep, it needs to use either the fsl_wtimer.h API or use the POWER_SetLowPower() API instead
Returns
none
bool POWER_EnterPowerMode ( pm_power_mode_t  pm_power_mode,
pm_power_config_t *  pm_power_config 
)

If requested mode is PM_POWER_DOWN, the API will perform the clamping of the DIOs if the PIO register has the bit IO_CLAMPING set: SYSCON->RETENTIONCTRL.IOCLAMP will be set

Returns
false if chip could not go to sleep. Configuration structure is incorrect
reset_cause_t POWER_GetResetCause ( void  )
Returns
reset_cause
uint32_t POWER_GetLibVersion ( void  )
Parameters
none
Returns
version number of the power library
void POWER_BodVbatGetDefaultConfig ( pm_bod_cfg_t *  bod_cfg_p)
Parameters
bod_cfg_p
Returns
none
bool POWER_BodVbatConfig ( pm_bod_cfg_t *  bod_cfg_p)
Parameters
bod_cfg_p
Returns
false if configuration parameters are incorrect