CMU - Clock Management Unit

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_LFXOInit_TypeDef
 LFXO initialization structure.
 
struct  CMU_HFXOInit_TypeDef
 HFXO initialization structure.
 
struct  CMU_DPLLInit_TypeDef
 DPLL initialization structure.
 

Functions

void CMU_UpdateWaitStates (uint32_t freq, int vscale)
 Configure various wait states to switch to a certain frequency and a certain voltage scale.
 
uint32_t getHfxoTuningMode (void)
 Get the HFXO tuning mode.
 
void setHfxoTuningMode (uint32_t mode)
 Set the HFXO tuning mode.
 
void syncReg (uint32_t mask)
 Wait for an ongoing sync of register(s) to low-frequency domain to complete.
 
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.
 
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.
 
uint32_t CMU_CalibrateCountGet (void)
 Get the calibration count register.
 
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.
 
uint16_t CMU_LF_ClockPrecisionGet (CMU_Clock_TypeDef clock)
 Gets the precision (in PPM) of the specified low frequency clock branch.
 
bool CMU_DPLLLock (const CMU_DPLLInit_TypeDef *init)
 Lock the DPLL to a given frequency.
 
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.
 
CMU_USHFRCOFreq_TypeDef CMU_USHFRCOBandGet (void)
 Get the current USHFRCO frequency.
 
uint32_t CMU_USHFRCOFreqGet (void)
 Get USHFRCO frequency.
 
void CMU_USHFRCOBandSet (CMU_USHFRCOFreq_TypeDef setFreq)
 Set the USHFRCO 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.
 
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.
 
void CMU_LFXOPrecisionSet (uint16_t precision)
 Sets LFXO's crystal precision, in PPM.
 
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.
 
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_OscillatorTuningOptimize (CMU_Osc_TypeDef osc, CMU_HFXOTuningMode_TypeDef mode, bool wait)
 Start and optionally 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.
 
void CMU_CalibrateCont (bool enable)
 Configure continuous calibration mode.
 
void CMU_CalibrateStart (void)
 Start calibration.
 
void CMU_CalibrateStop (void)
 Stop the calibration counters.
 
uint32_t CMU_DivToLog2 (CMU_ClkDiv_TypeDef div)
 Convert dividend to logarithmic value.
 
void CMU_DPLLUnlock (void)
 Unlock DPLL.
 
void CMU_IntClear (uint32_t flags)
 Clear one or more pending CMU interrupts.
 
void CMU_IntDisable (uint32_t flags)
 Disable one or more CMU interrupts.
 
void CMU_IntEnable (uint32_t flags)
 Enable one or more CMU interrupts.
 
uint32_t CMU_IntGet (void)
 Get pending CMU interrupts.
 
uint32_t CMU_IntGetEnabled (void)
 Get enabled and pending CMU interrupt flags.
 
void CMU_IntSet (uint32_t flags)
 Set one or more pending CMU interrupts.
 
void CMU_Lock (void)
 Lock the CMU to protect some of its registers against unintended modification.
 
SL_DEPRECATED_API_SDK_4_1 uint32_t CMU_Log2ToDiv (uint32_t log2)
 Convert logarithm of 2 prescaler to division factor.
 
void CMU_Unlock (void)
 Unlock the CMU so that writing to locked registers again is possible.
 
SL_DEPRECATED_API_SDK_4_1 CMU_HFRCOFreq_TypeDef CMU_HFRCOFreqGet (void)
 Get the current HFRCO frequency.
 
SL_DEPRECATED_API_SDK_4_1 void CMU_HFRCOFreqSet (CMU_HFRCOFreq_TypeDef setFreq)
 Set HFRCO calibration for the selected target frequency.
 
SL_DEPRECATED_API_SDK_4_1 CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOFreqGet (void)
 Get the current AUXHFRCO frequency.
 
SL_DEPRECATED_API_SDK_4_1 void CMU_AUXHFRCOFreqSet (CMU_AUXHFRCOFreq_TypeDef setFreq)
 Set AUXHFRCO calibration for the selected target frequency.
 
uint32_t CMU_PrescToLog2 (uint32_t presc)
 Convert prescaler dividend to a logarithmic value.
 

Macros

#define cmuClkDiv_1   1
 Clock divisors.
 
#define cmuClkDiv_2   2
 Divide clock by 2.
 
#define cmuClkDiv_4   4
 Divide clock by 4.
 
#define cmuClkDiv_8   8
 Divide clock by 8.
 
#define cmuClkDiv_16   16
 Divide clock by 16.
 
#define cmuClkDiv_32   32
 Divide clock by 32.
 
#define cmuClkDiv_64   64
 Divide clock by 64.
 
#define cmuClkDiv_128   128
 Divide clock by 128.
 
#define cmuClkDiv_256   256
 Divide clock by 256.
 
#define cmuClkDiv_512   512
 Divide clock by 512.
 
#define cmuClkDiv_1024   1024
 Divide clock by 1024.
 
#define cmuClkDiv_2048   2048
 Divide clock by 2048.
 
#define cmuClkDiv_4096   4096
 Divide clock by 4096.
 
#define cmuClkDiv_8192   8192
 Divide clock by 8192.
 
#define cmuClkDiv_16384   16384
 Divide clock by 16384.
 
#define cmuClkDiv_32768   32768
 Divide clock by 32768.
 
#define CMU_USHFRCO_MIN   cmuUSHFRCOFreq_16M0Hz
 USHFRCO minimum frequency.
 
#define CMU_USHFRCO_MAX   cmuUSHFRCOFreq_50M0Hz
 USHFRCO maximum frequency.
 
#define CMU_HFRCO_MIN   cmuHFRCOFreq_1M0Hz
 HFRCO minimum frequency.
 
#define CMU_HFRCO_MAX   cmuHFRCOFreq_72M0Hz
 HFRCO maximum frequency.
 
#define CMU_AUXHFRCO_MIN   cmuAUXHFRCOFreq_1M0Hz
 AUXHFRCO minimum frequency.
 
#define CMU_AUXHFRCO_MAX   cmuAUXHFRCOFreq_50M0Hz
 AUXHFRCO maximum frequency.
 
#define CMU_LFXOINIT_DEFAULT
 Default LFXO initialization values.
 
#define CMU_LFXOINIT_EXTERNAL_CLOCK
 Default LFXO initialization for external clock.
 
#define CMU_HFXOINIT_DEFAULT
 Default HFXO init.
 
#define CMU_HFXOINIT_EXTERNAL_CLOCK
 Init of HFXO with external clock.
 
#define CMU_DPLL_LFXO_TO_40MHZ
 DPLL initialization values for 39,998,805 Hz using LFXO as reference clock, M=2 and N=3661.
 

Typedefs

typedef uint32_t CMU_ClkDiv_TypeDef
 Clock divider configuration.
 
typedef uint32_t CMU_ClkPresc_TypeDef
 Clockprescaler configuration.
 

Enumerations

enum  CMU_USHFRCOFreq_TypeDef {
  cmuUSHFRCOFreq_16M0Hz = 16000000U,
  cmuUSHFRCOFreq_32M0Hz = 32000000U,
  cmuUSHFRCOFreq_48M0Hz = 48000000U,
  cmuUSHFRCOFreq_50M0Hz = 50000000U,
  cmuUSHFRCOFreq_UserDefined = 0
}
 High-USHFRCO bands.
 
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
}
 High-frequency system RCO bands.
 
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
}
 AUX high-frequency RCO bands.
 
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_HFPERB,
  cmuClock_HFPERC,
  cmuClock_PDM,
  cmuClock_USART0,
  cmuClock_USART1,
  cmuClock_USART2,
  cmuClock_USART3,
  cmuClock_USART4,
  cmuClock_UART0,
  cmuClock_UART1,
  cmuClock_TIMER0,
  cmuClock_TIMER1,
  cmuClock_TIMER2,
  cmuClock_TIMER3,
  cmuClock_WTIMER0,
  cmuClock_WTIMER1,
  cmuClock_CRYOTIMER,
  cmuClock_ACMP0,
  cmuClock_ACMP1,
  cmuClock_ACMP2,
  cmuClock_VDAC0,
  cmuClock_IDAC0,
  cmuClock_ADC0,
  cmuClock_ADC1,
  cmuClock_I2C0,
  cmuClock_I2C1,
  cmuClock_CSEN_HF,
  cmuClock_TRNG0,
  cmuClock_CAN0,
  cmuClock_CAN1,
  cmuClock_CORE,
  cmuClock_EBI,
  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,