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

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()

Enable and Disable Deep Sleep in Core

The power driver provides two API's POWER_EnableDeepSleep() and POWER_DisableDeepSleep() to enable or disable the deep sleep bit in the ARM Core. POWER_EnableDeepSleep() is used to enable deep sleep and POWER_DisableDeepSleep() is used to disable deep sleep.

Entering Power Modes

The Power library provides two API's to enter low power modes i.e. Deep Sleep and Deep Power Down. Deep Sleep is a sleep mode in which the ARM Core, Flash and many other peripheral are turned off to save power. The processor can be woken by an IO activity and will resume executing from next instruction after sleep. If a peripheral or RAM needs to On for wakeup or to retain memory then those peripheral need to be kept on during deep sleep. Deep power down is a power down mode where the processor resets upon wake up and during power down the entire part is powered down except for the RTC. For Deep Power Down only the Reset and RTC Alarm or WakeUp can be wakeup sources. The power library provides an API POWER_EnterDeepSleep() to enter deep sleep mode. This function takes a parameter which is a bit mask of the PDRUNCFG register. Any bit that is set will be powered on during deep sleep. So this mask would usually has the RAM memory that needs to retain power and also any wakeup source. The API POWER_EnterDeepPowerDown() is used to enter deep power down mode. This API also has a parameter but since the volatge is cut off for the peripheral this parameter has no effect

Set Voltages for Frequency

The power library provides API's to set the voltage for the desired operating frequency of the processor. The voltage regulation system can be in normal regulation mode or in low power regulation mode. The API POWER_SetVoltageForFreq() is used to set the voltage for normal regulation mode. Based on the frequency parameter the optimum voltage level is set. The API POWER_SetLowPowerVoltageForFreq() is used to set the low power voltage regulation mode and set the voltages for the desired frequency. For POWER_SetLowPowerVoltageForFreq() only two FRO frequencies are supported, 12MHz and 48MHz.

Typical use case

## Power Enable and Set Voltage example {#PowerEnableExample}

POWER_DisablePD(kPDRUNCFG_PD_FRO_EN);
kFRO12M_to_MAIN_CLK);
CLOCK_SetFLASHAccessCyclesForFreq(48000000);
CLOCK_AttachClk(kFRO_HF_to_MAIN_CLK);

Power Mode example

int main(void)
{
/* Init board hardware. */
BOARD_InitHardware();
/* Running FRO = 12 MHz*/
BOARD_BootClockVLPR();
/* Init output LED GPIO. */
LED_GREEN_INIT(1);
/* Attach Main Clock as CLKOUT */
CLOCK_AttachClk(kMAIN_CLK_to_CLKOUT);
/* Set the clock dividor to divide by 2*/
CLOCK_SetClkDiv(kCLOCK_DivClkOut, 2, false);
/* Intiialize UTICK */
UTICK_Init(UTICK0);
/* Set the UTICK timer to wake up the device from reduced power mode */
UTICK_SetTick(UTICK0, kUTICK_Repeat, UTICK_TIME, NULL);
/* Enter Deep Sleep mode */
POWER_EnterDeepSleep(SYSCON_PDRUNCFG_PDEN_SRAM0_MASK | SYSCON_PDRUNCFG_PDEN_SRAMX_MASK | SYSCON_PDRUNCFG_PDEN_WDT_OSC_MASK);
/* Set the clock dividor to divide by 1*/
CLOCK_SetClkDiv(kCLOCK_DivClkOut, 1, false);
while (1)
{
/* Toggle LED */
LED_GREEN_TOGGLE();
delay();
}
}

Files

file  fsl_power.h
 

Driver version

#define FSL_POWER_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 power driver version 2.0.0. More...
 

Power Configuration

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 void POWER_EnableDeepSleep (void)
 API to enable deep sleep bit in the ARM Core. More...
 
static void POWER_DisableDeepSleep (void)
 API to disable deep sleep bit in the ARM Core. More...
 
void POWER_OtpReload (void)
 Power Library API to reload OTP. More...
 
void POWER_SetPLL (void)
 Power Library API to power the PLLs. More...
 
void POWER_SetUsbPhy (void)
 Power Library API to power the USB PHY. More...
 
void POWER_EnterPowerMode (power_mode_cfg_t mode, uint64_t exclude_from_pd)
 Power Library API to enter different power mode. More...
 
void POWER_EnterSleep (void)
 Power Library API to enter sleep mode. More...
 
void POWER_EnterDeepSleep (uint64_t exclude_from_pd)
 Power Library API to enter deep sleep mode. More...
 
void POWER_EnterDeepPowerDown (uint64_t exclude_from_pd)
 Power Library API to enter deep power down mode. More...
 
void POWER_SetVoltageForFreq (uint32_t freq)
 Power Library API to choose normal regulation and set the voltage for the desired operating frequency. More...
 
uint32_t POWER_GetLibVersion (void)
 Power Library API to return the library version. More...
 

Macro Definition Documentation

#define FSL_POWER_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))

Function Documentation

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 void POWER_EnableDeepSleep ( void  )
inlinestatic
Parameters
none
Returns
none
static void POWER_DisableDeepSleep ( void  )
inlinestatic
Parameters
none
Returns
none
void POWER_OtpReload ( void  )
   This API must be called if VD6 is power down
   and power back again since FROHF TRIM value 
   is store in OTP. If not, when calling FROHF settng
   API in clock driver then the FROHF clock out put 
   will be inaccurate.
Returns
none
void POWER_SetPLL ( void  )
Parameters
none
Returns
none
void POWER_SetUsbPhy ( void  )
Parameters
none
Returns
none
void POWER_EnterPowerMode ( power_mode_cfg_t  mode,
uint64_t  exclude_from_pd 
)
Parameters
exclude_from_pdBit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) that needs to be powered on during power mode selected.
Returns
none
void POWER_EnterSleep ( void  )
Returns
none
void POWER_EnterDeepSleep ( uint64_t  exclude_from_pd)
Parameters
exclude_from_pdBit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) bits that needs to be powered on during deep sleep
Returns
none
void POWER_EnterDeepPowerDown ( uint64_t  exclude_from_pd)
Parameters
exclude_from_pdBit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) that needs to be powered on during deep power down mode, but this is has no effect as the voltages are cut off.
Returns
none
void POWER_SetVoltageForFreq ( uint32_t  freq)
Parameters
freq- The desired frequency at which the part would like to operate, note that the voltage and flash wait states should be set before changing frequency
Returns
none
uint32_t POWER_GetLibVersion ( void  )
Parameters
none
Returns
version number of the power library