Detailed Description

Clock management unit (CMU) Peripheral API.

This module contains functions for the CMU peripheral of Silicon Labs 32-bit MCUs and SoCs. The CMU module controls oscillators, clocks gates, clock multiplexers, pre-scalers, calibration modules and wait-states.

Data Structures

struct CMU_HFXOInit_TypeDef
struct CMU_LFXOInit_TypeDef

Macros

#define CMU_AUXHFRCO_MAX cmuAUXHFRCOFreq_38M0Hz
#define CMU_AUXHFRCO_MIN cmuAUXHFRCOFreq_1M0Hz
#define CMU_HFRCO_MAX cmuHFRCOFreq_38M0Hz
#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 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_UserDefined = 0
}
enum CMU_Clock_TypeDef {
cmuClock_HF ,
cmuClock_DBG ,
cmuClock_AUX ,
cmuClock_EXPORT ,
cmuClock_BUS ,
cmuClock_CRYPTO ,
cmuClock_LDMA ,
cmuClock_GPCRC ,
cmuClock_GPIO ,
cmuClock_HFLE ,
cmuClock_PRS ,
cmuClock_HFPER ,
cmuClock_USART0 ,
cmuClock_USART1 ,
cmuClock_TIMER0 ,
cmuClock_TIMER1 ,
cmuClock_CRYOTIMER ,
cmuClock_ACMP0 ,
cmuClock_ACMP1 ,
cmuClock_IDAC0 ,
cmuClock_ADC0 ,
cmuClock_I2C0 ,
cmuClock_CORE ,
cmuClock_LFA ,
cmuClock_LETIMER0 ,
cmuClock_PCNT0 ,
cmuClock_LFB ,
cmuClock_LEUART0 ,
cmuClock_LFE ,
cmuClock_RTCC ,
cmuClock_ADC0ASYNC
}
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_UserDefined = 0
}
enum CMU_HFXOTuningMode_TypeDef {
cmuHFXOTuningMode_Auto = 0,
cmuHFXOTuningMode_PeakDetectCommand = CMU_CMD_HFXOPEAKDETSTART,
cmuHFXOTuningMode_ShuntCommand = CMU_CMD_HFXOSHUNTOPTSTART,
cmuHFXOTuningMode_PeakShuntCommand
}
enum CMU_Osc_TypeDef {
cmuOsc_LFXO ,
cmuOsc_LFRCO ,
cmuOsc_HFXO ,
cmuOsc_HFRCO ,
cmuOsc_AUXHFRCO ,
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_ULFRCO
}

Functions

CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOBandGet (void)
Get the 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 the 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 the clock.
void CMU_CalibrateConfig (uint32_t downCycles, CMU_Osc_TypeDef downSel, CMU_Osc_TypeDef upSel)
Configure the clock calibration.
__STATIC_INLINE void CMU_CalibrateCont (bool enable)
Configure continuous calibration mode.
uint32_t CMU_CalibrateCountGet (void)
Get the calibration count register.
__STATIC_INLINE void CMU_CalibrateStart (void)
Start calibration.
__STATIC_INLINE void CMU_CalibrateStop (void)
Stop the calibration counters.
CMU_ClkDiv_TypeDef CMU_ClockDivGet ( CMU_Clock_TypeDef clock)
Get the clock divisor/prescaler.
void CMU_ClockDivSet ( CMU_Clock_TypeDef clock, CMU_ClkDiv_TypeDef div)
Set the 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 the clock frequency for a clock point.
uint32_t CMU_ClockPrescGet ( CMU_Clock_TypeDef clock)
Get the clock prescaler.
void CMU_ClockPrescSet ( CMU_Clock_TypeDef clock, CMU_ClkPresc_TypeDef presc)
Set the clock prescaler.
CMU_Select_TypeDef CMU_ClockSelectGet ( CMU_Clock_TypeDef clock)
Get the currently selected reference clock used for a clock branch.
void CMU_ClockSelectSet ( CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
Select the reference clock/oscillator used for a clock branch.
__STATIC_INLINE uint32_t CMU_DivToLog2 ( CMU_ClkDiv_TypeDef div)
Convert dividend to logarithmic value. It only works for even numbers equal to 2^n.
void CMU_FreezeEnable (bool enable)
CMU low frequency register synchronization freeze control.
CMU_HFRCOFreq_TypeDef CMU_HFRCOBandGet (void)
Get the current HFRCO frequency.
void CMU_HFRCOBandSet ( CMU_HFRCOFreq_TypeDef setFreq)
Set the 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 the 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 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 the oscillator frequency tuning setting.
bool CMU_OscillatorTuningOptimize ( CMU_Osc_TypeDef osc, CMU_HFXOTuningMode_TypeDef mode, bool wait)
Start and optionally wait for the 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 the oscillator tuning optimization.
bool CMU_PCNTClockExternalGet (unsigned int instance)
Determine if the currently selected PCNTn clock used is external or LFBCLK.
void CMU_PCNTClockExternalSet (unsigned int instance, bool external)
Select the PCNTn clock.
__STATIC_INLINE uint32_t CMU_PrescToLog2 (uint32_t presc)
Convert prescaler dividend to a logarithmic value. It 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)

Macro Definition Documentation

#define CMU_HFXOINIT_DEFAULT
Value:
{ \
true, /* Low-power mode for EFM32 */ \
false, /* @deprecated no longer in use */ \
false, /* @deprecated no longer in use */ \
false, /* @deprecated no longer in use */ \
_CMU_HFXOSTARTUPCTRL_CTUNE_DEFAULT, \
_CMU_HFXOSTEADYSTATECTRL_CTUNE_DEFAULT, \
0xA, /* Default shunt steady-state current */ \
0x20, /* Matching errata fix in @ref CHIP_Init() */ \
0x7, /* Recommended steady-state osc core bias current */ \
0x6, /* Recommended peak detection threshold */ \
0x2, /* Recommended shunt optimization timeout */ \
0xA, /* Recommended peak detection timeout */ \
0x4, /* Recommended steady timeout */ \
_CMU_HFXOTIMEOUTCTRL_STARTUPTIMEOUT_DEFAULT, \
cmuOscMode_Crystal, \
}

Default HFXO initialization values for Platform 2 devices, which contain a separate HFXOCTRL register.

Definition at line 2493 of file em_cmu.h .

#define CMU_HFXOINIT_EXTERNAL_CLOCK
Value:
{ \
true, /* Low-power mode */ \
false, /* @deprecated no longer in use */ \
false, /* @deprecated no longer in use */ \
false, /* @deprecated no longer in use */ \
0, /* Startup CTUNE=0 recommended for external clock */ \
0, /* Steady CTUNE=0 recommended for external clock */ \
0xA, /* Default shunt steady-state current */ \
0, /* Startup IBTRIMXOCORE=0 recommended for external clock */ \
0, /* Steady IBTRIMXOCORE=0 recommended for external clock */ \
0x6, /* Recommended peak detection threshold */ \
0x2, /* Recommended shunt optimization timeout */ \
0x0, /* Peak-detect not recommended for external clock usage */ \
_CMU_HFXOTIMEOUTCTRL_STEADYTIMEOUT_2CYCLES, /* Minimal steady timeout */ \
_CMU_HFXOTIMEOUTCTRL_STARTUPTIMEOUT_2CYCLES, /* Minimal startup timeout */ \
cmuOscMode_External, \
}

Definition at line 2512 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, 32 K cycles */ \
cmuOscMode_Crystal, /* Crystal oscillator */ \
}

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

Definition at line 2381 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 2388 of file em_cmu.h .

#define cmuClkDiv_1   1

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

Definition at line 1102 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 1112 of file em_cmu.h .

#define cmuClkDiv_128   128

Divide clock by 128.

Definition at line 1109 of file em_cmu.h .

Referenced by CMU_ClockDivSet() , and CMU_LCDClkFDIVSet() .

#define cmuClkDiv_16   16

Divide clock by 16.

Definition at line 1106 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 1116 of file em_cmu.h .

#define cmuClkDiv_2   2

Divide clock by 2.

Definition at line 1103 of file em_cmu.h .

#define cmuClkDiv_2048   2048

Divide clock by 2048.

Definition at line 1113 of file em_cmu.h .

#define cmuClkDiv_256   256

Divide clock by 256.

Definition at line 1110 of file em_cmu.h .

Referenced by UDELAY_Calibrate() .

#define cmuClkDiv_32   32

Divide clock by 32.

Definition at line 1107 of file em_cmu.h .

#define cmuClkDiv_32768   32768

Divide clock by 32768.

Definition at line 1117 of file em_cmu.h .

Referenced by CMU_ClockDivSet() .

#define cmuClkDiv_4   4

Divide clock by 4.

Definition at line 1104 of file em_cmu.h .

#define cmuClkDiv_4096   4096

Divide clock by 4096.

Definition at line 1114 of file em_cmu.h .

#define cmuClkDiv_512   512

Divide clock by 512.

Definition at line 1111 of file em_cmu.h .

Referenced by CMU_ClockDivSet() .

#define cmuClkDiv_64   64

Divide clock by 64.

Definition at line 1108 of file em_cmu.h .

#define cmuClkDiv_8   8

Divide clock by 8.

Definition at line 1105 of file em_cmu.h .

Referenced by CMU_ClockDivSet() .

#define cmuClkDiv_8192   8192

Divide clock by 8192.

Definition at line 1115 of file em_cmu.h .

Typedef Documentation

typedef uint32_t CMU_ClkDiv_TypeDef

Clock divider configuration

Definition at line 1120 of file em_cmu.h .

typedef uint32_t CMU_ClkPresc_TypeDef

Clockprescaler configuration

Definition at line 1124 of file em_cmu.h .

Enumeration Type Documentation

AUX high-frequency RCO bands

Enumerator
cmuAUXHFRCOFreq_1M0Hz

1 MHz RC band

cmuAUXHFRCOFreq_2M0Hz

2 MHz RC band

cmuAUXHFRCOFreq_4M0Hz

4 MHz RC band

cmuAUXHFRCOFreq_7M0Hz

7 MHz RC band

cmuAUXHFRCOFreq_13M0Hz

13 MHz RC band

cmuAUXHFRCOFreq_16M0Hz

16 MHz RC band

cmuAUXHFRCOFreq_19M0Hz

19 MHz RC band

cmuAUXHFRCOFreq_26M0Hz

26 MHz RC band

cmuAUXHFRCOFreq_32M0Hz

32 MHz RC band

cmuAUXHFRCOFreq_38M0Hz

38 MHz RC band

Definition at line 1221 of file em_cmu.h .

Clock points in CMU. See CMU overview in the 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_CRYPTO

Cryptography accelerator clock

cmuClock_LDMA

Direct-memory access controller 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_TIMER0

Timer 0 clock

cmuClock_TIMER1

Timer 1 clock

cmuClock_CRYOTIMER

CRYOtimer clock

cmuClock_ACMP0

Analog comparator 0 clock

cmuClock_ACMP1

Analog comparator 1 clock

cmuClock_IDAC0

Current digital-to-analog converter 0 clock

cmuClock_ADC0

Analog-to-digital converter 0 clock

cmuClock_I2C0

I2C 0 clock

cmuClock_CORE

Core clock

cmuClock_LFA

Low-frequency A clock

cmuClock_LETIMER0

Low-energy timer 0 clock

cmuClock_PCNT0

Pulse counter 0 clock

cmuClock_LFB

Low-frequency B clock

cmuClock_LEUART0

Low-energy universal asynchronous receiver/transmitter 0 clock

cmuClock_LFE

Low-frequency E clock

cmuClock_RTCC

Real-time counter and calendar clock

cmuClock_ADC0ASYNC

ADC0 asynchronous clock

Definition at line 1251 of file em_cmu.h .

High-frequency system RCO bands

Enumerator
cmuHFRCOFreq_1M0Hz

1 MHz RC band

cmuHFRCOFreq_2M0Hz

2 MHz RC band

cmuHFRCOFreq_4M0Hz

4 MHz RC band

cmuHFRCOFreq_7M0Hz

7 MHz RC band

cmuHFRCOFreq_13M0Hz

13 MHz RC band

cmuHFRCOFreq_16M0Hz

16 MHz RC band

cmuHFRCOFreq_19M0Hz

19 MHz RC band

cmuHFRCOFreq_26M0Hz

26 MHz RC band

cmuHFRCOFreq_32M0Hz

32 MHz RC band

cmuHFRCOFreq_38M0Hz

38 MHz RC band

Definition at line 1180 of file em_cmu.h .

HFXO tuning modes

Enumerator
cmuHFXOTuningMode_PeakDetectCommand

Run peak detect optimization only.

cmuHFXOTuningMode_ShuntCommand

Run shunt current optimization only.

cmuHFXOTuningMode_PeakShuntCommand

Run peak and shunt current optimization.

Definition at line 2317 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_ULFRCO

Ultra low-frequency RC oscillator.

Definition at line 2245 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 2266 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_ULFRCO

Ultra low-frequency RC oscillator.

Definition at line 2273 of file em_cmu.h .

Function Documentation

CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOBandGet ( void )

Get the current AUXHFRCO frequency.

Returns
AUXHFRCO frequency.

Definition at line 4339 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] setFreq AUXHFRCO frequency to set

Definition at line 4353 of file em_cmu.c .

References BUS_RegBitRead() , 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] freq Frequency in Hz.
Returns
AUXHFRCO calibration word for a given frequency.

Definition at line 4286 of file em_cmu.c .

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

Referenced by CMU_AUXHFRCOBandSet() .

__STATIC_INLINE CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOFreqGet ( void )

Get the current AUXHFRCO frequency.

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

Definition at line 2926 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:
A deprecated function. New code should use CMU_AUXHFRCOBandSet() .
Parameters
[in] setFreq AUXHFRCO frequency to set.

Definition at line 2941 of file em_cmu.h .

References CMU_AUXHFRCOBandSet() .

uint32_t CMU_Calibrate ( uint32_t HFCycles,
CMU_Osc_TypeDef reference
)

Calibrate the clock.

Run a calibration for HFCLK against a selectable reference clock. See the reference manual, CMU chapter, for more details.

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

Definition at line 4414 of file em_cmu.c .

References BUS_RegBitRead() , cmuOsc_AUXHFRCO , cmuOsc_HFRCO , cmuOsc_HFXO , cmuOsc_LFRCO , and cmuOsc_LFXO .

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

Configure the clock calibration.

Configure a calibration for a selectable clock source against another selectable reference clock. See the reference manual, CMU chapter, for more 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] downCycles The number of downSel clock cycles to run the calibration. Increasing this number increases precision but the calibration will take more time.
[in] downSel The clock, which will be counted down downCycles.
[in] upSel The reference clock; the number of cycles generated by this clock will be counted and added up and the result can be given with the CMU_CalibrateCountGet() function call.

Definition at line 4503 of file em_cmu.c .

References cmuOsc_AUXHFRCO , cmuOsc_HFRCO , cmuOsc_HFXO , cmuOsc_LFRCO , and cmuOsc_LFXO .

__STATIC_INLINE void CMU_CalibrateCont ( bool enable )

Configure continuous calibration mode.

Parameters
[in] enable If true, enables continuous calibration, if false disables continuous calibration.

Definition at line 2684 of file em_cmu.h .

References BUS_RegBitWrite() .

uint32_t CMU_CalibrateCountGet ( void )

Get the calibration count register.

Note
If continuous calibration mode is active, calibration busy will almost always be off and only the value needs to be read. In a normal case, this function call is triggered by the CALRDY interrupt flag.
Returns
The 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 4611 of file em_cmu.c .

References BUS_RegBitRead() .

__STATIC_INLINE void CMU_CalibrateStart ( void )

Start calibration.

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

Definition at line 2697 of file em_cmu.h .

Get the clock divisor/prescaler.

Parameters
[in] clock A clock point to get the divisor/prescaler for. Notice that not all clock points have a divisor/prescaler. See the CMU overview in the 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 4646 of file em_cmu.c .

References CMU_ClockPrescGet() , CMU_DivToLog2() , cmuClkDiv_1 , cmuClkDiv_16 , cmuClock_LETIMER0 , cmuClock_LEUART0 , and SL_Log2ToDiv() .

Referenced by UDELAY_Calibrate() .

void CMU_ClockDivSet ( CMU_Clock_TypeDef clock,
CMU_ClkDiv_TypeDef div
)

Set the clock divisor/prescaler.

Note
If setting an 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. See CMU_FreezeEnable() for a suggestion on how to reduce the stalling time in some use cases.

HFCLKLE prescaler is automatically modified when peripherals with clock domain HFBUSCLK is chosen based on the maximum HFLE frequency allowed.

Parameters
[in] clock Clock point to set divisor/prescaler for. Notice that not all clock points have a divisor/prescaler. See the CMU overview in the reference manual.
[in] div The clock divisor to use (<= cmuClkDiv_512).

Definition at line 4777 of file em_cmu.c .

References CMU_ClockPrescSet() , CMU_DivToLog2() , cmuClkDiv_1 , cmuClkDiv_128 , cmuClkDiv_16 , cmuClkDiv_32768 , cmuClkDiv_512 , cmuClkDiv_8 , cmuClock_LETIMER0 , cmuClock_LEUART0 , 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 has no effect. Avoid accessing module registers of a module with a disabled clock.

Note
If enabling/disabling an 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. See CMU_FreezeEnable() for a suggestion on how to reduce the stalling time in some use cases.

HFCLKLE prescaler is automatically modified when peripherals with clock domain HFBUSCLK is chosen based on the maximum HFLE frequency allowed.

Parameters
[in] clock The clock to enable/disable. Notice that not all defined clock points have separate enable/disable control. See the CMU overview in the reference manual.
[in] enable
  • true - enable specified clock.
  • false - disable specified clock.

Definition at line 4985 of file em_cmu.c .

References BUS_RegBitWrite() , CMU_ClockFreqGet() , 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() , gpioInit() , I2CSPM_Init() , ICM20648_spiInit() , initEbiCommon() , initGpio() , LDMA_DeInit() , LDMA_Init() , MIC_init() , MICROSD_Init() , MICROSD_PowerOff() , MICROSD_PowerOn() , MSDD_Init() , RETARGET_SerialInit() , RTCDRV_DeInit() , RTCDRV_Init() , SegmentLCD_Disable() , SegmentLCD_Init() , 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_ClockPrescGet ( CMU_Clock_TypeDef clock )

Get the clock prescaler.

Parameters
[in] clock A clock point to get the prescaler for. Notice that not all clock points have a prescaler. See the CMU overview in the 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 5397 of file em_cmu.c .

References cmuClock_ADC0ASYNC , cmuClock_LETIMER0 , cmuClock_LEUART0 , cmuClock_RTCC , and SL_Log2ToDiv() .

Referenced by CMU_ClockDivGet() .

void CMU_ClockPrescSet ( CMU_Clock_TypeDef clock,
CMU_ClkPresc_TypeDef presc
)

Set the clock prescaler.

Note
If setting an 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. See CMU_FreezeEnable() for a suggestion on how to reduce the stalling time in some use cases.

HFCLKLE prescaler is automatically modified when peripherals with clock domain HFBUSCLK is chosen based on the maximum HFLE frequency allowed.

Parameters
[in] clock A clock point to set the prescaler for. Notice that not all clock points have a prescaler. See the CMU overview in the reference manual.
[in] presc The clock prescaler.

Definition at line 5610 of file em_cmu.c .

References CMU_ClockFreqGet() , CMU_PrescToLog2() , cmuClock_ADC0ASYNC , cmuClock_HFLE , cmuClock_LETIMER0 , cmuClock_LEUART0 , cmuClock_RTCC , and SystemCoreClockGet() .

Referenced by CMU_ClockDivSet() .

CMU_Select_TypeDef CMU_ClockSelectGet ( CMU_Clock_TypeDef clock )

Get the currently selected reference clock used for a clock branch.

Parameters
[in] clock Clock branch to fetch selected ref. clock for. One of:
Returns
The reference clock used for clocking the selected branch, cmuSelect_Error if invalid clock provided.

Definition at line 5944 of file em_cmu.c .

References cmuSelect_AUXHFRCO , cmuSelect_Disabled , cmuSelect_Error , cmuSelect_HFCLK , cmuSelect_HFCLKLE , cmuSelect_HFRCO , cmuSelect_HFSRCCLK , cmuSelect_HFXO , cmuSelect_LFRCO , cmuSelect_LFXO , and cmuSelect_ULFRCO .

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

void CMU_ClockSelectSet ( CMU_Clock_TypeDef clock,
CMU_Select_TypeDef ref
)

Select the 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.

Note
HFCLKLE prescaler is automatically modified when peripherals with clock domain HFBUSCLK is chosen based on the maximum HFLE frequency allowed.
Parameters
[in] clock A clock branch to select reference clock for. One of:
[in] ref A reference selected for clocking. See the reference manual for details about references available for a specific clock branch.

Definition at line 6507 of file em_cmu.c .

References BUS_RegBitWrite() , CMU_ClockFreqGet() , CMU_HFRCOBandGet() , CMU_OscillatorEnable() , cmuClock_HF , cmuClock_HFLE , cmuOsc_AUXHFRCO , cmuOsc_HFRCO , cmuOsc_HFXO , cmuOsc_LFRCO , cmuOsc_LFXO , cmuSelect_AUXHFRCO , cmuSelect_Disabled , cmuSelect_HFCLK , cmuSelect_HFCLKLE , cmuSelect_HFRCO , cmuSelect_HFSRCCLK , cmuSelect_HFXO , cmuSelect_LFRCO , cmuSelect_LFXO , cmuSelect_ULFRCO , SL_FALLTHROUGH , SystemCoreClockGet() , and SystemHFXOClockGet() .

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

__STATIC_INLINE uint32_t CMU_DivToLog2 ( CMU_ClkDiv_TypeDef div )

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

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

Definition at line 2724 of file em_cmu.h .

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

void CMU_FreezeEnable ( bool enable )

CMU low frequency register synchronization freeze control.

Some CMU registers require 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 use case for this feature is 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 unnecessary stalling.
Parameters
[in] enable
  • true - enable freeze, modified registers are not propagated to the LF domain
  • false - disable freeze, modified registers are propagated to the LF domain

Definition at line 7395 of file em_cmu.c .

CMU_HFRCOFreq_TypeDef CMU_HFRCOBandGet ( void )

Get the current HFRCO frequency.

Returns
HFRCO frequency.

Definition at line 7587 of file em_cmu.c .

References SystemHfrcoFreq .

Referenced by CMU_ClockSelectSet() , and CMU_HFRCOFreqGet() .

void CMU_HFRCOBandSet ( CMU_HFRCOFreq_TypeDef setFreq )

Set the HFRCO calibration for the selected target frequency.

Note
HFCLKLE prescaler is automatically modified based on the maximum HFLE frequency allowed.
Parameters
[in] setFreq HFRCO frequency to set.

Definition at line 7603 of file em_cmu.c .

References BUS_RegBitRead() , CMU_ClockFreqGet() , CMU_ClockSelectGet() , CMU_HFRCODevinfoGet() , cmuClock_HF , cmuClock_HFLE , cmuHFRCOFreq_1M0Hz , cmuHFRCOFreq_2M0Hz , cmuHFRCOFreq_4M0Hz , cmuSelect_HFRCO , SystemCoreClockGet() , and SystemHfrcoFreq .

Referenced by CMU_HFRCOFreqSet() .

static uint32_t CMU_HFRCODevinfoGet ( CMU_HFRCOFreq_TypeDef freq )
static

Get the HFRCO frequency calibration word in DEVINFO.

Parameters
[in] freq Frequency in Hz.
Returns
HFRCO calibration word for a given frequency.

Definition at line 7525 of file em_cmu.c .

References cmuHFRCOFreq_13M0Hz , cmuHFRCOFreq_16M0Hz , cmuHFRCOFreq_19M0Hz , cmuHFRCOFreq_1M0Hz , cmuHFRCOFreq_26M0Hz , cmuHFRCOFreq_2M0Hz , cmuHFRCOFreq_32M0Hz , cmuHFRCOFreq_38M0Hz , cmuHFRCOFreq_4M0Hz , and cmuHFRCOFreq_7M0Hz .

Referenced by CMU_HFRCOBandSet() .

__STATIC_INLINE CMU_HFRCOFreq_TypeDef CMU_HFRCOFreqGet ( void )

Get the current HFRCO frequency.

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

Definition at line 2894 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:
A deprecated function. New code should use CMU_HFRCOBandSet() .
Parameters
[in] setFreq HFRCO frequency to set.

Definition at line 2909 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] userSel Additional user specified enable bit.
[in] enEM0EM1Start If 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] enEM0EM1StartSel If 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. HFCLKLE prescaler is also automatically modified if userSel is specified. If false, HFXO is not started or selected automatically when entering EM0/EM1.

Definition at line 7831 of file em_cmu.c .

References CMU_OscillatorEnable() , cmuOsc_HFXO , and SystemHFXOClockGet() .

Referenced by BSP_initClocks() .

__STATIC_INLINE void CMU_IntClear ( uint32_t flags )

Clear one or more pending CMU interrupts.

Parameters
[in] flags CMU interrupt sources to clear.

Definition at line 2757 of file em_cmu.h .

__STATIC_INLINE void CMU_IntDisable ( uint32_t flags )

Disable one or more CMU interrupts.

Parameters
[in] flags CMU interrupt sources to disable.

Definition at line 2769 of file em_cmu.h .

__STATIC_INLINE void CMU_IntEnable ( uint32_t flags )

Enable one or more CMU interrupts.

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

Definition at line 2786 of file em_cmu.h .

__STATIC_INLINE uint32_t CMU_IntGet ( void )

Get pending CMU interrupts.

Returns
CMU interrupt sources pending.

Definition at line 2798 of file em_cmu.h .

__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
This function does not clear event bits.
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 2819 of file em_cmu.h .

__STATIC_INLINE void CMU_IntSet ( uint32_t flags )

Set one or more pending CMU interrupts.

Parameters
[in] flags CMU interrupt sources to set to pending.

Definition at line 2834 of file em_cmu.h .

uint32_t CMU_LCDClkFDIVGet ( void )

Get the LCD framerate divisor (FDIV) setting.

Returns
The LCD framerate divisor.

Definition at line 8032 of file em_cmu.c .

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. See CMU_ClockEnable() for disabling/enabling LCD clock.
Parameters
[in] div The FDIV setting to use.

Definition at line 8054 of file em_cmu.c .

References 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 data sheet. This function disables the LFXO when necessary to ensure a valid state before update.
Parameters
[in] lfxoInit LFXO setup parameters.

Definition at line 8084 of file em_cmu.c .

References BUS_RegBitWrite() , BUS_RegMaskedWrite() , CMU_ClockSelectGet() , CMU_OscillatorEnable() , cmuClock_HF , cmuOsc_LFXO , cmuSelect_LFXO , CMU_LFXOInit_TypeDef::ctune , 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 to protect some of its registers against unintended modification.

See 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 2852 of file em_cmu.h .

Referenced by EMU_EnterEM3() .

__STATIC_INLINE uint32_t CMU_Log2ToDiv ( uint32_t log2 )

Convert logarithm of 2 prescaler to division factor.

Deprecated:
Deprecated and marked for removal in a later release. It will be replaced by SL_Log2ToDiv.
Parameters
[in] log2 Logarithm of 2, as used by fixed prescalers.
Returns
Dividend.

Definition at line 2869 of file em_cmu.h .

References SL_Log2ToDiv() .

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. In other words, 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] osc The oscillator to enable/disable.
[in] enable
  • true - enable specified oscillator.
  • false - disable specified oscillator.
[in] wait Only 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 8151 of file em_cmu.c .

References BUS_RegBitRead() , CMU_OscillatorTuningGet() , CMU_OscillatorTuningOptimize() , CMU_OscillatorTuningSet() , CMU_OscillatorTuningWait() , cmuHFXOTuningMode_ShuntCommand , cmuOsc_AUXHFRCO , cmuOsc_HFRCO , cmuOsc_HFXO , cmuOsc_LFRCO , and cmuOsc_LFXO .

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

uint32_t CMU_OscillatorTuningGet ( CMU_Osc_TypeDef osc )

Get the oscillator frequency tuning setting.

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

Definition at line 8340 of file em_cmu.c .

References cmuOsc_AUXHFRCO , cmuOsc_HFRCO , cmuOsc_HFXO , and cmuOsc_LFRCO .

Referenced by CMU_OscillatorEnable() .

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

Start and optionally wait for the oscillator tuning optimization.

Parameters
[in] osc An oscillator to set tuning value for, one of the following:
[in] mode Tuning optimization mode.
[in] wait Wait 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 8584 of file em_cmu.c .

References 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 reset. Changing the tuning value from the calibrated value is for more advanced use. Certain oscillators also have build-in tuning optimization.
Parameters
[in] osc An oscillator to set tuning value for, one of the following:
[in] val The oscillator frequency tuning setting to use.

Definition at line 8408 of file em_cmu.c .

References BUS_RegBitRead() , cmuOsc_AUXHFRCO , cmuOsc_HFRCO , cmuOsc_HFXO , and cmuOsc_LFRCO .

Referenced by CMU_OscillatorEnable() .

bool CMU_OscillatorTuningWait ( CMU_Osc_TypeDef osc,
CMU_HFXOTuningMode_TypeDef mode
)

Wait for the oscillator tuning optimization.

Parameters
[in] osc An oscillator to set tuning value for, one of the following:
[in] mode Tuning optimization mode.
Returns
Returns false on invalid parameters or oscillator error status.

Definition at line 8518 of file em_cmu.c .

References cmuHFXOTuningMode_PeakShuntCommand , cmuHFXOTuningMode_ShuntCommand , and cmuOsc_HFXO .

Referenced by CMU_OscillatorEnable() , and CMU_OscillatorTuningOptimize() .

bool CMU_PCNTClockExternalGet ( unsigned int instance )

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

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

Definition at line 8621 of file em_cmu.c .

void CMU_PCNTClockExternalSet ( unsigned int instance,
bool external
)

Select the PCNTn clock.

Parameters
[in] instance PCNT instance number to set selected clock source for.
[in] external Set to true to select the external clock, false to select LFBCLK.

Definition at line 8661 of file em_cmu.c .

References BUS_RegBitWrite() .

Referenced by PCNT_Init() , and PCNT_Reset() .

__STATIC_INLINE uint32_t CMU_PrescToLog2 ( uint32_t presc )

Convert prescaler dividend to a logarithmic value. It only works for even numbers equal to 2^n.

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

Definition at line 2961 of file em_cmu.h .

References SL_Log2ToDiv() .

Referenced by CMU_ClockPrescSet() .