EMU - Energy Management Unit#

Energy Management Unit (EMU) Peripheral API.

This module contains functions to control the EMU peripheral of Silicon Labs 32-bit MCUs and SoCs. The EMU handles the different low energy modes in Silicon Labs microcontrollers.

Modules#

EMU_EM01Init_TypeDef

EMU_EM23Init_TypeDef

EMU_EM4Init_TypeDef

EMU_DCDCBoostInit_TypeDef

Enumerations#

enum
emuBODMode_Active
emuBODMode_Inactive
}

BOD threshold setting selector, active or inactive mode.

enum
emuEM4Shutoff = 0
emuEM4Hibernate = 1
}

EM4 modes.

enum
emuPinRetentionDisable = EMU_EM4CTRL_EM4IORETMODE_DISABLE
emuPinRetentionEm4Exit = EMU_EM4CTRL_EM4IORETMODE_EM4EXIT
emuPinRetentionLatch = EMU_EM4CTRL_EM4IORETMODE_SWUNLATCH
}

EM4 Pin Retention Type.

enum
emuPowerConfig_DcdcToDvdd
}

Power configurations.

enum
emuDcdcMode_Bypass = _DCDC_CTRL_MODE_BYPASS
emuDcdcMode_Regulation = _DCDC_CTRL_MODE_DCDCREGULATION
}

DCDC mode.

enum
emuDcdcBoostDriveSpeed_BestEmi = _DCDC_BSTEM01CTRL_DRVSPEED_DEFAULT_SETTING
emuDcdcBoostDriveSpeed_Default = _DCDC_BSTEM01CTRL_DRVSPEED_DEFAULT_SETTING
emuDcdcBoostDriveSpeed_Intermediate = _DCDC_BSTEM01CTRL_DRVSPEED_DEFAULT_SETTING
emuDcdcBoostDriveSpeed_BestEfficiency = _DCDC_BSTEM01CTRL_DRVSPEED_DEFAULT_SETTING
}

DCDC Boost drive speed.

enum
emuDcdcBoostEM01PeakCurrent_Load10mA = _DCDC_BSTEM01CTRL_IPKVAL_Load10mA
emuDcdcBoostEM01PeakCurrent_Load11mA = _DCDC_BSTEM01CTRL_IPKVAL_Load11mA
emuDcdcBoostEM01PeakCurrent_Load13mA = _DCDC_BSTEM01CTRL_IPKVAL_Load13mA
emuDcdcBoostEM01PeakCurrent_Load15mA = _DCDC_BSTEM01CTRL_IPKVAL_Load15mA
emuDcdcBoostEM01PeakCurrent_Load16mA = _DCDC_BSTEM01CTRL_IPKVAL_Load16mA
emuDcdcBoostEM01PeakCurrent_Load18mA = _DCDC_BSTEM01CTRL_IPKVAL_Load18mA
emuDcdcBoostEM01PeakCurrent_Load20mA = _DCDC_BSTEM01CTRL_IPKVAL_Load20mA
emuDcdcBoostEM01PeakCurrent_Load21mA = _DCDC_BSTEM01CTRL_IPKVAL_Load21mA
emuDcdcBoostEM01PeakCurrent_Load23mA = _DCDC_BSTEM01CTRL_IPKVAL_Load23mA
emuDcdcBoostEM01PeakCurrent_Load25mA = _DCDC_BSTEM01CTRL_IPKVAL_Load25mA
}

DCDC Boost EM01 peak current setting.

enum
emuDcdcBoostToffMaxTimeout_Off = _DCDC_BSTCTRL_BSTTOFFMAX_OFF
emuDcdcBoostToffMaxTimeout_0P35us = _DCDC_BSTCTRL_BSTTOFFMAX_TMAX_0P35us
emuDcdcBoostToffMaxTimeout_0P63us = _DCDC_BSTCTRL_BSTTOFFMAX_TMAX_0P63us
emuDcdcBoostToffMaxTimeout_0P91us = _DCDC_BSTCTRL_BSTTOFFMAX_TMAX_0P91us
emuDcdcBoostToffMaxTimeout_1P19us = _DCDC_BSTCTRL_BSTTOFFMAX_TMAX_1P19us
emuDcdcBoostToffMaxTimeout_1P47us = _DCDC_BSTCTRL_BSTTOFFMAX_TMAX_1P47us
emuDcdcBoostToffMaxTimeout_1P75us = _DCDC_BSTCTRL_BSTTOFFMAX_TMAX_1P75us
emuDcdcBoostToffMaxTimeout_2P03us = _DCDC_BSTCTRL_BSTTOFFMAX_TMAX_2P03us
}

DCDC Boost Toff max timeout.

enum
emuDcdcBoostTonMaxTimeout_Off = _DCDC_BSTCTRL_IPKTMAXCTRL_OFF
emuDcdcBoostTonMaxTimeout_0P35us = _DCDC_BSTCTRL_IPKTMAXCTRL_TMAX_0P35us
emuDcdcBoostTonMaxTimeout_0P63us = _DCDC_BSTCTRL_IPKTMAXCTRL_TMAX_0P63us
emuDcdcBoostTonMaxTimeout_0P91us = _DCDC_BSTCTRL_IPKTMAXCTRL_TMAX_0P91us
emuDcdcBoostTonMaxTimeout_1P19us = _DCDC_BSTCTRL_IPKTMAXCTRL_TMAX_1P19us
emuDcdcBoostTonMaxTimeout_1P47us = _DCDC_BSTCTRL_IPKTMAXCTRL_TMAX_1P47us
emuDcdcBoostTonMaxTimeout_1P75us = _DCDC_BSTCTRL_IPKTMAXCTRL_TMAX_1P75us
emuDcdcBoostTonMaxTimeout_2P03us = _DCDC_BSTCTRL_IPKTMAXCTRL_TMAX_2P03us
}

DCDC Boost peak current detection maximum timeout.

enum
emuDcdcBoostEM23PeakCurrent_Load10mA = _DCDC_BSTEM23CTRL_IPKVAL_Load10mA
}

DCDC Boost EM23 peak current setting.

enum
emuVScaleEM01_HighPerformance = _EMU_STATUS_VSCALE_VSCALE2
emuVScaleEM01_LowPower = _EMU_STATUS_VSCALE_VSCALE1
}

Supported EM0/1 Voltage Scaling Levels.

enum
emuVScaleEM23_FastWakeup = _EMU_CTRL_EM23VSCALE_VSCALE2
emuVScaleEM23_LowPower = _EMU_CTRL_EM23VSCALE_VSCALE0
}

Supported EM2/3 Voltage Scaling Levels.

enum
emuTempAvgNum_16 = _EMU_CTRL_TEMPAVGNUM_N16
emuTempAvgNum_64 = _EMU_CTRL_TEMPAVGNUM_N64
}

Number of samples to use for temperature averaging.

Functions#

void
EMU_EM01Init(const EMU_EM01Init_TypeDef *em01Init)

Update the EMU module with Energy Mode 0 and 1 configuration.

void
EMU_EM23Init(const EMU_EM23Init_TypeDef *em23Init)

Update the EMU module with Energy Mode 2 and 3 configuration.

void

Energy mode 2/3 pre-sleep hook function.

void

Energy mode 2/3 post-sleep hook function.

void

EFP's Energy mode 2/3 pre-sleep hook function.

void

EFP's Energy mode 2/3 post-sleep hook function.

void
EMU_EnterEM2(bool restore)

Enter energy mode 2 (EM2).

void
EMU_EnterEM3(bool restore)

Enter energy mode 3 (EM3).

void
EMU_Save(void)

Save the CMU HF clock select state, oscillator enable, and voltage scaling (if available) before EMU_EnterEM2() or EMU_EnterEM3() are called with the restore parameter set to false.

void

Restore CMU HF clock select state, oscillator enable, and voltage scaling (if available) after EMU_EnterEM2() or EMU_EnterEM3() are called with the restore parameter set to false.

void
EMU_EM4Init(const EMU_EM4Init_TypeDef *em4Init)

Update the EMU module with Energy Mode 4 configuration.

void

Energy mode 4 pre-sleep hook function.

void

EFP's Energy mode 4 pre-sleep hook function.

void

Enter energy mode 4 (EM4).

void

Enter energy mode 4 (EM4).

void

Enter energy mode 4 hibernate (EM4H).

void

Enter energy mode 4 shutoff (EM4S).

void
EMU_MemPwrDown(uint32_t blocks)

Power down memory block.

void
EMU_RamPowerDown(uint32_t start, uint32_t end)

Power down RAM memory blocks.

void

Power up all available RAM memory blocks.

void

Update EMU module with CMU oscillator selection/enable status.

void
EMU_EFPEM01VScale(EMU_VScaleEM01_TypeDef voltage)

Energy mode 01 voltage scaling hook function.

void
EMU_VScaleEM01ByClock(uint32_t clockFrequency, bool wait)

Voltage scale in EM0 and 1 by clock frequency.

void
EMU_VScaleEM01(EMU_VScaleEM01_TypeDef voltage, bool wait)

Force voltage scaling in EM0 and 1 to a specific voltage level.

sl_status_t
EMU_DCDCModeSet(EMU_DcdcMode_TypeDef dcdcMode)

Set DCDC regulator operating mode.

void

Indicate that the DCDC peripheral bus clock enable has changed allowing RAIL to react accordingly.

bool
EMU_DCDCBoostInit(const EMU_DCDCBoostInit_TypeDef *dcdcBoostInit)

Configure the DCDC Boost regulator.

void
EMU_EM01BoostPeakCurrentSet(const EMU_DcdcBoostEM01PeakCurrent_TypeDef boostPeakCurrentEM01)

Set EM01 mode Boost Peak Current setting.

void

Enable/disable Boost External Shutdown Mode.

float

Get temperature in degrees Celsius.

void

Enable/disable EFP Direct Mode.

void

Set to enable EFP to drive Decouple voltage.

void
EMU_EFPDriveDvddSet(bool enable)

Set to enable EFP to drive DVDD voltage.

void

Lock DCDC registers in order to protect them against unintended modification.

void

Unlock the DCDC so that writing to locked registers again is possible.

void
EMU_DCDCSync(uint32_t mask)

Wait for the DCDC to complete all synchronization of register changes.

void

Enter energy mode 1 (EM1).

void

Wait for voltage scaling to complete.

Get current voltage scaling level.

void
EMU_IntClear(uint32_t flags)

Clear one or more pending EMU interrupts.

void
EMU_IntDisable(uint32_t flags)

Disable one or more EMU interrupts.

void
EMU_IntEnable(uint32_t flags)

Enable one or more EMU interrupts.

void
EMU_EFPIntDisable(uint32_t flags)

Disable one or more EFP interrupts.

void
EMU_EFPIntEnable(uint32_t flags)

Enable one or more EFP interrupts.

uint32_t

Get pending EMU EFP interrupt flags.

uint32_t

Get enabled and pending EMU EFP interrupt flags.

void
EMU_EFPIntSet(uint32_t flags)

Set one or more pending EMU EFP interrupts.

void
EMU_EFPIntClear(uint32_t flags)

Clear one or more pending EMU EFP interrupts.

uint32_t

Get pending EMU interrupt flags.

uint32_t

Get enabled and pending EMU interrupt flags.

void
EMU_IntSet(uint32_t flags)

Set one or more pending EMU interrupts.

void
EMU_Lock(void)

Lock EMU registers in order to protect them against unintended modification.

void

Unlock the EMU so that writing to locked registers again is possible.

void

When EM4 pin retention is set to emuPinRetentionLatch, then pins are retained through EM4 entry and wakeup.

bool

Temperature measurement ready status.

float

Get averaged temperature in degrees Celsius.

void
EMU_TemperatureAvgRequest(EMU_TempAvgNum_TypeDef numSamples)

Request averaged temperature.

Macros#

#define

Voltage scaling present.

#define

Voltage scaling for EM01 present.

#define

DC-DC boost converter present.

#define

Default initialization of EM0 and 1 configuration.

#define

Default initialization of EM2 and 3 configuration.

#define

Default initialization of EM4 configuration (Series 1 without VSCALE).

#define

Default DCDC Boost initialization.

#define

Zero degrees Celcius in Kelvin.

Enumeration Documentation#

EMU_BODMode_TypeDef#

EMU_BODMode_TypeDef

BOD threshold setting selector, active or inactive mode.

Enumerator
emuBODMode_Active

Configure BOD threshold for active mode.

emuBODMode_Inactive

Configure BOD threshold for inactive mode.


Definition at line 201 of file platform/emlib/inc/em_emu.h

EMU_EM4State_TypeDef#

EMU_EM4State_TypeDef

EM4 modes.

Enumerator
emuEM4Shutoff

EM4 Shutoff.

emuEM4Hibernate

EM4 Hibernate.


Definition at line 209 of file platform/emlib/inc/em_emu.h

EMU_EM4PinRetention_TypeDef#

EMU_EM4PinRetention_TypeDef

EM4 Pin Retention Type.

Enumerator
emuPinRetentionDisable

No Retention: Pads enter reset state when entering EM4.

emuPinRetentionEm4Exit

Retention through EM4: Pads enter reset state when exiting EM4.

emuPinRetentionLatch

Retention through EM4 and wakeup: call EMU_UnlatchPinRetention() to release pins from retention after EM4 wakeup.


Definition at line 218 of file platform/emlib/inc/em_emu.h

EMU_PowerConfig_TypeDef#

EMU_PowerConfig_TypeDef

Power configurations.

DCDC-to-DVDD is currently the only supported mode.

Enumerator
emuPowerConfig_DcdcToDvdd

DCDC is connected to DVDD.


Definition at line 230 of file platform/emlib/inc/em_emu.h

EMU_DcdcMode_TypeDef#

EMU_DcdcMode_TypeDef

DCDC mode.

Enumerator
emuDcdcMode_Bypass

DCDC regulator bypass.

emuDcdcMode_Regulation

DCDC regulator on.


Definition at line 337 of file platform/emlib/inc/em_emu.h

EMU_DcdcBoostDriveSpeed_TypeDef#

EMU_DcdcBoostDriveSpeed_TypeDef

DCDC Boost drive speed.

Enumerator
emuDcdcBoostDriveSpeed_BestEmi

Recommend no options other than DEFAULT be used here, as there is no benefit.

emuDcdcBoostDriveSpeed_Default

Recommend no options other than DEFAULT be used here, as there is no benefit.

emuDcdcBoostDriveSpeed_Intermediate

Recommend no options other than DEFAULT be used here, as there is no benefit.

emuDcdcBoostDriveSpeed_BestEfficiency

Recommend no options other than DEFAULT be used here, as there is no benefit.


Definition at line 458 of file platform/emlib/inc/em_emu.h

EMU_DcdcBoostEM01PeakCurrent_TypeDef#

EMU_DcdcBoostEM01PeakCurrent_TypeDef

DCDC Boost EM01 peak current setting.

Enumerator
emuDcdcBoostEM01PeakCurrent_Load10mA

Load 10mA.

emuDcdcBoostEM01PeakCurrent_Load11mA

Load 11mA.

emuDcdcBoostEM01PeakCurrent_Load13mA

Load 13mA.

emuDcdcBoostEM01PeakCurrent_Load15mA

Load 15mA.

emuDcdcBoostEM01PeakCurrent_Load16mA

Load 16mA.

emuDcdcBoostEM01PeakCurrent_Load18mA

Load 18mA.

emuDcdcBoostEM01PeakCurrent_Load20mA

Load 20mA.

emuDcdcBoostEM01PeakCurrent_Load21mA

Load 21mA.

emuDcdcBoostEM01PeakCurrent_Load23mA

Load 23mA.

emuDcdcBoostEM01PeakCurrent_Load25mA

Load 25mA.


Definition at line 466 of file platform/emlib/inc/em_emu.h

EMU_DcdcBoostToffMaxTimeout_TypeDef#

EMU_DcdcBoostToffMaxTimeout_TypeDef

DCDC Boost Toff max timeout.

Enumerator
emuDcdcBoostToffMaxTimeout_Off

Toff max off.

emuDcdcBoostToffMaxTimeout_0P35us

Toff max is 0.35us.

emuDcdcBoostToffMaxTimeout_0P63us

Toff max is 0.63us.

emuDcdcBoostToffMaxTimeout_0P91us

Toff max is 0.91us.

emuDcdcBoostToffMaxTimeout_1P19us

Toff max is 1.19us.

emuDcdcBoostToffMaxTimeout_1P47us

Toff max is 1.47us.

emuDcdcBoostToffMaxTimeout_1P75us

Toff max is 1.75us.

emuDcdcBoostToffMaxTimeout_2P03us

Toff max is 2.03us.


Definition at line 480 of file platform/emlib/inc/em_emu.h

EMU_DcdcBoostTonMaxTimeout_TypeDef#

EMU_DcdcBoostTonMaxTimeout_TypeDef

DCDC Boost peak current detection maximum timeout.

Enumerator
emuDcdcBoostTonMaxTimeout_Off

Ton max off.

emuDcdcBoostTonMaxTimeout_0P35us

Ton max is 0.35us.

emuDcdcBoostTonMaxTimeout_0P63us

Ton max is 0.63us.

emuDcdcBoostTonMaxTimeout_0P91us

Ton max is 0.91us.

emuDcdcBoostTonMaxTimeout_1P19us

Ton max is 1.19us.

emuDcdcBoostTonMaxTimeout_1P47us

Ton max is 1.47us.

emuDcdcBoostTonMaxTimeout_1P75us

Ton max is 1.75us.

emuDcdcBoostTonMaxTimeout_2P03us

Ton max is 2.03us.


Definition at line 492 of file platform/emlib/inc/em_emu.h

EMU_DcdcBoostEM23PeakCurrent_TypeDef#

EMU_DcdcBoostEM23PeakCurrent_TypeDef

DCDC Boost EM23 peak current setting.

Enumerator
emuDcdcBoostEM23PeakCurrent_Load10mA

Load 10mA.


Definition at line 504 of file platform/emlib/inc/em_emu.h

EMU_VScaleEM01_TypeDef#

EMU_VScaleEM01_TypeDef

Supported EM0/1 Voltage Scaling Levels.

Enumerator
emuVScaleEM01_HighPerformance

High-performance voltage level.

emuVScaleEM01_LowPower

Low-power optimized voltage level.


Definition at line 536 of file platform/emlib/inc/em_emu.h

EMU_VScaleEM23_TypeDef#

EMU_VScaleEM23_TypeDef

Supported EM2/3 Voltage Scaling Levels.

Enumerator
emuVScaleEM23_FastWakeup

Fast-wakeup voltage level.

emuVScaleEM23_LowPower

Low-power optimized voltage level.


Definition at line 555 of file platform/emlib/inc/em_emu.h

EMU_TempAvgNum_TypeDef#

EMU_TempAvgNum_TypeDef

Number of samples to use for temperature averaging.

Enumerator
emuTempAvgNum_16

16 samples used for temperature averaging.

emuTempAvgNum_64

64 samples used for temperature averaging.


Definition at line 698 of file platform/emlib/inc/em_emu.h

Function Documentation#

EMU_EM01Init#

void EMU_EM01Init (const EMU_EM01Init_TypeDef * em01Init)

Update the EMU module with Energy Mode 0 and 1 configuration.

Parameters
[in]em01Init

Energy Mode 0 and 1 configuration structure.


Definition at line 789 of file platform/emlib/src/em_emu.c

EMU_EM23Init#

void EMU_EM23Init (const EMU_EM23Init_TypeDef * em23Init)

Update the EMU module with Energy Mode 2 and 3 configuration.

Parameters
[in]em23Init

Energy Mode 2 and 3 configuration structure.


Definition at line 804 of file platform/emlib/src/em_emu.c

EMU_EM23PresleepHook#

void EMU_EM23PresleepHook (void )

Energy mode 2/3 pre-sleep hook function.

Parameters
N/A

This function is called by EMU_EnterEM2() and EMU_EnterEM3() functions just prior to execution of the WFI instruction. The function implementation does not perform anything, but it is SL_WEAK so that it can be re- implemented in application code if actions are needed.


Definition at line 838 of file platform/emlib/src/em_emu.c

EMU_EM23PostsleepHook#

void EMU_EM23PostsleepHook (void )

Energy mode 2/3 post-sleep hook function.

Parameters
N/A

This function is called by EMU_EnterEM2() and EMU_EnterEM3() functions just after wakeup from the WFI instruction. The function implementation does not perform anything, but it is SL_WEAK so that it can be re- implemented in application code if actions are needed.


Definition at line 870 of file platform/emlib/src/em_emu.c

EMU_EFPEM23PresleepHook#

void EMU_EFPEM23PresleepHook (void )

EFP's Energy mode 2/3 pre-sleep hook function.

Parameters
N/A

This function is similar to EMU_EM23PresleepHook() but is reserved for EFP usage.

Note

  • The function is primarily meant to be used in systems with EFP circuitry. (EFP = Energy Friendly Pmic (PMIC = Power Management IC)). In such systems there is a need to drive certain signals to EFP pins to notify about energy mode transitions.


Definition at line 856 of file platform/emlib/src/em_emu.c

EMU_EFPEM23PostsleepHook#

void EMU_EFPEM23PostsleepHook (void )

EFP's Energy mode 2/3 post-sleep hook function.

Parameters
N/A

This function is similar to EMU_EM23PostsleepHook() but is reserved for EFP usage.

Note

  • The function is primarily meant to be used in systems with EFP circuitry. (EFP = Energy Friendly Pmic (PMIC = Power Management IC)). In such systems there is a need to drive certain signals to EFP pins to notify about energy mode transitions.


Definition at line 888 of file platform/emlib/src/em_emu.c

EMU_EnterEM2#

void EMU_EnterEM2 (bool restore)

Enter energy mode 2 (EM2).

Parameters
[in]restore
  • true - save and restore oscillators, clocks and voltage scaling, see function details.

  • false - do not save and restore oscillators and clocks, see function details.

When entering EM2, high-frequency clocks are disabled, i.e., HFXO, HFRCO and AUXHFRCO (for AUXHFRCO, see exception note below). When re-entering EM0, HFRCO is re-enabled and the core will be clocked by the configured HFRCO band. This ensures a quick wakeup from EM2.

However, prior to entering EM2, the core may have been using another oscillator than HFRCO. The restore parameter gives the user the option to restore all HF oscillators according to state prior to entering EM2, as well as the clock used to clock the core. This restore procedure is handled by SW. However, since handled by SW, it will not be restored before completing the interrupt function(s) waking up the core!

Note

  • If restoring core clock to use the HFXO oscillator, which has been disabled during EM2 mode, this function will stall until the oscillator has stabilized. Stalling time can be reduced by adding interrupt support detecting stable oscillator, and an asynchronous switch to the original oscillator. See CMU documentation. Such a feature is however outside the scope of the implementation in this function.

  • If ERRATA_FIX_EMU_E110_ENABLE is active, the core's SLEEPONEXIT feature can not be used.

  • This function is incompatible with the Power Manager module. When the Power Manager module is present, it must be the one deciding at which EM level the device sleeps to ensure the application properly works. Using both at the same time could lead to undefined behavior in the application.

  • If HFXO is re-enabled by this function, and NOT used to clock the core, this function will not wait for HFXO to stabilize. This must be considered by the application if trying to use features relying on that oscillator upon return.

  • If a debugger is attached, the AUXHFRCO will not be disabled if enabled upon entering EM2. It will thus remain enabled when returning to EM0 regardless of the restore parameter.

  • If HFXO autostart and select is enabled by using CMU_HFXOAutostartEnable(), the automatic starting and selecting of the core clocks will be done, regardless of the restore parameter, when waking up on the wakeup sources corresponding to the autostart and select setting.

  • If voltage scaling is supported, the restore parameter is true and the EM0 voltage scaling level is set higher than the EM2 level, then the EM0 level is also restored.

  • On Series 2 Config 2 devices (EFRxG22), this function will also relock the DPLL if the DPLL is used and restore is true.

Note that the hardware will automatically update the HFRCO frequency in the case where voltage scaling is used in EM2/EM3 and not in EM0/EM1. When the restore argument to this function is true then software will restore the original HFRCO frequency after EM2/EM3 wake up. If the restore argument is false then the HFRCO frequency is 19 MHz when coming out of EM2/EM3 and all wait states are at a safe value.

  • The restore option should only be used if all clock control is done via the CMU API.


Definition at line 962 of file platform/emlib/src/em_emu.c

EMU_EnterEM3#

void EMU_EnterEM3 (bool restore)

Enter energy mode 3 (EM3).

Parameters
[in]restore
  • true - save and restore oscillators, clocks and voltage scaling, see function details.

  • false - do not save and restore oscillators and clocks, see function details.

When entering EM3, the high-frequency clocks are disabled by hardware, i.e., HFXO, HFRCO, and AUXHFRCO (for AUXHFRCO, see exception note below). In addition, the low-frequency clocks, i.e., LFXO and LFRCO are disabled by software. When re-entering EM0, HFRCO is re-enabled and the core will be clocked by the configured HFRCO band. This ensures a quick wakeup from EM3.

However, prior to entering EM3, the core may have been using an oscillator other than HFRCO. The restore parameter gives the user the option to restore all HF/LF oscillators according to state prior to entering EM3, as well as the clock used to clock the core. This restore procedure is handled by software. However, since it is handled by software, it will not be restored before completing the interrupt function(s) waking up the core!

Note

  • If restoring core clock to use an oscillator other than HFRCO, this function will stall until the oscillator has stabilized. Stalling time can be reduced by adding interrupt support detecting stable oscillator, and an asynchronous switch to the original oscillator. See CMU documentation. This feature is, however, outside the scope of the implementation in this function.

  • If ERRATA_FIX_EMU_E110_ENABLE is active, the core's SLEEPONEXIT feature can't be used.

  • This function is incompatible with the Power Manager module. When the Power Manager module is present, it must be the one deciding at which EM level the device sleeps to ensure the application properly works. Using both at the same time could lead to undefined behavior in the application.

  • If HFXO/LFXO/LFRCO are re-enabled by this function, and NOT used to clock the core, this function will not wait for those oscillators to stabilize. This must be considered by the application if trying to use features relying on those oscillators upon return.

  • If a debugger is attached, the AUXHFRCO will not be disabled if enabled upon entering EM3. It will, therefore, remain enabled when returning to EM0 regardless of the restore parameter.

  • If voltage scaling is supported, the restore parameter is true and the EM0 voltage scaling level is set higher than the EM3 level, then the EM0 level is also restored.

  • On Series 2 Config 2 devices (EFRxG22), this function will also relock the DPLL if the DPLL is used and restore is true.

  • The restore option should only be used if all clock control is done via the CMU API.


Definition at line 1165 of file platform/emlib/src/em_emu.c

EMU_Save#

void EMU_Save (void )

Save the CMU HF clock select state, oscillator enable, and voltage scaling (if available) before EMU_EnterEM2() or EMU_EnterEM3() are called with the restore parameter set to false.

Parameters
N/A

Calling this function is equivalent to calling EMU_EnterEM2() or EMU_EnterEM3() with the restore parameter set to true, but it allows the state to be saved without going to sleep. The state can be restored manually by calling EMU_Restore().


Definition at line 1330 of file platform/emlib/src/em_emu.c

EMU_Restore#

void EMU_Restore (void )

Restore CMU HF clock select state, oscillator enable, and voltage scaling (if available) after EMU_EnterEM2() or EMU_EnterEM3() are called with the restore parameter set to false.

Parameters
N/A

Calling this function is equivalent to calling EMU_EnterEM2() or EMU_EnterEM3() with the restore parameter set to true, but it allows the application to evaluate the wakeup reason before restoring state.


Definition at line 1351 of file platform/emlib/src/em_emu.c

EMU_EM4Init#

void EMU_EM4Init (const EMU_EM4Init_TypeDef * em4Init)

Update the EMU module with Energy Mode 4 configuration.

Parameters
[in]em4Init

Energy Mode 4 configuration structure.


Definition at line 1371 of file platform/emlib/src/em_emu.c

EMU_EM4PresleepHook#

void EMU_EM4PresleepHook (void )

Energy mode 4 pre-sleep hook function.

Parameters
N/A

This function is called by EMU_EnterEM4() just prior to the sequence of writes to put the device in EM4. The function implementation does not perform anything, but it is SL_WEAK so that it can be re-implemented in application code if actions are needed.


Definition at line 1435 of file platform/emlib/src/em_emu.c

EMU_EFPEM4PresleepHook#

void EMU_EFPEM4PresleepHook (void )

EFP's Energy mode 4 pre-sleep hook function.

Parameters
N/A

This function is similar to EMU_EM4PresleepHook() but is reserved for EFP usage.

Note

  • The function is primarily meant to be used in systems with EFP circuitry. (EFP = Energy Friendly Pmic (PMIC = Power Management IC)). In such systems there is a need to drive certain signals to EFP pins to notify about energy mode transitions.


Definition at line 1453 of file platform/emlib/src/em_emu.c

EMU_EnterEM4#

void EMU_EnterEM4 (void )

Enter energy mode 4 (EM4).

Parameters
N/A

Note

  • Only a power on reset or external reset pin can wake the device from EM4.


Definition at line 1464 of file platform/emlib/src/em_emu.c

EMU_EnterEM4Wait#

void EMU_EnterEM4Wait (void )

Enter energy mode 4 (EM4).

Parameters
N/A

This function waits after the EM4 entry request to make sure the CPU is properly shutdown or the EM4 entry failed.

Note

  • Only a power on reset or external reset pin can wake the device from EM4.


Definition at line 1605 of file platform/emlib/src/em_emu.c

EMU_EnterEM4H#

void EMU_EnterEM4H (void )

Enter energy mode 4 hibernate (EM4H).

Parameters
N/A

Note

  • Retention of clocks and GPIO in EM4 can be configured using EMU_EM4Init before calling this function.


Definition at line 1625 of file platform/emlib/src/em_emu.c

EMU_EnterEM4S#

void EMU_EnterEM4S (void )

Enter energy mode 4 shutoff (EM4S).

Parameters
N/A

Note

  • Retention of clocks and GPIO in EM4 can be configured using EMU_EM4Init before calling this function.


Definition at line 1641 of file platform/emlib/src/em_emu.c

EMU_MemPwrDown#

void EMU_MemPwrDown (uint32_t blocks)

Power down memory block.

Parameters
[in]blocks

Specifies a logical OR of bits indicating memory blocks to power down. Bit 0 selects block 1, bit 1 selects block 2, and so on. Memory block 0 cannot be disabled. See the reference manual for available memory blocks for a device.

Note

  • Only a POR reset can power up the specified memory block(s) after power down.


Definition at line 1667 of file platform/emlib/src/em_emu.c

EMU_RamPowerDown#

void EMU_RamPowerDown (uint32_t start, uint32_t end)

Power down RAM memory blocks.

Parameters
[in]start

The start address of the RAM region to power down. This address is inclusive.

[in]end

The end address of the RAM region to power down. This address is exclusive. If this parameter is 0, all RAM blocks contained in the region from start to the upper RAM address will be powered down.

This function will power down all the RAM blocks that are within a given range. The RAM block layout is different between device families, so this function can be used in a generic way to power down a RAM memory region which is known to be unused.

This function will only power down blocks which are completely enclosed by the memory range given by [start, end).

This is an example to power down all RAM blocks except the first one. The first RAM block is special in that it cannot be powered down by the hardware. The size of the first RAM block is device-specific. See the reference manual to find the RAM block sizes.

EMU_RamPowerDown(SRAM_BASE, SRAM_BASE + SRAM_SIZE);

Note

  • Only a reset can power up the specified memory block(s) after power down on a series 0 device. The specified memory block(s) will stay off until a call to EMU_RamPowerUp() is done on series 1/2.


Definition at line 1714 of file platform/emlib/src/em_emu.c

EMU_RamPowerUp#

void EMU_RamPowerUp (void )

Power up all available RAM memory blocks.

Parameters
N/A

This function will power up all the RAM blocks on a device, this means that the RAM blocks are retained in EM2/EM3. Note that this functionality is not supported on Series 0 devices. Only a reset will power up the RAM blocks on a series 0 device.


Definition at line 1807 of file platform/emlib/src/em_emu.c

EMU_UpdateOscConfig#

void EMU_UpdateOscConfig (void )

Update EMU module with CMU oscillator selection/enable status.

Parameters
N/A

Definition at line 1857 of file platform/emlib/src/em_emu.c

EMU_EFPEM01VScale#

void EMU_EFPEM01VScale (EMU_VScaleEM01_TypeDef voltage)

Energy mode 01 voltage scaling hook function.

Parameters
[in]voltage

Voltage scaling level requested.

This function is called by EMU_VScaleEM01 to let EFP know that voltage scaling is requested.


Definition at line 1876 of file platform/emlib/src/em_emu.c

EMU_VScaleEM01ByClock#

void EMU_VScaleEM01ByClock (uint32_t clockFrequency, bool wait)

Voltage scale in EM0 and 1 by clock frequency.

Parameters
[in]clockFrequency

Use CMSIS HF clock if 0 or override to custom clock. Providing a custom clock frequency is required if using a non-standard HFXO frequency.

[in]wait

Wait for scaling to complete.

Note


Definition at line 1897 of file platform/emlib/src/em_emu.c

EMU_VScaleEM01#

void EMU_VScaleEM01 (EMU_VScaleEM01_TypeDef voltage, bool wait)

Force voltage scaling in EM0 and 1 to a specific voltage level.

Parameters
[in]voltage

Target VSCALE voltage level.

[in]wait

Wait for scaling to complete.

Note


Definition at line 1950 of file platform/emlib/src/em_emu.c

EMU_DCDCModeSet#

sl_status_t EMU_DCDCModeSet (EMU_DcdcMode_TypeDef dcdcMode)

Set DCDC regulator operating mode.

Parameters
[in]dcdcMode

DCDC mode.

Returns

  • Returns the status of the DCDC mode set operation.

    *   SL_STATUS_OK - Operation completed successfully.
    *   SL_STATUS_TIMEOUT - Operation EMU DCDC set mode timeout.
    * 

Definition at line 3460 of file platform/emlib/src/em_emu.c

EMU_DCDCUpdatedHook#

void EMU_DCDCUpdatedHook (void )

Indicate that the DCDC peripheral bus clock enable has changed allowing RAIL to react accordingly.

Parameters
N/A

This function is called after DCDC has been enabled or disabled. The function implementation does not perform anything, but it is SL_WEAK so that it can use the RAIL version if needed.


Definition at line 3443 of file platform/emlib/src/em_emu.c

EMU_DCDCBoostInit#

bool EMU_DCDCBoostInit (const EMU_DCDCBoostInit_TypeDef * dcdcBoostInit)

Configure the DCDC Boost regulator.

Parameters
[in]dcdcBoostInit

The DCDC initialization structure.

Returns

  • True if initialization parameters are valid.


Definition at line 3340 of file platform/emlib/src/em_emu.c

EMU_EM01BoostPeakCurrentSet#

void EMU_EM01BoostPeakCurrentSet (const EMU_DcdcBoostEM01PeakCurrent_TypeDef boostPeakCurrentEM01)

Set EM01 mode Boost Peak Current setting.

Parameters
[in]boostPeakCurrentEM01

Boost Peak load current coefficient in EM01 mode.


Definition at line 3382 of file platform/emlib/src/em_emu.c

EMU_BoostExternalShutdownEnable#

void EMU_BoostExternalShutdownEnable (bool enable)

Enable/disable Boost External Shutdown Mode.

Parameters
[in]enable

The boost DC-DC converter can be activated or deactivated from a dedicated BOOST_EN pin on the device if enable is true.


Definition at line 3421 of file platform/emlib/src/em_emu.c

EMU_TemperatureGet#

float EMU_TemperatureGet (void )

Get temperature in degrees Celsius.

Parameters
N/A

Returns

  • Temperature in degrees Celsius


Definition at line 4147 of file platform/emlib/src/em_emu.c

EMU_EFPDirectModeEnable#

void EMU_EFPDirectModeEnable (bool enable)

Enable/disable EFP Direct Mode.

Parameters
[in]enable

True to enable direct mode.


Definition at line 4185 of file platform/emlib/src/em_emu.c

EMU_EFPDriveDecoupleSet#

void EMU_EFPDriveDecoupleSet (bool enable)

Set to enable EFP to drive Decouple voltage.

Parameters
[in]enable

True to enable EFP to drive Decouple voltage.

Once set, internal LDO will be disabled, and the EMU will control EFP for voltage-scaling. Note that because this bit disables the internal LDO powering the core, it should not be set until after EFP's DECOUPLE output has been configured and enabled.


Definition at line 4209 of file platform/emlib/src/em_emu.c

EMU_EFPDriveDvddSet#

void EMU_EFPDriveDvddSet (bool enable)

Set to enable EFP to drive DVDD voltage.

Parameters
[in]enable

True to enable EFP to drive DVDD voltage.

Set this if EFP's DCDC output is powering DVDD supply. This mode assumes that internal DCDC is not being used.


Definition at line 4231 of file platform/emlib/src/em_emu.c

EMU_DCDCLock#

void EMU_DCDCLock (void )

Lock DCDC registers in order to protect them against unintended modification.

Parameters
N/A

Definition at line 1251 of file platform/emlib/inc/em_emu.h

EMU_DCDCUnlock#

void EMU_DCDCUnlock (void )

Unlock the DCDC so that writing to locked registers again is possible.

Parameters
N/A

Definition at line 1262 of file platform/emlib/inc/em_emu.h

EMU_DCDCSync#

void EMU_DCDCSync (uint32_t mask)

Wait for the DCDC to complete all synchronization of register changes.

Parameters
[in]mask

A bitmask corresponding to SYNCBUSY register defined bits indicating registers that must complete any ongoing synchronization.


Definition at line 1277 of file platform/emlib/inc/em_emu.h

EMU_EnterEM1#

void EMU_EnterEM1 (void )

Enter energy mode 1 (EM1).

Parameters
N/A

Note

  • This function is incompatible with the Power Manager module. When the Power Manager module is present, it must be the one deciding at which EM level the device sleeps to ensure the application properly works. Using both at the same time could lead to undefined behavior in the application.


Definition at line 1313 of file platform/emlib/inc/em_emu.h

EMU_VScaleWait#

void EMU_VScaleWait (void )

Wait for voltage scaling to complete.

Parameters
N/A

Definition at line 1325 of file platform/emlib/inc/em_emu.h

EMU_VScaleGet#

EMU_VScaleEM01_TypeDef EMU_VScaleGet (void )

Get current voltage scaling level.

Parameters
N/A

Returns

  • Current voltage scaling level.


Definition at line 1347 of file platform/emlib/inc/em_emu.h

EMU_IntClear#

void EMU_IntClear (uint32_t flags)

Clear one or more pending EMU interrupts.

Parameters
[in]flags

Pending EMU interrupt sources to clear. Use one or more valid interrupt flags for the EMU module (EMU_IFC_nnn or EMU_IF_nnn).


Definition at line 1380 of file platform/emlib/inc/em_emu.h

EMU_IntDisable#

void EMU_IntDisable (uint32_t flags)

Disable one or more EMU interrupts.

Parameters
[in]flags

EMU interrupt sources to disable. Use one or more valid interrupt flags for the EMU module (EMU_IEN_nnn).


Definition at line 1397 of file platform/emlib/inc/em_emu.h

EMU_IntEnable#

void EMU_IntEnable (uint32_t flags)

Enable one or more EMU interrupts.

Parameters
[in]flags

EMU interrupt sources to enable. Use one or more valid interrupt flags for the EMU module (EMU_IEN_nnn).

Note

  • Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using EMU_IntClear() prior to enabling the interrupt.


Definition at line 1419 of file platform/emlib/inc/em_emu.h

EMU_EFPIntDisable#

void EMU_EFPIntDisable (uint32_t flags)

Disable one or more EFP interrupts.

Parameters
[in]flags

EFP interrupt sources to disable. Use one or more valid interrupt flags for the EFP module (EFPIENnnn).


Definition at line 1437 of file platform/emlib/inc/em_emu.h

EMU_EFPIntEnable#

void EMU_EFPIntEnable (uint32_t flags)

Enable one or more EFP interrupts.

Parameters
[in]flags

EFP interrupt sources to enable. Use one or more valid interrupt flags for the EFP module (EFPIENnnn).


Definition at line 1450 of file platform/emlib/inc/em_emu.h

EMU_EFPIntGet#

uint32_t EMU_EFPIntGet (void )

Get pending EMU EFP interrupt flags.

Parameters
N/A

Note

  • Event bits are not cleared by the use of this function.

Returns

  • EMU EFP interrupt sources pending. .


Definition at line 1465 of file platform/emlib/inc/em_emu.h

EMU_EFPIntGetEnabled#

uint32_t EMU_EFPIntGetEnabled (void )

Get enabled and pending EMU EFP interrupt flags.

Parameters
N/A

Useful for handling more interrupt sources in the same interrupt handler.

Note

  • Interrupt flags are not cleared by the use of this function.

Returns

  • Pending and enabled EMU EFP interrupt sources Return value is the bitwise AND of

    • the enabled interrupt sources in EMU_EFPIEN and

    • the pending interrupt flags EMU_EFPIF.


Definition at line 1484 of file platform/emlib/inc/em_emu.h

EMU_EFPIntSet#

void EMU_EFPIntSet (uint32_t flags)

Set one or more pending EMU EFP interrupts.

Parameters
[in]flags

EMU EFP interrupt sources to set to pending. Use one or more valid interrupt flags for the EMU EFP module (EMU_EFPIFSnnn).


Definition at line 1500 of file platform/emlib/inc/em_emu.h

EMU_EFPIntClear#

void EMU_EFPIntClear (uint32_t flags)

Clear one or more pending EMU EFP interrupts.

Parameters
[in]flags

Pending EMU EFP interrupt sources to clear. Use one or more valid interrupt flags for the EMU EFP module.


Definition at line 1513 of file platform/emlib/inc/em_emu.h

EMU_IntGet#

uint32_t EMU_IntGet (void )

Get pending EMU interrupt flags.

Parameters
N/A

Note

  • Event bits are not cleared by the use of this function.

Returns

  • EMU interrupt sources pending. Returns one or more valid interrupt flags for the EMU module (EMU_IF_nnn).


Definition at line 1530 of file platform/emlib/inc/em_emu.h

EMU_IntGetEnabled#

uint32_t EMU_IntGetEnabled (void )

Get enabled and pending EMU interrupt flags.

Parameters
N/A

Useful for handling more interrupt sources in the same interrupt handler.

Note

  • Interrupt flags are not cleared by the use of this function.

Returns

  • Pending and enabled EMU interrupt sources Return value is the bitwise AND of

    • the enabled interrupt sources in EMU_IEN and

    • the pending interrupt flags EMU_IF.


Definition at line 1549 of file platform/emlib/inc/em_emu.h

EMU_IntSet#

void EMU_IntSet (uint32_t flags)

Set one or more pending EMU interrupts.

Parameters
[in]flags

EMU interrupt sources to set to pending. Use one or more valid interrupt flags for the EMU module (EMU_IFS_nnn).


Definition at line 1565 of file platform/emlib/inc/em_emu.h

EMU_Lock#

void EMU_Lock (void )

Lock EMU registers in order to protect them against unintended modification.

Parameters
N/A

Note

  • If locking EMU registers, they must be unlocked prior to using any EMU API functions modifying EMU registers, excluding interrupt control and regulator control if the architecture has a EMU_PWRCTRL register. An exception to this is the energy mode entering API (EMU_EnterEMn()), which can be used when the EMU registers are locked.


Definition at line 1625 of file platform/emlib/inc/em_emu.h

EMU_Unlock#

void EMU_Unlock (void )

Unlock the EMU so that writing to locked registers again is possible.

Parameters
N/A

Definition at line 1634 of file platform/emlib/inc/em_emu.h

EMU_UnlatchPinRetention#

void EMU_UnlatchPinRetention (void )

When EM4 pin retention is set to emuPinRetentionLatch, then pins are retained through EM4 entry and wakeup.

Parameters
N/A

The pin state is released by calling this function. The feature allows peripherals or GPIO to be re-initialized after EM4 exit (reset), and when initialization is done, this function can release pins and return control to the peripherals or GPIO.


Definition at line 1690 of file platform/emlib/inc/em_emu.h

EMU_TemperatureReady#

bool EMU_TemperatureReady (void )

Temperature measurement ready status.

Parameters
N/A

Returns

  • True if temperature measurement is ready


Definition at line 1706 of file platform/emlib/inc/em_emu.h

EMU_TemperatureAvgGet#

float EMU_TemperatureAvgGet (void )

Get averaged temperature in degrees Celsius.

Parameters
N/A

Note

  • An averaged temperature measurement must first be requested by calling EMU_TemperatureAvgRequest() and waiting for the TEMPAVG interrupt flag to go high.

Returns

  • Averaged temperature


Definition at line 1728 of file platform/emlib/inc/em_emu.h

EMU_TemperatureAvgRequest#

void EMU_TemperatureAvgRequest (EMU_TempAvgNum_TypeDef numSamples)

Request averaged temperature.

Parameters
[in]numSamples

Number of temperature samples to average

Note

  • EMU must be unlocked by calling EMU_Unlock() before this function can be called.


Definition at line 1746 of file platform/emlib/inc/em_emu.h

Macro Definition Documentation#

EMU_VSCALE_PRESENT#

#define EMU_VSCALE_PRESENT

Voltage scaling present.


Definition at line 58 of file platform/emlib/inc/em_emu.h

EMU_VSCALE_EM01_PRESENT#

#define EMU_VSCALE_EM01_PRESENT

Voltage scaling for EM01 present.


Definition at line 61 of file platform/emlib/inc/em_emu.h

EMU_SERIES2_DCDC_BOOST_PRESENT#

#define EMU_SERIES2_DCDC_BOOST_PRESENT

DC-DC boost converter present.


Definition at line 81 of file platform/emlib/inc/em_emu.h

EMU_EM01INIT_DEFAULT#

#define EMU_EM01INIT_DEFAULT
Value:
{ \
false /* Do not scale down in EM0/1.*/ \
}

Default initialization of EM0 and 1 configuration.


Definition at line 719 of file platform/emlib/inc/em_emu.h

EMU_EM23INIT_DEFAULT#

#define EMU_EM23INIT_DEFAULT
Value:
{ \
false, /* Reduced voltage regulator drive strength in EM2/3.*/ \
emuVScaleEM23_FastWakeup, /* Do not scale down in EM2/3. */ \
}

Default initialization of EM2 and 3 configuration.


Definition at line 735 of file platform/emlib/inc/em_emu.h

EMU_EM4INIT_DEFAULT#

#define EMU_EM4INIT_DEFAULT
Value:
{ \
false, /* Retain LFXO configuration upon EM4 entry. */ \
false, /* Retain LFRCO configuration upon EM4 entry. */ \
false, /* Retain ULFRCO configuration upon EM4 entry. */ \
emuEM4Shutoff, /* Use EM4 shutoff state. */ \
emuPinRetentionDisable, /* Do not retain pins in EM4. */ \
}

Default initialization of EM4 configuration (Series 1 without VSCALE).


Definition at line 796 of file platform/emlib/inc/em_emu.h

EMU_DCDCBOOSTINIT_DEFAULT#

#define EMU_DCDCBOOSTINIT_DEFAULT
Value:
{ \
emuDcdcBoostTonMaxTimeout_1P19us, /**< Ton max is 1.19us. */ \
true, /**< disable DCDC boost mode with BOOST_EN=0 */ \
emuDcdcBoostDriveSpeed_Default, /**< Default efficiency in EM0/1. */ \
emuDcdcBoostDriveSpeed_Default, /**< Default efficiency in EM2/3. */ \
emuDcdcBoostEM01PeakCurrent_Load25mA, /**< Default peak current in EM0/1. */ \
emuDcdcBoostEM23PeakCurrent_Load10mA /**< Default peak current in EM2/3. */ \
}

Default DCDC Boost initialization.


Definition at line 892 of file platform/emlib/inc/em_emu.h

EMU_TEMP_ZERO_C_IN_KELVIN#

#define EMU_TEMP_ZERO_C_IN_KELVIN
Value:
(273.15f)

Zero degrees Celcius in Kelvin.


Definition at line 1698 of file platform/emlib/inc/em_emu.h