CMUEMLIB

Detailed Description

Clock management unit (CMU) Peripheral API.

This module contains functions to control the CMU peripheral of Silicon Labs 32-bit MCUs and SoCs. The CMU controls oscillators and clocks.

Data Structures

struct  CMU_DPLLInit_TypeDef
 
struct  CMU_HFXOInit_TypeDef
 
struct  CMU_LFXOInit_TypeDef
 

Macros

#define CMU_AUXHFRCO_MAX   cmuAUXHFRCOFreq_50M0Hz
 
#define CMU_AUXHFRCO_MIN   cmuAUXHFRCOFreq_1M0Hz
 
#define CMU_DPLL_LFXO_TO_40MHZ
 
#define CMU_HFRCO_MAX   cmuHFRCOFreq_72M0Hz
 
#define CMU_HFRCO_MIN   cmuHFRCOFreq_1M0Hz
 
#define CMU_HFXOINIT_DEFAULT
 
#define CMU_HFXOINIT_EXTERNAL_CLOCK
 
#define CMU_LFXOINIT_DEFAULT
 
#define CMU_LFXOINIT_EXTERNAL_CLOCK
 
#define CMU_USHFRCO_MAX   cmuUSHFRCOFreq_50M0Hz
 
#define CMU_USHFRCO_MIN   cmuUSHFRCOFreq_16M0Hz
 
#define cmuClkDiv_1   1
 
#define cmuClkDiv_1024   1024
 
#define cmuClkDiv_128   128
 
#define cmuClkDiv_16   16
 
#define cmuClkDiv_16384   16384
 
#define cmuClkDiv_2   2
 
#define cmuClkDiv_2048   2048
 
#define cmuClkDiv_256   256
 
#define cmuClkDiv_32   32
 
#define cmuClkDiv_32768   32768
 
#define cmuClkDiv_4   4
 
#define cmuClkDiv_4096   4096
 
#define cmuClkDiv_512   512
 
#define cmuClkDiv_64   64
 
#define cmuClkDiv_8   8
 
#define cmuClkDiv_8192   8192
 

Typedefs

typedef uint32_t CMU_ClkDiv_TypeDef
 
typedef uint32_t CMU_ClkPresc_TypeDef
 

Enumerations

enum  CMU_AUXHFRCOFreq_TypeDef {
  cmuAUXHFRCOFreq_1M0Hz = 1000000U,
  cmuAUXHFRCOFreq_2M0Hz = 2000000U,
  cmuAUXHFRCOFreq_4M0Hz = 4000000U,
  cmuAUXHFRCOFreq_7M0Hz = 7000000U,
  cmuAUXHFRCOFreq_13M0Hz = 13000000U,
  cmuAUXHFRCOFreq_16M0Hz = 16000000U,
  cmuAUXHFRCOFreq_19M0Hz = 19000000U,
  cmuAUXHFRCOFreq_26M0Hz = 26000000U,
  cmuAUXHFRCOFreq_32M0Hz = 32000000U,
  cmuAUXHFRCOFreq_38M0Hz = 38000000U,
  cmuAUXHFRCOFreq_48M0Hz = 48000000U,
  cmuAUXHFRCOFreq_50M0Hz = 50000000U,
  cmuAUXHFRCOFreq_UserDefined = 0
}
 
enum  CMU_Clock_TypeDef {
  cmuClock_HF,
  cmuClock_DBG,
  cmuClock_AUX,
  cmuClock_EXPORT,
  cmuClock_BUS,
  cmuClock_CRYPTO0,
  cmuClock_LDMA,
  cmuClock_QSPI0,
  cmuClock_GPCRC,
  cmuClock_GPIO,
  cmuClock_HFLE,
  cmuClock_PRS,
  cmuClock_HFPER,
  cmuClock_USART0,
  cmuClock_USART1,
  cmuClock_USART2,
  cmuClock_USART3,
  cmuClock_USART4,
  cmuClock_USART5,
  cmuClock_UART0,
  cmuClock_UART1,
  cmuClock_TIMER0,
  cmuClock_TIMER1,
  cmuClock_TIMER2,
  cmuClock_TIMER3,
  cmuClock_TIMER4,
  cmuClock_TIMER5,
  cmuClock_TIMER6,
  cmuClock_WTIMER0,
  cmuClock_WTIMER1,
  cmuClock_WTIMER2,
  cmuClock_WTIMER3,
  cmuClock_CRYOTIMER,
  cmuClock_ACMP0,
  cmuClock_ACMP1,
  cmuClock_ACMP2,
  cmuClock_ACMP3,
  cmuClock_VDAC0,
  cmuClock_IDAC0,
  cmuClock_ADC0,
  cmuClock_ADC1,
  cmuClock_I2C0,
  cmuClock_I2C1,
  cmuClock_I2C2,
  cmuClock_CSEN_HF,
  cmuClock_TRNG0,
  cmuClock_CAN0,
  cmuClock_CAN1,
  cmuClock_CORE,
  cmuClock_EBI,
  cmuClock_ETH,
  cmuClock_SDIO,
  cmuClock_USB,
  cmuClock_LFA,
  cmuClock_RTC,
  cmuClock_LETIMER0,
  cmuClock_LETIMER1,
  cmuClock_LCDpre,
  cmuClock_LCD,
  cmuClock_PCNT0,
  cmuClock_PCNT1,
  cmuClock_PCNT2,
  cmuClock_LESENSE,
  cmuClock_LFB,
  cmuClock_LEUART0,
  cmuClock_CSEN_LF,
  cmuClock_LEUART1,
  cmuClock_SYSTICK,
  cmuClock_LFC,
  cmuClock_USBLE,
  cmuClock_LFE,
  cmuClock_RTCC,
  cmuClock_ADC0ASYNC,
  cmuClock_ADC1ASYNC,
  cmuClock_SDIOREF,
  cmuClock_QSPI0REF
}
 
enum  CMU_DPLLClkSel_TypeDef {
  cmuDPLLClkSel_Hfxo = _CMU_DPLLCTRL_REFSEL_HFXO,
  cmuDPLLClkSel_Lfxo = _CMU_DPLLCTRL_REFSEL_LFXO,
  cmuDPLLClkSel_Clkin0 = _CMU_DPLLCTRL_REFSEL_CLKIN0
}
 
enum  CMU_DPLLEdgeSel_TypeDef {
  cmuDPLLEdgeSel_Fall = _CMU_DPLLCTRL_EDGESEL_FALL,
  cmuDPLLEdgeSel_Rise = _CMU_DPLLCTRL_EDGESEL_RISE
}
 
enum  CMU_DPLLLockMode_TypeDef {
  cmuDPLLLockMode_Freq = _CMU_DPLLCTRL_MODE_FREQLL,
  cmuDPLLLockMode_Phase = _CMU_DPLLCTRL_MODE_PHASELL
}
 
enum  CMU_HFRCOFreq_TypeDef {
  cmuHFRCOFreq_1M0Hz = 1000000U,
  cmuHFRCOFreq_2M0Hz = 2000000U,
  cmuHFRCOFreq_4M0Hz = 4000000U,
  cmuHFRCOFreq_7M0Hz = 7000000U,
  cmuHFRCOFreq_13M0Hz = 13000000U,
  cmuHFRCOFreq_16M0Hz = 16000000U,
  cmuHFRCOFreq_19M0Hz = 19000000U,
  cmuHFRCOFreq_26M0Hz = 26000000U,
  cmuHFRCOFreq_32M0Hz = 32000000U,
  cmuHFRCOFreq_38M0Hz = 38000000U,
  cmuHFRCOFreq_48M0Hz = 48000000U,
  cmuHFRCOFreq_56M0Hz = 56000000U,
  cmuHFRCOFreq_64M0Hz = 64000000U,
  cmuHFRCOFreq_72M0Hz = 72000000U,
  cmuHFRCOFreq_UserDefined = 0
}
 
enum  CMU_HFXOTuningMode_TypeDef {
  cmuHFXOTuningMode_Auto = 0,
  cmuHFXOTuningMode_PeakDetectCommand = CMU_CMD_HFXOPEAKDETSTART
}
 
enum  CMU_Osc_TypeDef {
  cmuOsc_LFXO,
  cmuOsc_LFRCO,
  cmuOsc_HFXO,
  cmuOsc_HFRCO,
  cmuOsc_AUXHFRCO,
  cmuOsc_USHFRCO,
  cmuOsc_ULFRCO
}
 
enum  CMU_OscMode_TypeDef {
  cmuOscMode_Crystal,
  cmuOscMode_AcCoupled,
  cmuOscMode_External
}
 
enum  CMU_Select_TypeDef {
  cmuSelect_Error,
  cmuSelect_Disabled,
  cmuSelect_LFXO,
  cmuSelect_LFRCO,
  cmuSelect_HFXO,
  cmuSelect_HFRCO,
  cmuSelect_HFCLKLE,
  cmuSelect_AUXHFRCO,
  cmuSelect_HFSRCCLK,
  cmuSelect_HFCLK,
  cmuSelect_USHFRCO,
  cmuSelect_HFXOX2,
  cmuSelect_ULFRCO
}
 
enum  CMU_USHFRCOFreq_TypeDef {
  cmuUSHFRCOFreq_16M0Hz = 16000000U,
  cmuUSHFRCOFreq_32M0Hz = 32000000U,
  cmuUSHFRCOFreq_48M0Hz = 48000000U,
  cmuUSHFRCOFreq_50M0Hz = 50000000U,
  cmuUSHFRCOFreq_UserDefined = 0
}
 

Functions

CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOBandGet (void)
 Get current AUXHFRCO frequency.
 
void CMU_AUXHFRCOBandSet (CMU_AUXHFRCOFreq_TypeDef setFreq)
 Set AUXHFRCO calibration for the selected target frequency.
 
static uint32_t CMU_AUXHFRCODevinfoGet (CMU_AUXHFRCOFreq_TypeDef freq)
 Get the AUXHFRCO frequency calibration word in DEVINFO.
 
__STATIC_INLINE CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOFreqGet (void)
 Get current AUXHFRCO frequency.
 
__STATIC_INLINE void CMU_AUXHFRCOFreqSet (CMU_AUXHFRCOFreq_TypeDef setFreq)
 Set AUXHFRCO calibration for the selected target frequency.
 
uint32_t CMU_Calibrate (uint32_t HFCycles, CMU_Osc_TypeDef reference)
 Calibrate clock.
 
void CMU_CalibrateConfig (uint32_t downCycles, CMU_Osc_TypeDef downSel, CMU_Osc_TypeDef upSel)
 Configure clock calibration.
 
__STATIC_INLINE void CMU_CalibrateCont (bool enable)
 Configures continuous calibration mode.
 
uint32_t CMU_CalibrateCountGet (void)
 Get calibration count register.
 
__STATIC_INLINE void CMU_CalibrateStart (void)
 Starts calibration.
 
__STATIC_INLINE void CMU_CalibrateStop (void)
 Stop the calibration counters.
 
CMU_ClkDiv_TypeDef CMU_ClockDivGet (CMU_Clock_TypeDef clock)
 Get clock divisor/prescaler.
 
void CMU_ClockDivSet (CMU_Clock_TypeDef clock, CMU_ClkDiv_TypeDef div)
 Set clock divisor/prescaler.
 
void CMU_ClockEnable (CMU_Clock_TypeDef clock, bool enable)
 Enable/disable a clock.
 
uint32_t CMU_ClockFreqGet (CMU_Clock_TypeDef clock)
 Get clock frequency for a clock point.
 
uint32_t CMU_ClockPrescGet (CMU_Clock_TypeDef clock)
 Get clock prescaler.
 
void CMU_ClockPrescSet (CMU_Clock_TypeDef clock, CMU_ClkPresc_TypeDef presc)
 Set clock prescaler.
 
CMU_Select_TypeDef CMU_ClockSelectGet (CMU_Clock_TypeDef clock)
 Get currently selected reference clock used for a clock branch.
 
void CMU_ClockSelectSet (CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
 Select reference clock/oscillator used for a clock branch.
 
__STATIC_INLINE uint32_t CMU_DivToLog2 (CMU_ClkDiv_TypeDef div)
 Convert dividend to logarithmic value. Only works for even numbers equal to 2^n.
 
bool CMU_DPLLLock (CMU_DPLLInit_TypeDef *init)
 Lock the DPLL to a given frequency.
 
__STATIC_INLINE void CMU_DPLLUnlock (void)
 Unlock the DPLL.
 
void CMU_FreezeEnable (bool enable)
 CMU low frequency register synchronization freeze control.
 
CMU_HFRCOFreq_TypeDef CMU_HFRCOBandGet (void)
 Get current HFRCO frequency.
 
void CMU_HFRCOBandSet (CMU_HFRCOFreq_TypeDef setFreq)
 Set HFRCO calibration for the selected target frequency.
 
static uint32_t CMU_HFRCODevinfoGet (CMU_HFRCOFreq_TypeDef freq)
 Get the HFRCO frequency calibration word in DEVINFO.
 
__STATIC_INLINE CMU_HFRCOFreq_TypeDef CMU_HFRCOFreqGet (void)
 Get current HFRCO frequency.
 
__STATIC_INLINE void CMU_HFRCOFreqSet (CMU_HFRCOFreq_TypeDef setFreq)
 Set HFRCO calibration for the selected target frequency.
 
void CMU_HFXOAutostartEnable (uint32_t userSel, bool enEM0EM1Start, bool enEM0EM1StartSel)
 Enable or disable HFXO autostart.
 
void CMU_HFXOInit (const CMU_HFXOInit_TypeDef *hfxoInit)
 Set HFXO control registers.
 
__STATIC_INLINE void CMU_IntClear (uint32_t flags)
 Clear one or more pending CMU interrupts.
 
__STATIC_INLINE void CMU_IntDisable (uint32_t flags)
 Disable one or more CMU interrupts.
 
__STATIC_INLINE void CMU_IntEnable (uint32_t flags)
 Enable one or more CMU interrupts.
 
__STATIC_INLINE uint32_t CMU_IntGet (void)
 Get pending CMU interrupts.
 
__STATIC_INLINE uint32_t CMU_IntGetEnabled (void)
 Get enabled and pending CMU interrupt flags.
 
__STATIC_INLINE void CMU_IntSet (uint32_t flags)
 Set one or more pending CMU interrupts.
 
uint32_t CMU_LCDClkFDIVGet (void)
 Get the LCD framerate divisor (FDIV) setting.
 
void CMU_LCDClkFDIVSet (uint32_t div)
 Set the LCD framerate divisor (FDIV) setting.
 
void CMU_LFXOInit (const CMU_LFXOInit_TypeDef *lfxoInit)
 Set LFXO control registers.
 
__STATIC_INLINE void CMU_Lock (void)
 Lock the CMU in order to protect some of its registers against unintended modification.
 
__STATIC_INLINE uint32_t CMU_Log2ToDiv (uint32_t log2)
 Convert logarithm of 2 prescaler to division factor.
 
void CMU_OscillatorEnable (CMU_Osc_TypeDef osc, bool enable, bool wait)
 Enable/disable oscillator.
 
uint32_t CMU_OscillatorTuningGet (CMU_Osc_TypeDef osc)
 Get oscillator frequency tuning setting.
 
bool CMU_OscillatorTuningOptimize (CMU_Osc_TypeDef osc, CMU_HFXOTuningMode_TypeDef mode, bool wait)
 Start and optionally wait for oscillator tuning optimization.
 
void CMU_OscillatorTuningSet (CMU_Osc_TypeDef osc, uint32_t val)
 Set the oscillator frequency tuning control.
 
bool CMU_OscillatorTuningWait (CMU_Osc_TypeDef osc, CMU_HFXOTuningMode_TypeDef mode)
 Wait for oscillator tuning optimization.
 
bool CMU_PCNTClockExternalGet (unsigned int instance)
 Determine if currently selected PCNTn clock used is external or LFBCLK.
 
void CMU_PCNTClockExternalSet (unsigned int instance, bool external)
 Select PCNTn clock.
 
__STATIC_INLINE uint32_t CMU_PrescToLog2 (CMU_ClkPresc_TypeDef presc)
 Convert prescaler dividend to logarithmic value. Only works for even numbers equal to 2^n.
 
__STATIC_INLINE void CMU_Unlock (void)
 Unlock the CMU so that writing to locked registers again is possible.
 
void CMU_UpdateWaitStates (uint32_t freq, int vscale)
 
CMU_USHFRCOFreq_TypeDef CMU_USHFRCOBandGet (void)
 Get current USHFRCO frequency.
 
void CMU_USHFRCOBandSet (CMU_USHFRCOFreq_TypeDef setFreq)
 Set USHFRCO calibration for the selected target frequency.
 
static uint32_t CMU_USHFRCODevinfoGet (CMU_USHFRCOFreq_TypeDef freq)
 Get the USHFRCO frequency calibration word in DEVINFO.
 

Macro Definition Documentation

#define CMU_DPLL_LFXO_TO_40MHZ
Value:
{ \
39998805, /* Target frequency. */ \
3661, /* Factor N. */ \
2, /* Factor M. */ \
0, /* No spread spectrum clocking. */ \
0, /* No spread spectrum clocking. */ \
cmuDPLLClkSel_Lfxo, /* Select LFXO as reference clock. */ \
cmuDPLLEdgeSel_Fall, /* Select falling edge of ref clock. */ \
cmuDPLLLockMode_Freq, /* Use frequency lock mode. */ \
true /* Enable automatic lock recovery. */ \
}

DPLL initialization values for 39,998,805 Hz using LFXO as reference clock, M=2 and N=3661.

Definition at line 1550 of file em_cmu.h.

#define CMU_HFXOINIT_DEFAULT
Value:
{ \
_CMU_HFXOSTARTUPCTRL_CTUNE_DEFAULT, \
_CMU_HFXOSTEADYSTATECTRL_CTUNE_DEFAULT, \
_CMU_HFXOSTARTUPCTRL_IBTRIMXOCORE_DEFAULT, \
_CMU_HFXOSTEADYSTATECTRL_IBTRIMXOCORE_DEFAULT, \
_CMU_HFXOTIMEOUTCTRL_PEAKDETTIMEOUT_DEFAULT, \
_CMU_HFXOTIMEOUTCTRL_STEADYTIMEOUT_DEFAULT, \
_CMU_HFXOTIMEOUTCTRL_STARTUPTIMEOUT_DEFAULT, \
cmuOscMode_Crystal, \
}

Definition at line 1428 of file em_cmu.h.

#define CMU_HFXOINIT_EXTERNAL_CLOCK
Value:
{ \
_CMU_HFXOSTARTUPCTRL_CTUNE_DEFAULT, \
_CMU_HFXOSTEADYSTATECTRL_CTUNE_DEFAULT, \
_CMU_HFXOSTARTUPCTRL_IBTRIMXOCORE_DEFAULT, \
_CMU_HFXOSTEADYSTATECTRL_IBTRIMXOCORE_DEFAULT, \
_CMU_HFXOTIMEOUTCTRL_PEAKDETTIMEOUT_DEFAULT, \
_CMU_HFXOTIMEOUTCTRL_STEADYTIMEOUT_DEFAULT, \
_CMU_HFXOTIMEOUTCTRL_STARTUPTIMEOUT_DEFAULT, \
cmuOscMode_External, \
}

Definition at line 1439 of file em_cmu.h.

#define CMU_LFXOINIT_DEFAULT
Value:
{ \
_CMU_LFXOCTRL_TUNING_DEFAULT, /* Default CTUNE value, 0 */ \
_CMU_LFXOCTRL_GAIN_DEFAULT, /* Default gain, 2 */ \
_CMU_LFXOCTRL_TIMEOUT_DEFAULT, /* Default start-up delay, 32k cycles */ \
cmuOscMode_Crystal, /* Crystal oscillator */ \
}

Default LFXO initialization values for platform 2 devices which contain a separate LFXOCTRL register.

Definition at line 1363 of file em_cmu.h.

#define CMU_LFXOINIT_EXTERNAL_CLOCK
Value:
{ \
0, /* No CTUNE value needed */ \
0, /* No LFXO startup gain */ \
_CMU_LFXOCTRL_TIMEOUT_2CYCLES, /* Minimal lfxo start-up delay, 2 cycles */ \
cmuOscMode_External, /* External digital clock */ \
}

Definition at line 1370 of file em_cmu.h.

#define cmuClkDiv_1   1

Clock divisors. These values are valid for prescalers. Divide clock by 1.

Definition at line 177 of file em_cmu.h.

Referenced by CAPLESENSE_setupCMU(), CMU_ClockDivGet(), CMU_ClockDivSet(), and RETARGET_SerialInit().

#define cmuClkDiv_1024   1024

Divide clock by 1024.

Definition at line 187 of file em_cmu.h.

#define cmuClkDiv_128   128

Divide clock by 128.

Definition at line 184 of file em_cmu.h.

Referenced by CMU_ClockDivSet(), and CMU_LCDClkFDIVSet().

#define cmuClkDiv_16   16

Divide clock by 16.

Definition at line 181 of file em_cmu.h.

Referenced by CMU_ClockDivGet(), CMU_ClockDivSet(), and CMU_ClockFreqGet().

#define cmuClkDiv_16384   16384

Divide clock by 16384.

Definition at line 191 of file em_cmu.h.

#define cmuClkDiv_2   2

Divide clock by 2.

Definition at line 178 of file em_cmu.h.

#define cmuClkDiv_2048   2048

Divide clock by 2048.

Definition at line 188 of file em_cmu.h.

#define cmuClkDiv_256   256

Divide clock by 256.

Definition at line 185 of file em_cmu.h.

Referenced by UDELAY_Calibrate().

#define cmuClkDiv_32   32

Divide clock by 32.

Definition at line 182 of file em_cmu.h.

#define cmuClkDiv_32768   32768

Divide clock by 32768.

Definition at line 192 of file em_cmu.h.

Referenced by CMU_ClockDivSet().

#define cmuClkDiv_4   4

Divide clock by 4.

Definition at line 179 of file em_cmu.h.

#define cmuClkDiv_4096   4096

Divide clock by 4096.

Definition at line 189 of file em_cmu.h.

#define cmuClkDiv_512   512

Divide clock by 512.

Definition at line 186 of file em_cmu.h.

Referenced by CMU_ClockDivSet().

#define cmuClkDiv_64   64

Divide clock by 64.

Definition at line 183 of file em_cmu.h.

#define cmuClkDiv_8   8

Divide clock by 8.

Definition at line 180 of file em_cmu.h.

Referenced by CMU_ClockDivSet().

#define cmuClkDiv_8192   8192

Divide clock by 8192.

Definition at line 190 of file em_cmu.h.

Typedef Documentation

typedef uint32_t CMU_ClkDiv_TypeDef

Clock divider configuration

Definition at line 195 of file em_cmu.h.

typedef uint32_t CMU_ClkPresc_TypeDef

Clockprescaler configuration

Definition at line 199 of file em_cmu.h.

Enumeration Type Documentation

AUX High frequency RCO bands

Enumerator
cmuAUXHFRCOFreq_1M0Hz 

1MHz RC band

cmuAUXHFRCOFreq_2M0Hz 

2MHz RC band

cmuAUXHFRCOFreq_4M0Hz 

4MHz RC band

cmuAUXHFRCOFreq_7M0Hz 

7MHz RC band

cmuAUXHFRCOFreq_13M0Hz 

13MHz RC band

cmuAUXHFRCOFreq_16M0Hz 

16MHz RC band

cmuAUXHFRCOFreq_19M0Hz 

19MHz RC band

cmuAUXHFRCOFreq_26M0Hz 

26MHz RC band

cmuAUXHFRCOFreq_32M0Hz 

32MHz RC band

cmuAUXHFRCOFreq_38M0Hz 

38MHz RC band

cmuAUXHFRCOFreq_48M0Hz 

48MHz RC band

cmuAUXHFRCOFreq_50M0Hz 

50MHz RC band

Definition at line 296 of file em_cmu.h.

Clock points in CMU. Please refer to CMU overview in reference manual.

Enumerator
cmuClock_HF 

High frequency clock

cmuClock_DBG 

Debug clock

cmuClock_AUX 

AUX clock

cmuClock_EXPORT 

Export clock

cmuClock_BUS 

High frequency bus clock.

cmuClock_CRYPTO0 

Cryptography accelerator 0 clock.

cmuClock_LDMA 

Direct memory access controller clock.

cmuClock_QSPI0 

Quad SPI clock.

cmuClock_GPCRC 

General purpose cyclic redundancy checksum clock.

cmuClock_GPIO 

General purpose input/output clock.

cmuClock_HFLE 

Low energy clock divided down from HFBUSCLK.

cmuClock_PRS 

Peripheral reflex system clock.

cmuClock_HFPER 

High frequency peripheral clock

cmuClock_USART0 

Universal sync/async receiver/transmitter 0 clock.

cmuClock_USART1 

Universal sync/async receiver/transmitter 1 clock.

cmuClock_USART2 

Universal sync/async receiver/transmitter 2 clock.

cmuClock_USART3 

Universal sync/async receiver/transmitter 3 clock.

cmuClock_USART4 

Universal sync/async receiver/transmitter 4 clock.

cmuClock_USART5 

Universal sync/async receiver/transmitter 5 clock.

cmuClock_UART0 

Universal async receiver/transmitter 0 clock.

cmuClock_UART1 

Universal async receiver/transmitter 1 clock.

cmuClock_TIMER0 

Timer 0 clock.

cmuClock_TIMER1 

Timer 1 clock.

cmuClock_TIMER2 

Timer 2 clock.

cmuClock_TIMER3 

Timer 3 clock.

cmuClock_TIMER4 

Timer 4 clock.

cmuClock_TIMER5 

Timer 5 clock.

cmuClock_TIMER6 

Timer 6 clock.

cmuClock_WTIMER0 

Wide Timer 0 clock.

cmuClock_WTIMER1 

Wide Timer 1 clock.

cmuClock_WTIMER2 

Wide Timer 2 clock.

cmuClock_WTIMER3 

Wide Timer 3 clock.

cmuClock_CRYOTIMER 

CRYOtimer clock.

cmuClock_ACMP0 

Analog comparator 0 clock.

cmuClock_ACMP1 

Analog comparator 1 clock.

cmuClock_ACMP2 

Analog comparator 2 clock.

cmuClock_ACMP3 

Analog comparator 3 clock.

cmuClock_VDAC0 

Voltage digital to analog converter 0 clock.

cmuClock_IDAC0 

Current digital to analog converter 0 clock.

cmuClock_ADC0 

Analog to digital converter 0 clock.

cmuClock_ADC1 

Analog to digital converter 1 clock.

cmuClock_I2C0 

I2C 0 clock.

cmuClock_I2C1 

I2C 1 clock.

cmuClock_I2C2 

I2C 2 clock.

cmuClock_CSEN_HF 

Capacitive Sense HF clock

cmuClock_TRNG0 

True random number generator clock

cmuClock_CAN0 

Controller Area Network 0 clock.

cmuClock_CAN1 

Controller Area Network 1 clock.

cmuClock_CORE 

Core clock

cmuClock_EBI 

External bus interface clock.

cmuClock_ETH 

Ethernet clock.

cmuClock_SDIO 

SDIO clock.

cmuClock_USB 

USB clock.

cmuClock_LFA 

Low frequency A clock

cmuClock_RTC 

Real time counter clock.

cmuClock_LETIMER0 

Low energy timer 0 clock.

cmuClock_LETIMER1 

Low energy timer 1 clock.

cmuClock_LCDpre 

Liquid crystal display, pre FDIV clock.

cmuClock_LCD 

Liquid crystal display clock. Please notice that FDIV prescaler must be set by special API.

cmuClock_PCNT0 

Pulse counter 0 clock.

cmuClock_PCNT1 

Pulse counter 1 clock.

cmuClock_PCNT2 

Pulse counter 2 clock.

cmuClock_LESENSE 

LESENSE clock.

cmuClock_LFB 

Low frequency B clock

cmuClock_LEUART0 

Low energy universal asynchronous receiver/transmitter 0 clock.

cmuClock_CSEN_LF 

Capacitive Sense LF clock.

cmuClock_LEUART1 

Low energy universal asynchronous receiver/transmitter 1 clock.

cmuClock_SYSTICK 

Cortex SYSTICK LF clock.

cmuClock_LFC 

Low frequency C clock

cmuClock_USBLE 

USB LE clock.

cmuClock_LFE 

Low frequency E clock

cmuClock_RTCC 

Real-time counter and calendar clock.

cmuClock_ADC0ASYNC 

ADC0 asynchronous clock.

cmuClock_ADC1ASYNC 

ADC1 asynchronous clock.

cmuClock_SDIOREF 

SDIO reference clock.

cmuClock_QSPI0REF 

QSPI0 reference clock.

Definition at line 326 of file em_cmu.h.

DPLL reference clock selector.

Enumerator
cmuDPLLClkSel_Hfxo 

HFXO is DPLL reference clock.

cmuDPLLClkSel_Lfxo 

LFXO is DPLL reference clock.

cmuDPLLClkSel_Clkin0 

CLKIN0 is DPLL reference clock.

Definition at line 1324 of file em_cmu.h.

DPLL reference clock edge detect selector.

Enumerator
cmuDPLLEdgeSel_Fall 

Detect falling edge of reference clock.

cmuDPLLEdgeSel_Rise 

Detect rising edge of reference clock.

Definition at line 1331 of file em_cmu.h.

DPLL lock mode selector.

Enumerator
cmuDPLLLockMode_Freq 

Frequency lock mode.

cmuDPLLLockMode_Phase 

Phase lock mode.

Definition at line 1337 of file em_cmu.h.

High frequency system RCO bands

Enumerator
cmuHFRCOFreq_1M0Hz 

1MHz RC band

cmuHFRCOFreq_2M0Hz 

2MHz RC band

cmuHFRCOFreq_4M0Hz 

4MHz RC band

cmuHFRCOFreq_7M0Hz 

7MHz RC band

cmuHFRCOFreq_13M0Hz 

13MHz RC band

cmuHFRCOFreq_16M0Hz 

16MHz RC band

cmuHFRCOFreq_19M0Hz 

19MHz RC band

cmuHFRCOFreq_26M0Hz 

26MHz RC band

cmuHFRCOFreq_32M0Hz 

32MHz RC band

cmuHFRCOFreq_38M0Hz 

38MHz RC band

cmuHFRCOFreq_48M0Hz 

48MHz RC band

cmuHFRCOFreq_56M0Hz 

56MHz RC band

cmuHFRCOFreq_64M0Hz 

64MHz RC band

cmuHFRCOFreq_72M0Hz 

72MHz RC band

Definition at line 255 of file em_cmu.h.

HFXO tuning modes

Enumerator
cmuHFXOTuningMode_PeakDetectCommand 

Run peak detect optimization only

Definition at line 1299 of file em_cmu.h.

Oscillator types.

Enumerator
cmuOsc_LFXO 

Low frequency crystal oscillator.

cmuOsc_LFRCO 

Low frequency RC oscillator.

cmuOsc_HFXO 

High frequency crystal oscillator.

cmuOsc_HFRCO 

High frequency RC oscillator.

cmuOsc_AUXHFRCO 

Auxiliary high frequency RC oscillator.

cmuOsc_USHFRCO 

USB high frequency RC oscillator

cmuOsc_ULFRCO 

Ultra low frequency RC oscillator.

Definition at line 1236 of file em_cmu.h.

Oscillator modes.

Enumerator
cmuOscMode_Crystal 

Crystal oscillator.

cmuOscMode_AcCoupled 

AC coupled buffer.

cmuOscMode_External 

External digital clock.

Definition at line 1254 of file em_cmu.h.

Selectable clock sources.

Enumerator
cmuSelect_Error 

Usage error.

cmuSelect_Disabled 

Clock selector disabled.

cmuSelect_LFXO 

Low frequency crystal oscillator.

cmuSelect_LFRCO 

Low frequency RC oscillator.

cmuSelect_HFXO 

High frequency crystal oscillator.

cmuSelect_HFRCO 

High frequency RC oscillator.

cmuSelect_HFCLKLE 

High frequency LE clock divided by 2 or 4.

cmuSelect_AUXHFRCO 

Auxilliary clock source can be used for debug clock

cmuSelect_HFSRCCLK 

High frequency source clock

cmuSelect_HFCLK 

Divided HFCLK on Giant for debug clock, undivided on Tiny Gecko and for USBC (not used on Gecko)

cmuSelect_USHFRCO 

USB high frequency RC oscillator

cmuSelect_HFXOX2 

High frequency crystal oscillator x 2.

cmuSelect_ULFRCO 

Ultra low frequency RC oscillator.

Definition at line 1261 of file em_cmu.h.

High USHFRCO bands

Enumerator
cmuUSHFRCOFreq_16M0Hz 

16MHz RC band

cmuUSHFRCOFreq_32M0Hz 

32MHz RC band

cmuUSHFRCOFreq_48M0Hz 

48MHz RC band

cmuUSHFRCOFreq_50M0Hz 

50MHz RC band

Definition at line 242 of file em_cmu.h.

Function Documentation

CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOBandGet ( void  )

Get current AUXHFRCO frequency.

Returns
AUXHFRCO frequency

Definition at line 1376 of file em_cmu.c.

Referenced by CMU_AUXHFRCOFreqGet().

void CMU_AUXHFRCOBandSet ( CMU_AUXHFRCOFreq_TypeDef  setFreq)

Set AUXHFRCO calibration for the selected target frequency.

Parameters
[in]setFreqAUXHFRCO frequency to set

Definition at line 1390 of file em_cmu.c.

References _CMU_AUXHFRCOCTRL_CLKDIV_MASK, _CMU_SYNCBUSY_AUXHFRCOBSY_SHIFT, BUS_RegBitRead(), CMU, CMU_AUXHFRCOCTRL_CLKDIV_DIV1, CMU_AUXHFRCOCTRL_CLKDIV_DIV2, CMU_AUXHFRCOCTRL_CLKDIV_DIV4, CMU_AUXHFRCODevinfoGet(), cmuAUXHFRCOFreq_1M0Hz, cmuAUXHFRCOFreq_2M0Hz, and cmuAUXHFRCOFreq_4M0Hz.

Referenced by CMU_AUXHFRCOFreqSet().

static uint32_t CMU_AUXHFRCODevinfoGet ( CMU_AUXHFRCOFreq_TypeDef  freq)
static

Get the AUXHFRCO frequency calibration word in DEVINFO.

Parameters
[in]freqFrequency in Hz
Returns
AUXHFRCO calibration word for a given frequency

Definition at line 1323 of file em_cmu.c.

References cmuAUXHFRCOFreq_13M0Hz, cmuAUXHFRCOFreq_16M0Hz, cmuAUXHFRCOFreq_19M0Hz, cmuAUXHFRCOFreq_1M0Hz, cmuAUXHFRCOFreq_26M0Hz, cmuAUXHFRCOFreq_2M0Hz, cmuAUXHFRCOFreq_32M0Hz, cmuAUXHFRCOFreq_38M0Hz, cmuAUXHFRCOFreq_48M0Hz, cmuAUXHFRCOFreq_4M0Hz, cmuAUXHFRCOFreq_50M0Hz, cmuAUXHFRCOFreq_7M0Hz, and DEVINFO.

Referenced by CMU_AUXHFRCOBandSet().

__STATIC_INLINE CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOFreqGet ( void  )

Get current AUXHFRCO frequency.

Deprecated:
Deprecated function. New code should use CMU_AUXHFRCOBandGet().
Returns
AUXHFRCO frequency

Definition at line 1932 of file em_cmu.h.

References CMU_AUXHFRCOBandGet().

__STATIC_INLINE void CMU_AUXHFRCOFreqSet ( CMU_AUXHFRCOFreq_TypeDef  setFreq)

Set AUXHFRCO calibration for the selected target frequency.

Deprecated:
Deprecated function. New code should use CMU_AUXHFRCOBandSet().
Parameters
[in]setFreqAUXHFRCO frequency to set

Definition at line 1947 of file em_cmu.h.

References CMU_AUXHFRCOBandSet().

uint32_t CMU_Calibrate ( uint32_t  HFCycles,
CMU_Osc_TypeDef  reference 
)

Calibrate clock.

Run a calibration for HFCLK against a selectable reference clock. Please refer to the reference manual, CMU chapter, for further details.

Note
This function will not return until calibration measurement is completed.
Parameters
[in]HFCyclesThe number of HFCLK cycles to run calibration. Increasing this number increases precision, but the calibration will take more time.
[in]refThe reference clock used to compare HFCLK with.
Returns
The number of ticks the reference clock after HFCycles ticks on the HF clock.

Definition at line 1451 of file em_cmu.c.

References _CMU_CALCNT_CALCNT_MASK, _CMU_CALCNT_CALCNT_SHIFT, _CMU_STATUS_CALRDY_SHIFT, BUS_RegBitRead(), CMU, CMU_CALCTRL_UPSEL_AUXHFRCO, CMU_CALCTRL_UPSEL_HFRCO, CMU_CALCTRL_UPSEL_HFXO, CMU_CALCTRL_UPSEL_LFRCO, CMU_CALCTRL_UPSEL_LFXO, CMU_CALCTRL_UPSEL_USHFRCO, CMU_CMD_CALSTART, cmuOsc_AUXHFRCO, cmuOsc_HFRCO, cmuOsc_HFXO, cmuOsc_LFRCO, cmuOsc_LFXO, and cmuOsc_USHFRCO.

void CMU_CalibrateConfig ( uint32_t  downCycles,
CMU_Osc_TypeDef  downSel,
CMU_Osc_TypeDef  upSel 
)

Configure clock calibration.

Configure a calibration for a selectable clock source against another selectable reference clock. Refer to the reference manual, CMU chapter, for further details.

Note
After configuration, a call to CMU_CalibrateStart() is required, and the resulting calibration value can be read out with the CMU_CalibrateCountGet() function call.
Parameters
[in]downCyclesThe number of downSel clock cycles to run calibration. Increasing this number increases precision, but the calibration will take more time.
[in]downSelThe clock which will be counted down downCycles
[in]upSelThe reference clock, the number of cycles generated by this clock will be counted and added up, the result can be given with the CMU_CalibrateCountGet() function call.

Definition at line 1534 of file em_cmu.c.

References _CMU_CALCNT_CALCNT_MASK, _CMU_CALCNT_CALCNT_SHIFT, _CMU_CALCTRL_DOWNSEL_MASK, _CMU_CALCTRL_UPSEL_MASK, CMU, CMU_CALCTRL_DOWNSEL_AUXHFRCO, CMU_CALCTRL_DOWNSEL_HFRCO, CMU_CALCTRL_DOWNSEL_HFXO, CMU_CALCTRL_DOWNSEL_LFRCO, CMU_CALCTRL_DOWNSEL_LFXO, CMU_CALCTRL_DOWNSEL_USHFRCO, CMU_CALCTRL_UPSEL_AUXHFRCO, CMU_CALCTRL_UPSEL_HFRCO, CMU_CALCTRL_UPSEL_HFXO, CMU_CALCTRL_UPSEL_LFRCO, CMU_CALCTRL_UPSEL_LFXO, CMU_CALCTRL_UPSEL_USHFRCO, cmuOsc_AUXHFRCO, cmuOsc_HFRCO, cmuOsc_HFXO, cmuOsc_LFRCO, cmuOsc_LFXO, and cmuOsc_USHFRCO.

__STATIC_INLINE void CMU_CalibrateCont ( bool  enable)

Configures continuous calibration mode.

Parameters
[in]enableIf true, enables continuous calibration, if false disables continuous calibrartion

Definition at line 1662 of file em_cmu.h.

References _CMU_CALCTRL_CONT_SHIFT, BUS_RegBitWrite(), and CMU.

uint32_t CMU_CalibrateCountGet ( void  )

Get calibration count register.

Note
If continuous calibrartion mode is active, calibration busy will almost always be off, and we just need to read the value, where the normal case would be that this function call has been triggered by the CALRDY interrupt flag.
Returns
Calibration count, the number of UPSEL clocks (see CMU_CalibrateConfig()) in the period of DOWNSEL oscillator clock cycles configured by a previous write operation to CMU->CALCNT

Definition at line 1630 of file em_cmu.c.

References _CMU_CALCTRL_CONT_SHIFT, _CMU_STATUS_CALRDY_SHIFT, BUS_RegBitRead(), and CMU.

__STATIC_INLINE void CMU_CalibrateStart ( void  )

Starts calibration.

Note
This call is usually invoked after CMU_CalibrateConfig() and possibly CMU_CalibrateCont()

Definition at line 1675 of file em_cmu.h.

References CMU, and CMU_CMD_CALSTART.

CMU_ClkDiv_TypeDef CMU_ClockDivGet ( CMU_Clock_TypeDef  clock)

Get clock divisor/prescaler.

Parameters
[in]clockClock point to get divisor/prescaler for. Notice that not all clock points have a divisor/prescaler. Please refer to CMU overview in reference manual.
Returns
The current clock point divisor/prescaler. 1 is returned if clock specifies a clock point without a divisor/prescaler.

Definition at line 1665 of file em_cmu.c.

References _CMU_LFAPRESC0_LCD_MASK, _CMU_LFAPRESC0_LCD_SHIFT, _CMU_LFAPRESC0_LESENSE_MASK, _CMU_LFAPRESC0_LESENSE_SHIFT, _CMU_LFAPRESC0_LETIMER0_MASK, _CMU_LFAPRESC0_LETIMER0_SHIFT, _CMU_LFAPRESC0_RTC_MASK, _CMU_LFAPRESC0_RTC_SHIFT, _CMU_LFBPRESC0_LEUART0_MASK, _CMU_LFBPRESC0_LEUART0_SHIFT, _CMU_LFBPRESC0_LEUART1_MASK, _CMU_LFBPRESC0_LEUART1_SHIFT, CMU, CMU_ClockPrescGet(), CMU_DivToLog2(), CMU_Log2ToDiv(), cmuClkDiv_1, cmuClkDiv_16, cmuClock_LCDpre, cmuClock_LESENSE, cmuClock_LETIMER0, cmuClock_LEUART0, cmuClock_LEUART1, and cmuClock_RTC.

Referenced by UDELAY_Calibrate().

void CMU_ClockDivSet ( CMU_Clock_TypeDef  clock,
CMU_ClkDiv_TypeDef  div 
)

Set clock divisor/prescaler.

Note
If setting a LF clock prescaler, synchronization into the low frequency domain is required. If the same register is modified before a previous update has completed, this function will stall until the previous synchronization has completed. Please refer to CMU_FreezeEnable() for a suggestion on how to reduce stalling time in some use cases.
Parameters
[in]clockClock point to set divisor/prescaler for. Notice that not all clock points have a divisor/prescaler, please refer to CMU overview in the reference manual.
[in]divThe clock divisor to use (<= cmuClkDiv_512).

Definition at line 1793 of file em_cmu.c.

References _CMU_LFAPRESC0_LCD_MASK, _CMU_LFAPRESC0_LCD_SHIFT, _CMU_LFAPRESC0_LESENSE_MASK, _CMU_LFAPRESC0_LESENSE_SHIFT, _CMU_LFAPRESC0_LETIMER0_MASK, _CMU_LFAPRESC0_LETIMER0_SHIFT, _CMU_LFAPRESC0_RTC_MASK, _CMU_LFAPRESC0_RTC_SHIFT, _CMU_LFBPRESC0_LEUART0_MASK, _CMU_LFBPRESC0_LEUART0_SHIFT, _CMU_LFBPRESC0_LEUART1_MASK, _CMU_LFBPRESC0_LEUART1_SHIFT, CMU, CMU_ClockPrescSet(), CMU_DivToLog2(), CMU_SYNCBUSY_LFAPRESC0, CMU_SYNCBUSY_LFBPRESC0, cmuClkDiv_1, cmuClkDiv_128, cmuClkDiv_16, cmuClkDiv_32768, cmuClkDiv_512, cmuClkDiv_8, cmuClock_LCDpre, cmuClock_LESENSE, cmuClock_LETIMER0, cmuClock_LEUART0, cmuClock_LEUART1, cmuClock_RTC, SystemCoreClockGet(), and SystemHFClockGet().

Referenced by CAPLESENSE_setupCMU(), RETARGET_SerialInit(), RTCDRV_Init(), SegmentLCD_Init(), UARTDRV_InitLeuart(), and UDELAY_Calibrate().

void CMU_ClockEnable ( CMU_Clock_TypeDef  clock,
bool  enable 
)

Enable/disable a clock.

In general, module clocking is disabled after a reset. If a module clock is disabled, the registers of that module are not accessible and reading from such registers may return undefined values. Writing to registers of clock disabled modules have no effect. One should normally avoid accessing module registers of a module with a disabled clock.

Note
If enabling/disabling a LF clock, synchronization into the low frequency domain is required. If the same register is modified before a previous update has completed, this function will stall until the previous synchronization has completed. Please refer to CMU_FreezeEnable() for a suggestion on how to reduce stalling time in some use cases.
Parameters
[in]clockThe clock to enable/disable. Notice that not all defined clock points have separate enable/disable control, please refer to CMU overview in reference manual.
[in]enable
  • true - enable specified clock.
  • false - disable specified clock.

Definition at line 1998 of file em_cmu.c.

References BUS_RegBitWrite(), CMU, CMU_ClockFreqGet(), CMU_SYNCBUSY_LFACLKEN0, CMU_SYNCBUSY_LFBCLKEN0, CMU_SYNCBUSY_LFCCLKEN0, CMU_SYNCBUSY_LFECLKEN0, and cmuClock_HFLE.

Referenced by adcInit(), BOARD_init(), BSP_BccDeInit(), BSP_BccInit(), BSP_BusControlModeSet(), BSP_EbiInit(), BSP_initBoard(), BSP_McuBoard_Init(), CAPLESENSE_setupCMU(), CAPSENSE_Init(), DMADRV_DeInit(), ezradio_hal_GpioInit(), I2CSPM_Init(), ICM20648_spiInit(), LDMA_DeInit(), LDMA_Init(), MIC_init(), MICROSD_Init(), MICROSD_PowerOff(), MICROSD_PowerOn(), mscEccReadWriteExistingDma(), MSDD_Init(), RETARGET_SerialInit(), RTCDRV_DeInit(), RTCDRV_Init(), SegmentLCD_Disable(), SegmentLCD_Init(), setupOscillators(), SPI_TFT_Init(), SPIDRV_DeInit(), SPIDRV_Init(), TOUCH_Init(), UARTDRV_DeInit(), UARTDRV_InitLeuart(), UARTDRV_InitUart(), UDELAY_Calibrate(), USTIMER_DeInit(), USTIMER_Init(), VDDCHECK_Disable(), and VDDCHECK_Init().

uint32_t CMU_ClockFreqGet ( CMU_Clock_TypeDef  clock)
uint32_t CMU_ClockPrescGet ( CMU_Clock_TypeDef  clock)

Get clock prescaler.

Parameters
[in]clockClock point to get the prescaler for. Notice that not all clock points have a prescaler. Please refer to CMU overview in reference manual.
Returns
The prescaler value of the current clock point. 0 is returned if clock specifies a clock point without a prescaler.

Definition at line 2356 of file em_cmu.c.

References _CMU_ADCCTRL_ADC0CLKDIV_MASK, _CMU_ADCCTRL_ADC0CLKDIV_SHIFT, _CMU_ADCCTRL_ADC1CLKDIV_MASK, _CMU_ADCCTRL_ADC1CLKDIV_SHIFT, _CMU_HFCOREPRESC_PRESC_MASK, _CMU_HFCOREPRESC_PRESC_SHIFT, _CMU_HFEXPPRESC_PRESC_MASK, _CMU_HFEXPPRESC_PRESC_SHIFT, _CMU_HFPERPRESC_PRESC_MASK, _CMU_HFPERPRESC_PRESC_SHIFT, _CMU_HFPRESC_HFCLKLEPRESC_MASK, _CMU_HFPRESC_HFCLKLEPRESC_SHIFT, _CMU_HFPRESC_PRESC_MASK, _CMU_HFPRESC_PRESC_SHIFT, _CMU_LFAPRESC0_LCD_MASK, _CMU_LFAPRESC0_LCD_SHIFT, _CMU_LFAPRESC0_LESENSE_MASK, _CMU_LFAPRESC0_LESENSE_SHIFT, _CMU_LFAPRESC0_LETIMER0_MASK, _CMU_LFAPRESC0_LETIMER0_SHIFT, _CMU_LFAPRESC0_LETIMER1_MASK, _CMU_LFAPRESC0_LETIMER1_SHIFT, _CMU_LFAPRESC0_RTC_MASK, _CMU_LFAPRESC0_RTC_SHIFT, _CMU_LFBPRESC0_CSEN_MASK, _CMU_LFBPRESC0_CSEN_SHIFT, _CMU_LFBPRESC0_LEUART0_MASK, _CMU_LFBPRESC0_LEUART0_SHIFT, _CMU_LFBPRESC0_LEUART1_MASK, _CMU_LFBPRESC0_LEUART1_SHIFT, _CMU_LFEPRESC0_RTCC_DIV1, CMU, CMU_Log2ToDiv(), cmuClock_ADC0ASYNC, cmuClock_ADC1ASYNC, cmuClock_CSEN_LF, cmuClock_LCD, cmuClock_LCDpre, cmuClock_LESENSE, cmuClock_LETIMER0, cmuClock_LETIMER1, cmuClock_LEUART0, cmuClock_LEUART1, cmuClock_RTC, and cmuClock_RTCC.

Referenced by CMU_ClockDivGet().

void CMU_ClockPrescSet ( CMU_Clock_TypeDef  clock,
CMU_ClkPresc_TypeDef  presc 
)

Set clock prescaler.

Note
If setting a LF clock prescaler, synchronization into the low frequency domain is required. If the same register is modified before a previous update has completed, this function will stall until the previous synchronization has completed. Please refer to CMU_FreezeEnable() for a suggestion on how to reduce stalling time in some use cases.
Parameters
[in]clockClock point to set prescaler for. Notice that not all clock points have a prescaler, please refer to CMU overview in the reference manual.
[in]prescThe clock prescaler to use.

Definition at line 2548 of file em_cmu.c.

References _CMU_ADCCTRL_ADC0CLKDIV_MASK, _CMU_ADCCTRL_ADC0CLKDIV_SHIFT, _CMU_ADCCTRL_ADC1CLKDIV_MASK, _CMU_ADCCTRL_ADC1CLKDIV_SHIFT, _CMU_HFCOREPRESC_PRESC_MASK, _CMU_HFCOREPRESC_PRESC_SHIFT, _CMU_HFEXPPRESC_PRESC_MASK, _CMU_HFEXPPRESC_PRESC_SHIFT, _CMU_HFPERPRESC_PRESC_MASK, _CMU_HFPERPRESC_PRESC_SHIFT, _CMU_HFPRESC_HFCLKLEPRESC_MASK, _CMU_HFPRESC_HFCLKLEPRESC_SHIFT, _CMU_HFPRESC_PRESC_MASK, _CMU_HFPRESC_PRESC_SHIFT, _CMU_LFAPRESC0_LCD_MASK, _CMU_LFAPRESC0_LCD_SHIFT, _CMU_LFAPRESC0_LESENSE_MASK, _CMU_LFAPRESC0_LESENSE_SHIFT, _CMU_LFAPRESC0_LETIMER0_MASK, _CMU_LFAPRESC0_LETIMER0_SHIFT, _CMU_LFAPRESC0_RTC_MASK, _CMU_LFAPRESC0_RTC_SHIFT, _CMU_LFBPRESC0_CSEN_MASK, _CMU_LFBPRESC0_CSEN_SHIFT, _CMU_LFBPRESC0_LEUART0_MASK, _CMU_LFBPRESC0_LEUART0_SHIFT, _CMU_LFBPRESC0_LEUART1_MASK, _CMU_LFBPRESC0_LEUART1_SHIFT, _CMU_LFEPRESC0_RTCC_MASK, _CMU_LFEPRESC0_RTCC_SHIFT, CMU, CMU_ClockFreqGet(), CMU_PrescToLog2(), CMU_SYNCBUSY_LFAPRESC0, CMU_SYNCBUSY_LFBPRESC0, CMU_SYNCBUSY_LFEPRESC0, cmuClock_ADC0ASYNC, cmuClock_ADC1ASYNC, cmuClock_CSEN_LF, cmuClock_HFLE, cmuClock_LCD, cmuClock_LCDpre, cmuClock_LESENSE, cmuClock_LETIMER0, cmuClock_LEUART0, cmuClock_LEUART1, cmuClock_RTC, cmuClock_RTCC, and SystemCoreClockGet().

Referenced by CMU_ClockDivSet().

CMU_Select_TypeDef CMU_ClockSelectGet ( CMU_Clock_TypeDef  clock)

Get currently selected reference clock used for a clock branch.

Parameters
[in]clockClock branch to fetch selected ref. clock for. One of:
Returns
Reference clock used for clocking selected branch, cmuSelect_Error if invalid clock provided.

Definition at line 2843 of file em_cmu.c.

References _CMU_ADCCTRL_ADC0CLKSEL_MASK, _CMU_ADCCTRL_ADC1CLKSEL_MASK, _CMU_DBGCLKSEL_DBG_MASK, _CMU_HFCLKSTATUS_SELECTED_MASK, _CMU_LFACLKSEL_LFA_MASK, _CMU_LFBCLKSEL_LFB_MASK, _CMU_LFECLKSEL_LFE_MASK, _CMU_QSPICTRL_QSPI0CLKSEL_MASK, _CMU_SDIOCTRL_SDIOCLKSEL_MASK, _CMU_USBCTRL_USBCLKSEL_MASK, CMU, CMU_ADCCTRL_ADC0CLKSEL_AUXHFRCO, CMU_ADCCTRL_ADC0CLKSEL_DISABLED, CMU_ADCCTRL_ADC0CLKSEL_HFSRCCLK, CMU_ADCCTRL_ADC0CLKSEL_HFXO, CMU_ADCCTRL_ADC1CLKSEL_AUXHFRCO, CMU_ADCCTRL_ADC1CLKSEL_DISABLED, CMU_ADCCTRL_ADC1CLKSEL_HFSRCCLK, CMU_ADCCTRL_ADC1CLKSEL_HFXO, CMU_DBGCLKSEL_DBG_AUXHFRCO, CMU_DBGCLKSEL_DBG_HFCLK, CMU_HFCLKSTATUS_SELECTED_HFXO, CMU_HFCLKSTATUS_SELECTED_LFRCO, CMU_HFCLKSTATUS_SELECTED_LFXO, CMU_LFACLKSEL_LFA_LFRCO, CMU_LFACLKSEL_LFA_LFXO, CMU_LFACLKSEL_LFA_ULFRCO, CMU_LFBCLKSEL_LFB_HFCLKLE, CMU_LFBCLKSEL_LFB_LFRCO, CMU_LFBCLKSEL_LFB_LFXO, CMU_LFBCLKSEL_LFB_ULFRCO, CMU_LFECLKSEL_LFE_LFRCO, CMU_LFECLKSEL_LFE_LFXO, CMU_LFECLKSEL_LFE_ULFRCO, CMU_QSPICTRL_QSPI0CLKSEL_AUXHFRCO, CMU_QSPICTRL_QSPI0CLKSEL_HFRCO, CMU_QSPICTRL_QSPI0CLKSEL_HFXO, CMU_QSPICTRL_QSPI0CLKSEL_USHFRCO, CMU_SDIOCTRL_SDIOCLKSEL_AUXHFRCO, CMU_SDIOCTRL_SDIOCLKSEL_HFRCO, CMU_SDIOCTRL_SDIOCLKSEL_HFXO, CMU_SDIOCTRL_SDIOCLKSEL_USHFRCO, CMU_USBCTRL_USBCLKSEL_HFRCO, CMU_USBCTRL_USBCLKSEL_HFXO, CMU_USBCTRL_USBCLKSEL_HFXOX2, CMU_USBCTRL_USBCLKSEL_LFRCO, CMU_USBCTRL_USBCLKSEL_LFXO, CMU_USBCTRL_USBCLKSEL_USHFRCO, cmuSelect_AUXHFRCO, cmuSelect_Disabled, cmuSelect_Error, cmuSelect_HFCLK, cmuSelect_HFCLKLE, cmuSelect_HFRCO, cmuSelect_HFSRCCLK, cmuSelect_HFXO, cmuSelect_HFXOX2, cmuSelect_LFRCO, cmuSelect_LFXO, cmuSelect_ULFRCO, and cmuSelect_USHFRCO.

Referenced by CMU_DPLLLock(), CMU_HFRCOBandSet(), CMU_HFXOInit(), CMU_LFXOInit(), and UDELAY_Calibrate().

void CMU_ClockSelectSet ( CMU_Clock_TypeDef  clock,
CMU_Select_TypeDef  ref 
)

Select reference clock/oscillator used for a clock branch.

Notice that if a selected reference is not enabled prior to selecting its use, it will be enabled, and this function will wait for the selected oscillator to be stable. It will however NOT be disabled if another reference clock is selected later.

This feature is particularly important if selecting a new reference clock for the clock branch clocking the core, otherwise the system may halt.

Parameters
[in]clockClock branch to select reference clock for. One of:
[in]refReference selected for clocking, please refer to reference manual for for details on which reference is available for a specific clock branch.

Definition at line 3341 of file em_cmu.c.

References _CMU_ADCCTRL_ADC0CLKSEL_AUXHFRCO, _CMU_ADCCTRL_ADC0CLKSEL_DISABLED, _CMU_ADCCTRL_ADC0CLKSEL_HFSRCCLK, _CMU_ADCCTRL_ADC0CLKSEL_HFXO, _CMU_ADCCTRL_ADC0CLKSEL_MASK, _CMU_ADCCTRL_ADC0CLKSEL_SHIFT, _CMU_ADCCTRL_ADC1CLKSEL_AUXHFRCO, _CMU_ADCCTRL_ADC1CLKSEL_DISABLED, _CMU_ADCCTRL_ADC1CLKSEL_HFSRCCLK, _CMU_ADCCTRL_ADC1CLKSEL_HFXO, _CMU_ADCCTRL_ADC1CLKSEL_MASK, _CMU_ADCCTRL_ADC1CLKSEL_SHIFT, _CMU_HFBUSCLKEN0_LE_SHIFT, _CMU_LFACLKSEL_LFA_DISABLED, _CMU_LFACLKSEL_LFA_LFRCO, _CMU_LFACLKSEL_LFA_LFXO, _CMU_LFACLKSEL_LFA_ULFRCO, _CMU_LFBCLKSEL_LFB_HFCLKLE, _CMU_QSPICTRL_QSPI0CLKSEL_AUXHFRCO, _CMU_QSPICTRL_QSPI0CLKSEL_HFRCO, _CMU_QSPICTRL_QSPI0CLKSEL_HFXO, _CMU_QSPICTRL_QSPI0CLKSEL_MASK, _CMU_QSPICTRL_QSPI0CLKSEL_SHIFT, _CMU_QSPICTRL_QSPI0CLKSEL_USHFRCO, _CMU_SDIOCTRL_SDIOCLKSEL_AUXHFRCO, _CMU_SDIOCTRL_SDIOCLKSEL_HFRCO, _CMU_SDIOCTRL_SDIOCLKSEL_HFXO, _CMU_SDIOCTRL_SDIOCLKSEL_MASK, _CMU_SDIOCTRL_SDIOCLKSEL_SHIFT, _CMU_SDIOCTRL_SDIOCLKSEL_USHFRCO, _CMU_USBCTRL_USBCLKSEL_HFRCO, _CMU_USBCTRL_USBCLKSEL_HFXO, _CMU_USBCTRL_USBCLKSEL_HFXOX2, _CMU_USBCTRL_USBCLKSEL_LFRCO, _CMU_USBCTRL_USBCLKSEL_LFXO, _CMU_USBCTRL_USBCLKSEL_MASK, _CMU_USBCTRL_USBCLKSEL_SHIFT, _CMU_USBCTRL_USBCLKSEL_USHFRCO, BUS_RegBitWrite(), CMU, CMU_ClockFreqGet(), CMU_DBGCLKSEL_DBG_AUXHFRCO, CMU_DBGCLKSEL_DBG_HFCLK, CMU_HFCLKSEL_HF_HFRCO, CMU_HFCLKSEL_HF_HFXO, CMU_HFCLKSEL_HF_LFRCO, CMU_HFCLKSEL_HF_LFXO, CMU_HFRCOBandGet(), CMU_HFXOCTRL_HFXOX2EN, CMU_OscillatorEnable(), cmuClock_HF, cmuClock_HFLE, cmuOsc_AUXHFRCO, cmuOsc_HFRCO, cmuOsc_HFXO, cmuOsc_LFRCO, cmuOsc_LFXO, cmuOsc_USHFRCO, cmuSelect_AUXHFRCO, cmuSelect_Disabled, cmuSelect_HFCLK, cmuSelect_HFCLKLE, cmuSelect_HFRCO, cmuSelect_HFSRCCLK, cmuSelect_HFXO, cmuSelect_HFXOX2, cmuSelect_LFRCO, cmuSelect_LFXO, cmuSelect_ULFRCO, cmuSelect_USHFRCO, EMU_VScaleEM01ByClock(), EMU_VScaleWait(), SL_FALLTHROUGH, SystemCoreClockGet(), and SystemHFXOClockGet().

Referenced by BSP_BccInit(), BSP_initClocks(), CAPLESENSE_setupCMU(), MIC_init(), RETARGET_SerialInit(), RTCDRV_Init(), SegmentLCD_Init(), setupOscillators(), UARTDRV_InitLeuart(), and UDELAY_Calibrate().

__STATIC_INLINE uint32_t CMU_DivToLog2 ( CMU_ClkDiv_TypeDef  div)

Convert dividend to logarithmic value. Only works for even numbers equal to 2^n.

Parameters
[in]divUnscaled dividend.
Returns
Logarithm of 2, as used by fixed prescalers.

Definition at line 1702 of file em_cmu.h.

Referenced by CMU_ClockDivGet(), CMU_ClockDivSet(), CMU_ClockFreqGet(), and RTCDRV_Init().

bool CMU_DPLLLock ( CMU_DPLLInit_TypeDef init)

Lock the DPLL to a given frequency.

The frequency is given by: Fout = Fref * (N+1) / (M+1).

Note
This function does not check if the given N & M values will actually produce the desired target frequency. Any peripheral running off HFRCO should be switched to HFRCODIV2 prior to calling this function to avoid over-clocking.
Parameters
[in]initDPLL setup parameters.
Returns
Returns false on invalid target frequency or DPLL locking error.

Definition at line 4004 of file em_cmu.c.

References _CMU_DPLLCTRL1_M_MASK, _CMU_DPLLCTRL1_M_SHIFT, _CMU_DPLLCTRL1_N_MASK, _CMU_DPLLCTRL1_N_SHIFT, _CMU_DPLLCTRL_AUTORECOVER_SHIFT, _CMU_DPLLCTRL_EDGESEL_SHIFT, _CMU_DPLLCTRL_MODE_SHIFT, _CMU_DPLLCTRL_REFSEL_SHIFT, _CMU_HFCLKSTATUS_SELECTED_MASK, _CMU_HFRCOCTRL_TUNING_MASK, _CMU_HFRCOCTRL_TUNING_SHIFT, _CMU_HFRCOSS_SSAMP_MASK, _CMU_HFRCOSS_SSAMP_SHIFT, _CMU_HFRCOSS_SSINV_MASK, _CMU_HFRCOSS_SSINV_SHIFT, CMU_DPLLInit_TypeDef::autoRecover, CMU, CMU_ClockFreqGet(), CMU_ClockSelectGet(), CMU_HFCLKSEL_HF_HFRCO, CMU_HFCLKSEL_HF_HFRCODIV2, CMU_HFCLKSTATUS_SELECTED_HFRCODIV2, CMU_HFRCODevinfoGet(), CMU_IF_DPLLLOCKFAILHIGH, CMU_IF_DPLLLOCKFAILLOW, CMU_IF_DPLLRDY, CMU_IFC_DPLLLOCKFAILHIGH, CMU_IFC_DPLLLOCKFAILLOW, CMU_IFC_DPLLRDY, CMU_OSCENCMD_DPLLDIS, CMU_OSCENCMD_DPLLEN, CMU_STATUS_DPLLENS, CMU_STATUS_DPLLRDY, cmuClock_HF, cmuClock_HFLE, cmuSelect_HFRCO, CMU_DPLLInit_TypeDef::edgeSel, EMU_VScaleEM01ByClock(), EMU_VScaleGet(), emuVScaleEM01_LowPower, CMU_DPLLInit_TypeDef::frequency, CMU_DPLLInit_TypeDef::lockMode, CMU_DPLLInit_TypeDef::m, CMU_DPLLInit_TypeDef::n, CMU_DPLLInit_TypeDef::refClk, CMU_DPLLInit_TypeDef::ssAmplitude, CMU_DPLLInit_TypeDef::ssInterval, SystemCoreClockGet(), and SystemHfrcoFreq.

__STATIC_INLINE void CMU_DPLLUnlock ( void  )

Unlock the DPLL.

Note
The HFRCO is not turned off.

Definition at line 1722 of file em_cmu.h.

References CMU, and CMU_OSCENCMD_DPLLDIS.

void CMU_FreezeEnable ( bool  enable)

CMU low frequency register synchronization freeze control.

Some CMU registers requires synchronization into the low frequency (LF) domain. The freeze feature allows for several such registers to be modified before passing them to the LF domain simultaneously (which takes place when the freeze mode is disabled).

Another usage scenario of this feature, is when using an API (such as the CMU API) for modifying several bit fields consecutively in the same register. If freeze mode is enabled during this sequence, stalling can be avoided.

Note
When enabling freeze mode, this function will wait for all current ongoing CMU synchronization to LF domain to complete (Normally synchronization will not be in progress.) However for this reason, when using freeze mode, modifications of registers requiring LF synchronization should be done within one freeze enable/disable block to avoid unecessary stalling.
Parameters
[in]enable
  • true - enable freeze, modified registers are not propagated to the LF domain
  • false - disable freeze, modified registers are propagated to LF domain

Definition at line 4160 of file em_cmu.c.

References CMU, and CMU_FREEZE_REGFREEZE.

CMU_HFRCOFreq_TypeDef CMU_HFRCOBandGet ( void  )

Get current HFRCO frequency.

Returns
HFRCO frequency

Definition at line 4348 of file em_cmu.c.

References SystemHfrcoFreq.

Referenced by CMU_ClockSelectSet(), and CMU_HFRCOFreqGet().

static uint32_t CMU_HFRCODevinfoGet ( CMU_HFRCOFreq_TypeDef  freq)
static

Get the HFRCO frequency calibration word in DEVINFO.

Parameters
[in]freqFrequency in Hz
Returns
HFRCO calibration word for a given frequency

Definition at line 4286 of file em_cmu.c.

References cmuHFRCOFreq_13M0Hz, cmuHFRCOFreq_16M0Hz, cmuHFRCOFreq_19M0Hz, cmuHFRCOFreq_1M0Hz, cmuHFRCOFreq_26M0Hz, cmuHFRCOFreq_2M0Hz, cmuHFRCOFreq_32M0Hz, cmuHFRCOFreq_38M0Hz, cmuHFRCOFreq_48M0Hz, cmuHFRCOFreq_4M0Hz, cmuHFRCOFreq_56M0Hz, cmuHFRCOFreq_64M0Hz, cmuHFRCOFreq_72M0Hz, cmuHFRCOFreq_7M0Hz, and DEVINFO.

Referenced by CMU_DPLLLock(), and CMU_HFRCOBandSet().

__STATIC_INLINE CMU_HFRCOFreq_TypeDef CMU_HFRCOFreqGet ( void  )

Get current HFRCO frequency.

Deprecated:
Deprecated function. New code should use CMU_HFRCOBandGet().
Returns
HFRCO frequency

Definition at line 1900 of file em_cmu.h.

References CMU_HFRCOBandGet().

__STATIC_INLINE void CMU_HFRCOFreqSet ( CMU_HFRCOFreq_TypeDef  setFreq)

Set HFRCO calibration for the selected target frequency.

Deprecated:
Deprecated function. New code should use CMU_HFRCOBandSet().
Parameters
[in]setFreqHFRCO frequency to set

Definition at line 1915 of file em_cmu.h.

References CMU_HFRCOBandSet().

void CMU_HFXOAutostartEnable ( uint32_t  userSel,
bool  enEM0EM1Start,
bool  enEM0EM1StartSel 
)

Enable or disable HFXO autostart.

Parameters
[in]userSelAdditional user specified enable bit.
[in]enEM0EM1StartIf true, HFXO is automatically started upon entering EM0/EM1 entry from EM2/EM3. HFXO selection has to be handled by the user. If false, HFXO is not started automatically when entering EM0/EM1.
[in]enEM0EM1StartSelIf true, HFXO is automatically started and immediately selected upon entering EM0/EM1 entry from EM2/EM3. Note that this option stalls the use of HFSRCCLK until HFXO becomes ready. If false, HFXO is not started or selected automatically when entering EM0/EM1.

Definition at line 4569 of file em_cmu.c.

References _CMU_HFXOCTRL_AUTOSTARTEM0EM1_MASK, _CMU_HFXOCTRL_AUTOSTARTSELEM0EM1_MASK, CMU, CMU_HFXOCTRL_AUTOSTARTEM0EM1, CMU_HFXOCTRL_AUTOSTARTSELEM0EM1, and SystemHFXOClockGet().

Referenced by BSP_initClocks().

__STATIC_INLINE void CMU_IntClear ( uint32_t  flags)

Clear one or more pending CMU interrupts.

Parameters
[in]flagsCMU interrupt sources to clear.

Definition at line 1735 of file em_cmu.h.

References CMU.

__STATIC_INLINE void CMU_IntDisable ( uint32_t  flags)

Disable one or more CMU interrupts.

Parameters
[in]flagsCMU interrupt sources to disable.

Definition at line 1747 of file em_cmu.h.

References CMU.

__STATIC_INLINE void CMU_IntEnable ( uint32_t  flags)

Enable one or more CMU interrupts.

Note
Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. Consider using CMU_IntClear() prior to enabling if such a pending interrupt should be ignored.
Parameters
[in]flagsCMU interrupt sources to enable.

Definition at line 1764 of file em_cmu.h.

References CMU.

__STATIC_INLINE uint32_t CMU_IntGet ( void  )

Get pending CMU interrupts.

Returns
CMU interrupt sources pending.

Definition at line 1776 of file em_cmu.h.

References CMU.

__STATIC_INLINE uint32_t CMU_IntGetEnabled ( void  )

Get enabled and pending CMU interrupt flags.

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

Note
The event bits are not cleared by the use of this function.
Returns
Pending and enabled CMU interrupt sources The return value is the bitwise AND of
  • the enabled interrupt sources in CMU_IEN and
  • the pending interrupt flags CMU_IF

Definition at line 1797 of file em_cmu.h.

References CMU.

__STATIC_INLINE void CMU_IntSet ( uint32_t  flags)

Set one or more pending CMU interrupts.

Parameters
[in]flagsCMU interrupt sources to set to pending.

Definition at line 1812 of file em_cmu.h.

References CMU.

uint32_t CMU_LCDClkFDIVGet ( void  )

Get the LCD framerate divisor (FDIV) setting.

Returns
The LCD framerate divisor.

Definition at line 4754 of file em_cmu.c.

References CMU.

void CMU_LCDClkFDIVSet ( uint32_t  div)

Set the LCD framerate divisor (FDIV) setting.

Note
The FDIV field (CMU LCDCTRL register) should only be modified while the LCD module is clock disabled (CMU LFACLKEN0.LCD bit is 0). This function will NOT modify FDIV if the LCD module clock is enabled. Please refer to CMU_ClockEnable() for disabling/enabling LCD clock.
Parameters
[in]divThe FDIV setting to use.

Definition at line 4776 of file em_cmu.c.

References CMU, CMU_LFACLKEN0_LCD, and cmuClkDiv_128.

Referenced by SegmentLCD_Init().

void CMU_LFXOInit ( const CMU_LFXOInit_TypeDef lfxoInit)

Set LFXO control registers.

Note
LFXO configuration should be obtained from a configuration tool, app note or xtal datasheet. This function disables the LFXO to ensure a valid state before update.
Parameters
[in]lfxoInitLFXO setup parameters

Definition at line 4806 of file em_cmu.c.

References _CMU_LFXOCTRL_GAIN_MASK, _CMU_LFXOCTRL_GAIN_SHIFT, _CMU_LFXOCTRL_MODE_MASK, _CMU_LFXOCTRL_MODE_SHIFT, _CMU_LFXOCTRL_TIMEOUT_MASK, _CMU_LFXOCTRL_TIMEOUT_SHIFT, _CMU_LFXOCTRL_TUNING_MASK, _CMU_LFXOCTRL_TUNING_SHIFT, BUS_RegBitWrite(), BUS_RegMaskedWrite(), CMU, CMU_ClockSelectGet(), CMU_OscillatorEnable(), cmuClock_HF, cmuOsc_LFXO, cmuSelect_LFXO, CMU_LFXOInit_TypeDef::ctune, EMU, CMU_LFXOInit_TypeDef::gain, CMU_LFXOInit_TypeDef::mode, and CMU_LFXOInit_TypeDef::timeout.

Referenced by BSP_initClocks().

__STATIC_INLINE void CMU_Lock ( void  )

Lock the CMU in order to protect some of its registers against unintended modification.

Please refer to the reference manual for CMU registers that will be locked.

Note
If locking the CMU registers, they must be unlocked prior to using any CMU API functions modifying CMU registers protected by the lock.

Definition at line 1830 of file em_cmu.h.

References CMU, and CMU_LOCK_LOCKKEY_LOCK.

Referenced by EMU_EnterEM3().

__STATIC_INLINE uint32_t CMU_Log2ToDiv ( uint32_t  log2)

Convert logarithm of 2 prescaler to division factor.

Parameters
[in]log2Logarithm of 2, as used by fixed prescalers.
Returns
Dividend.

Definition at line 1845 of file em_cmu.h.

Referenced by CMU_ClockDivGet(), CMU_ClockFreqGet(), CMU_ClockPrescGet(), and CMU_PrescToLog2().

void CMU_OscillatorEnable ( CMU_Osc_TypeDef  osc,
bool  enable,
bool  wait 
)

Enable/disable oscillator.

Note
WARNING: When this function is called to disable either cmuOsc_LFXO or cmuOsc_HFXO the LFXOMODE or HFXOMODE fields of the CMU_CTRL register are reset to the reset value. I.e. if external clock sources are selected in either LFXOMODE or HFXOMODE fields, the configuration will be cleared and needs to be reconfigured if needed later.
Parameters
[in]oscThe oscillator to enable/disable.
[in]enable
  • true - enable specified oscillator.
  • false - disable specified oscillator.
[in]waitOnly used if enable is true.
  • true - wait for oscillator start-up time to timeout before returning.
  • false - do not wait for oscillator start-up time to timeout before returning.

Definition at line 4867 of file em_cmu.c.

References _CMU_HFXOCTRL_MODE_MASK, _CMU_STATUS_AUXHFRCOENS_SHIFT, _CMU_STATUS_AUXHFRCORDY_SHIFT, _CMU_STATUS_HFRCOENS_SHIFT, _CMU_STATUS_HFRCORDY_SHIFT, _CMU_STATUS_HFXOENS_SHIFT, _CMU_STATUS_HFXORDY_SHIFT, _CMU_STATUS_LFRCOENS_SHIFT, _CMU_STATUS_LFRCORDY_SHIFT, _CMU_STATUS_LFXOENS_SHIFT, _CMU_STATUS_LFXORDY_SHIFT, _CMU_STATUS_USHFRCOENS_SHIFT, _CMU_STATUS_USHFRCORDY_SHIFT, BUS_RegBitRead(), CMU, CMU_HFXOCTRL_MODE_DIGEXTCLK, CMU_OSCENCMD_AUXHFRCODIS, CMU_OSCENCMD_AUXHFRCOEN, CMU_OSCENCMD_HFRCODIS, CMU_OSCENCMD_HFRCOEN, CMU_OSCENCMD_HFXODIS, CMU_OSCENCMD_HFXOEN, CMU_OSCENCMD_LFRCODIS, CMU_OSCENCMD_LFRCOEN, CMU_OSCENCMD_LFXODIS, CMU_OSCENCMD_LFXOEN, CMU_OSCENCMD_USHFRCODIS, CMU_OSCENCMD_USHFRCOEN, CMU_OscillatorTuningGet(), CMU_OscillatorTuningOptimize(), CMU_OscillatorTuningSet(), CMU_OscillatorTuningWait(), cmuOsc_AUXHFRCO, cmuOsc_HFRCO, cmuOsc_HFXO, cmuOsc_LFRCO, cmuOsc_LFXO, cmuOsc_USHFRCO, EMU, and EMU_PWRCTRL_REGPWRSEL_DVDD.

Referenced by BSP_initClocks(), CMU_ClockSelectSet(), CMU_HFXOInit(), CMU_LFXOInit(), DBG_SWOEnable(), setupOscillators(), and UDELAY_Calibrate().

uint32_t CMU_OscillatorTuningGet ( CMU_Osc_TypeDef  osc)

Get oscillator frequency tuning setting.

Parameters
[in]oscOscillator to get tuning value for, one of:
Returns
The oscillator frequency tuning setting in use.

Definition at line 5045 of file em_cmu.c.

References _CMU_AUXHFRCOCTRL_TUNING_MASK, _CMU_AUXHFRCOCTRL_TUNING_SHIFT, _CMU_HFRCOCTRL_TUNING_MASK, _CMU_HFRCOCTRL_TUNING_SHIFT, _CMU_HFXOTRIMSTATUS_IBTRIMXOCORE_MASK, _CMU_LFRCOCTRL_TUNING_MASK, _CMU_LFRCOCTRL_TUNING_SHIFT, _CMU_USHFRCOCTRL_TUNING_MASK, _CMU_USHFRCOCTRL_TUNING_SHIFT, CMU, cmuOsc_AUXHFRCO, cmuOsc_HFRCO, cmuOsc_HFXO, cmuOsc_LFRCO, and cmuOsc_USHFRCO.

Referenced by CMU_OscillatorEnable().

bool CMU_OscillatorTuningOptimize ( CMU_Osc_TypeDef  osc,
CMU_HFXOTuningMode_TypeDef  mode,
bool  wait 
)

Start and optionally wait for oscillator tuning optimization.

Parameters
[in]oscOscillator to set tuning value for, one of:
[in]modeTuning optimization mode.
[in]waitWait for tuning optimization to complete. true - wait for tuning optimization to complete. false - return without waiting.
Returns
Returns false on invalid parameters or oscillator error status.

Definition at line 5289 of file em_cmu.c.

References CMU, CMU_OscillatorTuningWait(), and cmuOsc_HFXO.

Referenced by CMU_OscillatorEnable().

void CMU_OscillatorTuningSet ( CMU_Osc_TypeDef  osc,
uint32_t  val 
)

Set the oscillator frequency tuning control.

Note
Oscillator tuning is done during production, and the tuning value is automatically loaded after a reset. Changing the tuning value from the calibrated value is for more advanced use. Certain oscillators also have build-in tuning optimization.
Parameters
[in]oscOscillator to set tuning value for, one of:
[in]valThe oscillator frequency tuning setting to use.

Definition at line 5113 of file em_cmu.c.

References _CMU_AUXHFRCOCTRL_TUNING_MASK, _CMU_AUXHFRCOCTRL_TUNING_SHIFT, _CMU_HFRCOCTRL_TUNING_MASK, _CMU_HFRCOCTRL_TUNING_SHIFT, _CMU_HFXOSTEADYSTATECTRL_IBTRIMXOCORE_MASK, _CMU_LFRCOCTRL_TUNING_MASK, _CMU_LFRCOCTRL_TUNING_SHIFT, _CMU_SYNCBUSY_AUXHFRCOBSY_SHIFT, _CMU_SYNCBUSY_HFRCOBSY_SHIFT, _CMU_SYNCBUSY_LFRCOBSY_SHIFT, _CMU_SYNCBUSY_USHFRCOBSY_SHIFT, _CMU_USHFRCOCTRL_TUNING_MASK, _CMU_USHFRCOCTRL_TUNING_SHIFT, BUS_RegBitRead(), CMU, CMU_STATUS_HFXOENS, cmuOsc_AUXHFRCO, cmuOsc_HFRCO, cmuOsc_HFXO, cmuOsc_LFRCO, and cmuOsc_USHFRCO.

Referenced by CMU_OscillatorEnable().

bool CMU_OscillatorTuningWait ( CMU_Osc_TypeDef  osc,
CMU_HFXOTuningMode_TypeDef  mode 
)

Wait for oscillator tuning optimization.

Parameters
[in]oscOscillator to set tuning value for, one of:
[in]modeTuning optimization mode.
Returns
Returns false on invalid parameters or oscillator error status.

Definition at line 5223 of file em_cmu.c.

References _CMU_STATUS_MASK, CMU, CMU_STATUS_HFXOPEAKDETRDY, and cmuOsc_HFXO.

Referenced by CMU_OscillatorEnable(), and CMU_OscillatorTuningOptimize().

bool CMU_PCNTClockExternalGet ( unsigned int  instance)

Determine if currently selected PCNTn clock used is external or LFBCLK.

Parameters
[in]instancePCNT instance number to get currently selected clock source for.
Returns
  • true - selected clock is external clock.
  • false - selected clock is LFBCLK.

Definition at line 5326 of file em_cmu.c.

References CMU, CMU_PCNTCTRL_PCNT0CLKSEL_PCNT0S0, CMU_PCNTCTRL_PCNT1CLKSEL_PCNT1S0, and CMU_PCNTCTRL_PCNT2CLKSEL_PCNT2S0.

void CMU_PCNTClockExternalSet ( unsigned int  instance,
bool  external 
)

Select PCNTn clock.

Parameters
[in]instancePCNT instance number to set selected clock source for.
[in]externalSet to true to select external clock, false to select LFBCLK.

Definition at line 5366 of file em_cmu.c.

References BUS_RegBitWrite(), CMU, and PCNT_COUNT.

Referenced by PCNT_Init(), and PCNT_Reset().

__STATIC_INLINE uint32_t CMU_PrescToLog2 ( CMU_ClkPresc_TypeDef  presc)

Convert prescaler dividend to logarithmic value. Only works for even numbers equal to 2^n.

Parameters
[in]prescUnscaled dividend (dividend = presc + 1).
Returns
Logarithm of 2, as used by fixed 2^n prescalers.

Definition at line 1863 of file em_cmu.h.

References CMU_Log2ToDiv().

Referenced by CMU_ClockPrescSet().

CMU_USHFRCOFreq_TypeDef CMU_USHFRCOBandGet ( void  )

Get current USHFRCO frequency.

Returns
HFRCO frequency

Definition at line 4520 of file em_cmu.c.

void CMU_USHFRCOBandSet ( CMU_USHFRCOFreq_TypeDef  setFreq)

Set USHFRCO calibration for the selected target frequency.

Parameters
[in]setFreqUSHFRCO frequency to set

Definition at line 4532 of file em_cmu.c.

References _CMU_SYNCBUSY_USHFRCOBSY_SHIFT, BUS_RegBitRead(), CMU, and CMU_USHFRCODevinfoGet().

static uint32_t CMU_USHFRCODevinfoGet ( CMU_USHFRCOFreq_TypeDef  freq)
static

Get the USHFRCO frequency calibration word in DEVINFO.

Parameters
[in]freqFrequency in Hz
Returns
USHFRCO calibration word for a given frequency

Definition at line 4493 of file em_cmu.c.

References cmuUSHFRCOFreq_16M0Hz, cmuUSHFRCOFreq_32M0Hz, cmuUSHFRCOFreq_48M0Hz, cmuUSHFRCOFreq_50M0Hz, and DEVINFO.

Referenced by CMU_USHFRCOBandSet().