EMU
[EM_Library]

Energy Management Unit (EMU) Peripheral API. More...

Collaboration diagram for EMU:

Data Structures

struct  EMU_EM4Init_TypeDef
struct  EMU_BUPDInit_TypeDef

Defines

#define EMU_EM4INIT_DEFAULT
#define EMU_BUPDINIT_DEFAULT

Enumerations

enum  EMU_EM4Osc_TypeDef {
  emuEM4Osc_ULFRCO = EMU_EM4CONF_OSC_ULFRCO,
  emuEM4Osc_LFXO = EMU_EM4CONF_OSC_LFXO,
  emuEM4Osc_LFRCO = EMU_EM4CONF_OSC_LFRCO
}
enum  EMU_Probe_TypeDef {
  emuProbe_Disable = EMU_BUCTRL_PROBE_DISABLE,
  emuProbe_VDDDReg = EMU_BUCTRL_PROBE_VDDDREG,
  emuProbe_BUIN = EMU_BUCTRL_PROBE_BUIN,
  emuProbe_BUOUT = EMU_BUCTRL_PROBE_BUOUT
}
enum  EMU_Resistor_TypeDef {
  emuRes_Res0 = EMU_PWRCONF_PWRRES_RES0,
  emuRes_Res1 = EMU_PWRCONF_PWRRES_RES1,
  emuRes_Res2 = EMU_PWRCONF_PWRRES_RES2,
  emuRes_Res3 = EMU_PWRCONF_PWRRES_RES3
}
enum  EMU_Power_TypeDef {
  emuPower_None = EMU_BUINACT_PWRCON_NONE,
  emuPower_BUMain = EMU_BUINACT_PWRCON_BUMAIN,
  emuPower_MainBU = EMU_BUINACT_PWRCON_MAINBU,
  emuPower_NoDiode = EMU_BUINACT_PWRCON_NODIODE
}
enum  EMU_BODMode_TypeDef {
  emuBODMode_Active,
  emuBODMode_Inactive
}

Functions

__STATIC_INLINE void EMU_EnterEM1 (void)
 Enter energy mode 1 (EM1).
void EMU_EnterEM2 (bool restore)
 Enter energy mode 2 (EM2).
void EMU_EnterEM3 (bool restore)
 Enter energy mode 3 (EM3).
void EMU_EnterEM4 (void)
 Enter energy mode 4 (EM4).
void EMU_MemPwrDown (uint32_t blocks)
 Power down memory block.
void EMU_UpdateOscConfig (void)
 Update EMU module with CMU oscillator selection/enable status.
void EMU_EM4Init (EMU_EM4Init_TypeDef *em4init)
 Update EMU module with Energy Mode 4 configuration.
void EMU_BUPDInit (EMU_BUPDInit_TypeDef *bupdInit)
 Configure Backup Power Domain settings.
void EMU_BUThresholdSet (EMU_BODMode_TypeDef mode, uint32_t value)
 Configure Backup Power Domain BOD Threshold value.
void EMU_BUThresRangeSet (EMU_BODMode_TypeDef mode, uint32_t value)
 Configure Backup Power Domain BOD Threshold Range.
__STATIC_INLINE void EMU_EM4Lock (bool enable)
 Enable or disable EM4 lock configuration.
__STATIC_INLINE void EMU_BUReady (void)
 Halts until backup power functionality is ready.
__STATIC_INLINE void EMU_BUPinEnable (bool enable)
 Disable BU_VIN support.
__STATIC_INLINE void EMU_Lock (void)
 Lock the EMU in order to protect all its registers against unintended modification.
__STATIC_INLINE void EMU_Unlock (void)
 Unlock the EMU so that writing to locked registers again is possible.
__STATIC_INLINE void EMU_EM2Block (void)
 Block entering EM2 or higher number energy modes.
__STATIC_INLINE void EMU_EM2UnBlock (void)
 Unblock entering EM2 or higher number energy modes.

Detailed Description

Energy Management Unit (EMU) Peripheral API.


Define Documentation

#define EMU_BUPDINIT_DEFAULT
Value:
{ emuProbe_Disable, /* Do not enable voltage probe */                     \
    false,            /* Disable BOD calibration mode */                    \
    false,            /* Disable BU_STAT pin for backup mode indication */  \
                                                                            \
    emuRes_Res0,      /* RES0 series resistance between main and backup power */ \
    false,            /* Don't enable strong switch */                           \
    false,            /* Don't enable medium switch */                           \
    false,            /* Don't enable weak switch */                             \
                                                                                 \
    emuPower_None,    /* No connection between main and backup power (inactive mode) */  \
    emuPower_None,    /* No connection between main and backup power (active mode) */    \
    true              /* Enable BUPD enter on BOD, enable BU_VIN pin, release BU reset  */  \
  }

Default

Definition at line 178 of file em_emu.h.

#define EMU_EM4INIT_DEFAULT
Value:
{   false,             /* Dont't lock configuration after it's been set */ \
      emuEM4Osc_ULFRCO,  /* Use default ULFRCO oscillator  */ \
      true,              /* Wake up on EM4 BURTC interrupt */ \
      true,              /* Enable VREG */ \
  }

Default initialization of EM4 configuration

Definition at line 141 of file em_emu.h.


Enumeration Type Documentation

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 115 of file em_emu.h.

EM4 duty oscillator

Enumerator:
emuEM4Osc_ULFRCO 

Select ULFRCO as duty oscillator in EM4

emuEM4Osc_LFXO 

Select LFXO as duty oscillator in EM4

emuEM4Osc_LFRCO 

Select LFRCO as duty oscillator in EM4

Definition at line 63 of file em_emu.h.

Backup Power Domain power connection

Enumerator:
emuPower_None 

No connection between main and backup power

emuPower_BUMain 

Main power and backup power connected through diode, allowing current from backup to main only

emuPower_MainBU 

Main power and backup power connected through diode, allowing current from main to backup only

emuPower_NoDiode 

Main power and backup power connected without diode

Definition at line 100 of file em_emu.h.

Backup Power Voltage Probe types

Enumerator:
emuProbe_Disable 

Disable voltage probe

emuProbe_VDDDReg 

Connect probe to VDD_DREG

emuProbe_BUIN 

Connect probe to BU_IN

emuProbe_BUOUT 

Connect probe to BU_OUT

Definition at line 74 of file em_emu.h.

Backup Power Domain resistor selection

Enumerator:
emuRes_Res0 

Main power and backup power connected with RES0 series resistance

emuRes_Res1 

Main power and backup power connected with RES1 series resistance

emuRes_Res2 

Main power and backup power connected with RES2 series resistance

emuRes_Res3 

Main power and backup power connected with RES3 series resistance

Definition at line 87 of file em_emu.h.


Function Documentation

void EMU_BUPDInit ( EMU_BUPDInit_TypeDef bupdInit  ) 
__STATIC_INLINE void EMU_BUPinEnable ( bool  enable  ) 

Disable BU_VIN support.

Parameters:
[in] enable If true, enables BU_VIN input pin support, if false disables it

Definition at line 247 of file em_emu.h.

References BITBAND_Peripheral().

Referenced by EMU_BUPDInit().

Here is the call graph for this function:

Here is the caller graph for this function:

__STATIC_INLINE void EMU_BUReady ( void   ) 

Halts until backup power functionality is ready.

Definition at line 236 of file em_emu.h.

void EMU_BUThresholdSet ( EMU_BODMode_TypeDef  mode,
uint32_t  value 
)

Configure Backup Power Domain BOD Threshold value.

Note:
These values are precalibrated
Parameters:
[in] mode Active or Inactive mode
[in] value 

Definition at line 609 of file em_emu.c.

References emuBODMode_Active, and emuBODMode_Inactive.

void EMU_BUThresRangeSet ( EMU_BODMode_TypeDef  mode,
uint32_t  value 
)

Configure Backup Power Domain BOD Threshold Range.

Note:
These values are precalibrated
Parameters:
[in] mode Active or Inactive mode
[in] value 

Definition at line 633 of file em_emu.c.

References emuBODMode_Active, and emuBODMode_Inactive.

__STATIC_INLINE void EMU_EM2Block ( void   ) 

Block entering EM2 or higher number energy modes.

Definition at line 283 of file em_emu.h.

References BITBAND_Peripheral().

Here is the call graph for this function:

__STATIC_INLINE void EMU_EM2UnBlock ( void   ) 

Unblock entering EM2 or higher number energy modes.

Definition at line 292 of file em_emu.h.

References BITBAND_Peripheral().

Here is the call graph for this function:

void EMU_EM4Init ( EMU_EM4Init_TypeDef em4init  ) 

Update EMU module with Energy Mode 4 configuration.

Parameters:
[in] em4init Energy Mode 4 configuration structure

Definition at line 518 of file em_emu.c.

References EMU_EM4Init_TypeDef::buRtcWakeup, EMU_EM4Init_TypeDef::lockConfig, EMU_EM4Init_TypeDef::osc, and EMU_EM4Init_TypeDef::vreg.

__STATIC_INLINE void EMU_EM4Lock ( bool  enable  ) 

Enable or disable EM4 lock configuration.

Parameters:
[in] enable If true, locks down EM4 configuration

Definition at line 227 of file em_emu.h.

References BITBAND_Peripheral().

Here is the call graph for this function:

__STATIC_INLINE void EMU_EnterEM1 ( void   ) 

Enter energy mode 1 (EM1).

Definition at line 202 of file em_emu.h.

void EMU_EnterEM2 ( bool  restore  ) 

Enter energy mode 2 (EM2).

When entering EM2, the high frequency clocks are disabled, ie 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 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.
Parameters:
[in] restore 
  • true - restore oscillators and clocks, see function details.
  • false - do not restore oscillators and clocks, see function details.
The restore option should only be used if all clock control is done via the CMU API.

Definition at line 262 of file em_emu.c.

void EMU_EnterEM3 ( bool  restore  ) 

Enter energy mode 3 (EM3).

When entering EM3, the high frequency clocks are disabled by HW, ie HFXO, HFRCO and AUXHFRCO (for AUXHFRCO, see exception note below). In addition, the low frequency clocks, ie LFXO and LFRCO are disabled by SW. 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 another oscillator 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 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 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. Such a feature is however outside the scope of the implementation in this function.
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 thus remain enabled when returning to EM0 regardless of the restore parameter.
Parameters:
[in] restore 
  • true - restore oscillators and clocks, see function details.
  • false - do not restore oscillators and clocks, see function details.
The restore option should only be used if all clock control is done via the CMU API.

Definition at line 361 of file em_emu.c.

References CMU_Lock(), and CMU_Unlock().

Here is the call graph for this function:

void EMU_EnterEM4 ( void   ) 

Enter energy mode 4 (EM4).

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

Definition at line 441 of file em_emu.c.

__STATIC_INLINE void EMU_Lock ( void   ) 

Lock the EMU in order to protect all its registers against unintended modification.

Note:
If locking the EMU registers, they must be unlocked prior to using any EMU API functions modifying EMU registers. 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 264 of file em_emu.h.

Referenced by RMU_ResetCauseClear().

Here is the caller graph for this function:

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, etc. Memory block 0 cannot be disabled. Please refer to the EFM32 reference manual for available memory blocks for a device.
Note:
Only a reset can make the specified memory block(s) available for use after having been powered down. Function will be void for devices not supporting this feature.

Definition at line 472 of file em_emu.c.

__STATIC_INLINE void EMU_Unlock ( void   ) 

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

Definition at line 274 of file em_emu.h.

Referenced by RMU_ResetCauseClear().

Here is the caller graph for this function:

void EMU_UpdateOscConfig ( void   ) 

Update EMU module with CMU oscillator selection/enable status.

When entering EM2 and EM3, the HW may change the core clock oscillator used, as well as disabling some oscillators. The user may optionally select to restore the oscillators after waking up from EM2 and EM3 through the SW API.

However, in order to support this in a safe way, the EMU module must be kept up-to-date on the actual selected configuration. The CMU module must keep the EMU module up-to-date.

This function is mainly intended for internal use by the CMU module, but if the applications changes oscillator configurations without using the CMU API, this function can be used to keep the EMU module up-to-date.

Definition at line 503 of file em_emu.c.

Referenced by CMU_ClockSelectSet(), and CMU_OscillatorEnable().

Here is the caller graph for this function: