CMU - Clock Management Unit#
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.
Modules#
CMU_CrystalSharingFollowerInit_TypeDef
Enumerations#
HFRCODPLL frequency bands.
HFRCOEM23 frequency bands.
Clock points in CMU clock-tree.
Oscillator types.
Selectable clock sources.
DPLL reference clock edge detect selector.
DPLL lock mode selector.
LFXO oscillator modes.
LFXO start-up timeout delay.
HFXO oscillator modes.
HFXO core bias LSB change timeout.
HFXO steady state timeout.
HFXO core degeneration control.
HFXO XI and XO pin fixed capacitor control.
Crystal sharing timeout start up timeout.
PRS status select output signal.
Typedefs#
Clock divider configuration.
Functions#
Calibrate an oscillator.
Configure clock calibration.
Get calibration count value.
Direct a clock to a GPIO pin.
Get clock divisor.
Set clock divisor.
Enable/disable a clock.
Get clock frequency for a clock point.
Get currently selected reference clock used for a clock branch.
Select reference clock/oscillator used for a clock branch.
Gets the precision (in PPM) of the specified low frequency clock branch.
Gets the precision (in PPM) of the specified high frequency clock branch.
Get HFRCODPLL band in use.
Set HFRCODPLL band and the tuning value based on the value in the calibration table made during production.
Lock the DPLL to a given frequency.
Initialize all HFXO control registers.
Initialize HFXO Bufout (Crystal sharing) leader control registers.
Initialize HFXO Bufout (Crystal sharing) follower control registers.
Set the HFXO crystal tuning capacitance.
Get the HFXO crystal tuning capacitance.
Set the HFXO crystal tuning delta.
Get the HFXO crystal tuning delta.
Get the current delta between HFXO XI and XO.
Recalibrate the HFXO's Core Bias Current.
Initialize LFXO control registers.
Sets LFXO's crystal precision, in PPM.
Gets LFXO's crystal precision, in PPM.
Sets HFXO's crystal precision, in PPM.
Gets HFXO's crystal precision, in PPM.
Get oscillator frequency tuning setting.
Set the oscillator frequency tuning control.
Configure wait state settings necessary to switch to a given core clock frequency at a certain voltage scale level.
Select the PCNTn clock.
Get HFRCOEM23 band in use.
Set HFRCOEM23 band and the tuning value based on the value in the calibration table made during production.
Configure continuous calibration mode.
Start calibration.
Stop calibration counters.
Unlock the DPLL.
Clear one or more pending CMU interrupt flags.
Disable one or more CMU interrupt sources.
Enable one or more CMU interrupt sources.
Get pending CMU interrupt sources.
Get enabled and pending CMU interrupt flags.
Set one or more pending CMU interrupt sources.
Lock CMU register access in order to protect registers contents against unintended modification.
Enable/disable oscillator.
Unlock CMU register access so that writing to registers is possible.
Lock WDOG register access in order to protect registers contents against unintended modification.
Unlock WDOG register access so that writing to registers is possible.
Convert prescaler divider to a logarithmic value.
Macros#
Macro to set clock sources in the clock tree.
Disable clocks configuration.
Shifted mode DISABLED for CMU_EM01GRPACLKCTRL.
Mode DISABLED for CMU_EM01GRPBCLKCTRL
Shifted mode DISABLED for CMU_EM01GRPBCLKCTRL.
Mode DISABLED for CMU_EM23GRPACLKCTRL
Shifted mode DISABLED for CMU_EM23GRPACLKCTRL.
Mode DISABLED for CMU_EM4GRPACLKCTRL
Shifted mode DISABLED for CMU_EM4GRPACLKCTRL.
Mode DISABLED for CMU_WDOG0CLKCTRL
Shifted mode DISABLED for CMU_WDOG0CLKCTRL
Mode DISABLED for CMU_WDOG1CLKCTRL
Shifted mode DISABLED for CMU_WDOG1CLKCTRL
Mode DISABLED for CMU_EUSART0CLKCTRL
Shifted mode DISABLED for CMU_EUSART0CLKCTRL.
Mode DISABLED for CMU_SYSRTC0CLKCTRL
Shifted mode DISABLED for CMU_SYSRTC0CLKCTRL.
HFRCODPLL maximum frequency.
HFRCODPLL minimum frequency.
HFRCOEM23 maximum frequency.
HFRCOEM23 minimum frequency.
Default LFXO initialization values for XTAL mode.
Default LFXO initialization values for external clock mode.
Default LFXO initialization values for external sine mode.
Default configuration of fixed tuning capacitance on XI or XO for EFR32XG23 and EFR32XG28.
Default HFXO initialization values for XTAL mode.
Default HFXO initialization values for external sine mode.
Default HFXO initialization values for external sine mode with peak detector.
Default crystal sharing master initialization values.
Default crystal sharing follower initialization values.
DPLL initialization values for 39,998,805 Hz using LFXO as reference clock, M=2 and N=3661.
DPLL initialization values for 76,800,000 Hz using HFXO as reference clock, M = 1919, N = 3839.
DPLL initialization values for 80,000,000 Hz using HFXO as reference clock, M = 1919, N = 3999.
Default configurations for DPLL initialization.
Enumeration Documentation#
CMU_HFRCODPLLFreq_TypeDef#
CMU_HFRCODPLLFreq_TypeDef
HFRCODPLL frequency bands.
Enumerator | |
---|---|
cmuHFRCODPLLFreq_1M0Hz | 1MHz RC band. |
cmuHFRCODPLLFreq_2M0Hz | 2MHz RC band. |
cmuHFRCODPLLFreq_4M0Hz | 4MHz RC band. |
cmuHFRCODPLLFreq_7M0Hz | 7MHz RC band. |
cmuHFRCODPLLFreq_13M0Hz | 13MHz RC band. |
cmuHFRCODPLLFreq_16M0Hz | 16MHz RC band. |
cmuHFRCODPLLFreq_19M0Hz | 19MHz RC band. |
cmuHFRCODPLLFreq_26M0Hz | 26MHz RC band. |
cmuHFRCODPLLFreq_32M0Hz | 32MHz RC band. |
cmuHFRCODPLLFreq_38M0Hz | 38MHz RC band. |
cmuHFRCODPLLFreq_48M0Hz | 48MHz RC band. |
cmuHFRCODPLLFreq_56M0Hz | 56MHz RC band. |
cmuHFRCODPLLFreq_64M0Hz | 64MHz RC band. |
cmuHFRCODPLLFreq_80M0Hz | 80MHz RC band. |
cmuHFRCODPLLFreq_UserDefined |
CMU_HFRCOEM23Freq_TypeDef#
CMU_HFRCOEM23Freq_TypeDef
HFRCOEM23 frequency bands.
Enumerator | |
---|---|
cmuHFRCOEM23Freq_1M0Hz | 1MHz RC band. |
cmuHFRCOEM23Freq_2M0Hz | 2MHz RC band. |
cmuHFRCOEM23Freq_4M0Hz | 4MHz RC band. |
cmuHFRCOEM23Freq_13M0Hz | 13MHz RC band. |
cmuHFRCOEM23Freq_16M0Hz | 16MHz RC band. |
cmuHFRCOEM23Freq_19M0Hz | 19MHz RC band. |
cmuHFRCOEM23Freq_26M0Hz | 26MHz RC band. |
cmuHFRCOEM23Freq_32M0Hz | 32MHz RC band. |
cmuHFRCOEM23Freq_40M0Hz | 40MHz RC band. |
cmuHFRCOEM23Freq_UserDefined |
CMU_Clock_TypeDef#
CMU_Clock_TypeDef
Clock points in CMU clock-tree.
Enumerator | |
---|---|
cmuClock_SYSCLK | SYSTEM clock. |
cmuClock_SYSTICK | SYSTICK clock. |
cmuClock_HCLK | Core and AHB bus interface clock. |
cmuClock_EXPCLK | Export clock. |
cmuClock_PCLK | Peripheral APB bus interface clock. |
cmuClock_LSPCLK | Low speed peripheral APB bus interface clock. |
cmuClock_TRACECLK | Debug trace. |
cmuClock_EM01GRPACLK | EM01GRPA clock. |
cmuClock_EM01GRPCCLK | EM01GRPC clock. |
cmuClock_EUSART0CLK | EUSART0 clock. |
cmuClock_IADCCLK | IADC clock. |
cmuClock_EM23GRPACLK | EM23GRPA clock. |
cmuClock_WDOG0CLK | WDOG0 clock. |
cmuClock_WDOG1CLK | WDOG1 clock. |
cmuClock_SYSRTCCLK | SYSRTC clock. |
cmuClock_EM4GRPACLK | EM4GRPA clock. |
cmuClock_DPLLREFCLK | DPLLREF clock. |
cmuClock_LCDCLK | LCD clock. |
cmuClock_VDAC0CLK | VDAC0 clock. |
cmuClock_PCNT0CLK | PCNT0 clock. |
cmuClock_LESENSEHFCLK | LESENSE high frequency clock. |
cmuClock_LESENSECLK | LESENSE low frequency clock. |
cmuClock_CORE | Cortex-M33 core clock. |
cmuClock_LDMA | LDMA clock. |
cmuClock_LDMAXBAR | LDMAXBAR clock. |
cmuClock_GPCRC | GPCRC clock. |
cmuClock_TIMER0 | TIMER0 clock. |
cmuClock_TIMER1 | TIMER1 clock. |
cmuClock_TIMER2 | TIMER2 clock. |
cmuClock_TIMER3 | TIMER3 clock. |
cmuClock_TIMER4 | TIMER4 clock. |
cmuClock_USART0 | USART0 clock. |
cmuClock_IADC0 | IADC0 clock. |
cmuClock_AMUXCP0 | AMUXCP0 clock. |
cmuClock_LETIMER0 | LETIMER0 clock. |
cmuClock_WDOG0 | WDOG0 clock. |
cmuClock_WDOG1 | WDOG1 clock. |
cmuClock_I2C0 | I2C0 clock. |
cmuClock_I2C1 | I2C1 clock. |
cmuClock_SYSCFG | SYSCFG clock. |
cmuClock_DPLL0 | DPLL0 clock. |
cmuClock_HFRCO0 | HFRCO0 clock. |
cmuClock_HFRCOEM23 | HFRCOEM23 clock. |
cmuClock_HFXO | HFXO clock. |
cmuClock_FSRCO | FSRCO clock. |
cmuClock_LFRCO | LFRCO clock. |
cmuClock_LFXO | LFXO clock. |
cmuClock_ULFRCO | ULFRCO clock. |
cmuClock_GPIO | GPIO clock. |
cmuClock_PRS | PRS clock. |
cmuClock_BURAM | BURAM clock. |
cmuClock_BURTC | BURTC clock. |
cmuClock_DCDC | DCDC clock. |
cmuClock_SYSRTC | SYSRTC clock. |
cmuClock_EUSART0 | EUSART0 clock. |
cmuClock_EUSART1 | EUSART1 clock. |
cmuClock_EUSART2 | EUSART2 clock. |
cmuClock_SEMAILBOX | SEMAILBOX clock. |
cmuClock_SMU | SMU clock. |
cmuClock_ICACHE | ICACHE clock. |
cmuClock_LESENSE | LESENSE clock. |
cmuClock_ACMP0 | ACMP0 clock. |
cmuClock_ACMP1 | ACMP1 clock. |
cmuClock_VDAC0 | VDAC0 clock. |
cmuClock_PCNT0 | PCNT0 clock. |
cmuClock_DMEM | DMEM clock. |
cmuClock_KEYSCAN | KEYSCAN clock. |
cmuClock_LCD | LCD clock. |
cmuClock_MSC | MSC clock. |
CMU_Osc_TypeDef#
CMU_Osc_TypeDef
Oscillator types.
Enumerator | |
---|---|
cmuOsc_LFXO | Low frequency crystal oscillator. |
cmuOsc_LFRCO | Low frequency RC oscillator. |
cmuOsc_FSRCO | Fast startup fixed frequency RC oscillator. |
cmuOsc_HFXO | High frequency crystal oscillator. |
cmuOsc_HFRCODPLL | High frequency RC and DPLL oscillator. |
cmuOsc_HFRCOEM23 | High frequency deep sleep RC oscillator. |
cmuOsc_ULFRCO | Ultra low frequency RC oscillator. |
CMU_Select_TypeDef#
CMU_Select_TypeDef
Selectable clock sources.
Enumerator | |
---|---|
cmuSelect_Error | Usage error. |
cmuSelect_Disabled | Clock selector disabled. |
cmuSelect_FSRCO | Fast startup fixed frequency RC oscillator. |
cmuSelect_HFXO | High frequency crystal oscillator. |
cmuSelect_HFXORT | Re-timed high frequency crystal oscillator. |
cmuSelect_HFRCODPLL | High frequency RC and DPLL oscillator. |
cmuSelect_HFRCODPLLRT | Re-timed high frequency RC and DPLL oscillator. |
cmuSelect_HFRCOEM23 | High frequency deep sleep RC oscillator. |
cmuSelect_CLKIN0 | External clock input. |
cmuSelect_LFXO | Low frequency crystal oscillator. |
cmuSelect_LFRCO | Low frequency RC oscillator. |
cmuSelect_ULFRCO | Ultra low frequency RC oscillator. |
cmuSelect_HCLK | Core and AHB bus interface clock. |
cmuSelect_SYSCLK | System clock. |
cmuSelect_HCLKDIV1024 | Prescaled HCLK frequency clock. |
cmuSelect_EM01GRPACLK | EM01GRPA clock. |
cmuSelect_EM23GRPACLK | EM23GRPA clock. |
cmuSelect_EM01GRPCCLK | EM01GRPC clock. |
cmuSelect_EXPCLK | Pin export clock. |
cmuSelect_PRS | PRS input as clock. |
cmuSelect_PCNTEXTCLK | Pulse counter external source or PRS as clock. |
cmuSelect_TEMPOSC | Temperature oscillator. |
cmuSelect_PFMOSC | PFM oscillator. |
cmuSelect_BIASOSC | BIAS oscillator. |
CMU_DPLLEdgeSel_TypeDef#
CMU_DPLLEdgeSel_TypeDef
DPLL reference clock edge detect selector.
Enumerator | |
---|---|
cmuDPLLEdgeSel_Fall | Detect falling edge of reference clock. |
cmuDPLLEdgeSel_Rise | Detect rising edge of reference clock. |
CMU_DPLLLockMode_TypeDef#
CMU_DPLLLockMode_TypeDef
DPLL lock mode selector.
Enumerator | |
---|---|
cmuDPLLLockMode_Freq | Frequency lock mode. |
cmuDPLLLockMode_Phase | Phase lock mode. |
CMU_LfxoOscMode_TypeDef#
CMU_LfxoOscMode_TypeDef
LFXO oscillator modes.
Enumerator | |
---|---|
cmuLfxoOscMode_Crystal | Crystal oscillator. |
cmuLfxoOscMode_AcCoupledSine | External AC coupled sine. |
cmuLfxoOscMode_External | External digital clock. |
CMU_LfxoStartupDelay_TypeDef#
CMU_LfxoStartupDelay_TypeDef
LFXO start-up timeout delay.
Enumerator | |
---|---|
cmuLfxoStartupDelay_2Cycles | 2 cycles start-up delay. |
cmuLfxoStartupDelay_256Cycles | 256 cycles start-up delay. |
cmuLfxoStartupDelay_1KCycles | 1K cycles start-up delay. |
cmuLfxoStartupDelay_2KCycles | 2K cycles start-up delay. |
cmuLfxoStartupDelay_4KCycles | 4K cycles start-up delay. |
cmuLfxoStartupDelay_8KCycles | 8K cycles start-up delay. |
cmuLfxoStartupDelay_16KCycles | 16K cycles start-up delay. |
cmuLfxoStartupDelay_32KCycles | 32K cycles start-up delay. |
CMU_HfxoOscMode_TypeDef#
CMU_HfxoOscMode_TypeDef
HFXO oscillator modes.
Enumerator | |
---|---|
cmuHfxoOscMode_Crystal | Crystal oscillator. |
cmuHfxoOscMode_ExternalSine | External digital clock. |
cmuHfxoOscMode_ExternalSinePkDet | External digital clock with peak detector used. |
CMU_HfxoCbLsbTimeout_TypeDef#
CMU_HfxoCbLsbTimeout_TypeDef
HFXO core bias LSB change timeout.
Enumerator | |
---|---|
cmuHfxoCbLsbTimeout_8us | 8 us timeout. |
cmuHfxoCbLsbTimeout_20us | 20 us timeout. |
cmuHfxoCbLsbTimeout_41us | 41 us timeout. |
cmuHfxoCbLsbTimeout_62us | 62 us timeout. |
cmuHfxoCbLsbTimeout_83us | 83 us timeout. |
cmuHfxoCbLsbTimeout_104us | 104 us timeout. |
cmuHfxoCbLsbTimeout_125us | 125 us timeout. |
cmuHfxoCbLsbTimeout_166us | 166 us timeout. |
cmuHfxoCbLsbTimeout_208us | 208 us timeout. |
cmuHfxoCbLsbTimeout_250us | 250 us timeout. |
cmuHfxoCbLsbTimeout_333us | 333 us timeout. |
cmuHfxoCbLsbTimeout_416us | 416 us timeout. |
cmuHfxoCbLsbTimeout_833us | 833 us timeout. |
cmuHfxoCbLsbTimeout_1250us | 1250 us timeout. |
cmuHfxoCbLsbTimeout_2083us | 2083 us timeout. |
cmuHfxoCbLsbTimeout_3750us | 3750 us timeout. |
CMU_HfxoSteadyStateTimeout_TypeDef#
CMU_HfxoSteadyStateTimeout_TypeDef
HFXO steady state timeout.
Enumerator | |
---|---|
cmuHfxoSteadyStateTimeout_16us | 16 us timeout. |
cmuHfxoSteadyStateTimeout_41us | 41 us timeout. |
cmuHfxoSteadyStateTimeout_83us | 83 us timeout. |
cmuHfxoSteadyStateTimeout_125us | 125 us timeout. |
cmuHfxoSteadyStateTimeout_166us | 166 us timeout. |
cmuHfxoSteadyStateTimeout_208us | 208 us timeout. |
cmuHfxoSteadyStateTimeout_250us | 250 us timeout. |
cmuHfxoSteadyStateTimeout_333us | 333 us timeout. |
cmuHfxoSteadyStateTimeout_416us | 416 us timeout. |
cmuHfxoSteadyStateTimeout_500us | 500 us timeout. |
cmuHfxoSteadyStateTimeout_666us | 666 us timeout. |
cmuHfxoSteadyStateTimeout_833us | 833 us timeout. |
cmuHfxoSteadyStateTimeout_1666us | 1666 us timeout. |
cmuHfxoSteadyStateTimeout_2500us | 2500 us timeout. |
cmuHfxoSteadyStateTimeout_4166us | 4166 us timeout. |
CMU_HfxoCoreDegen_TypeDef#
CMU_HfxoCoreDegen_TypeDef
HFXO core degeneration control.
Enumerator | |
---|---|
cmuHfxoCoreDegen_None | No core degeneration. |
cmuHfxoCoreDegen_33 | Core degeneration control 33. |
cmuHfxoCoreDegen_50 | Core degeneration control 50. |
cmuHfxoCoreDegen_100 | Core degeneration control 100. |
CMU_HfxoCtuneFixCap_TypeDef#
CMU_HfxoCtuneFixCap_TypeDef
HFXO XI and XO pin fixed capacitor control.
Enumerator | |
---|---|
cmuHfxoCtuneFixCap_None | No fixed capacitors. |
cmuHfxoCtuneFixCap_Xi | Fixed capacitor on XI pin. |
cmuHfxoCtuneFixCap_Xo | Fixed capacitor on XO pin. |
cmuHfxoCtuneFixCap_Both | Fixed capacitor on both pins. |
CMU_Precision_TypeDef#
CMU_Precision_TypeDef
Oscillator precision modes.
Enumerator | |
---|---|
cmuPrecisionDefault | Default precision mode. |
cmuPrecisionHigh | High precision mode. |
CMU_BufoutTimeoutStartup_TypeDef#
CMU_BufoutTimeoutStartup_TypeDef
Crystal sharing timeout start up timeout.
Enumerator | |
---|---|
startupTimeout42Us | Timeout set to 42 us. |
startupTimeout83Us | Timeout set to 83 us. |
startupTimeout108Us | Timeout set to 108 us. |
startupTimeout133Us | Timeout set to 133 us. |
startupTimeout158Us | Timeout set to 158 us. |
startupTimeout183Us | Timeout set to 183 us. |
startupTimeout208Us | Timeout set to 208 us. |
startupTimeout233Us | Timeout set to 233 us. |
startupTimeout258Us | Timeout set to 258 us. |
startupTimeout283Us | Timeout set to 283 us. |
startupTimeout333Us | Timeout set to 333 us. |
startupTimeout375Us | Timeout set to 375 us. |
startupTimeout417Us | Timeout set to 417 us. |
startupTimeout458Us | Timeout set to 458 us. |
startupTimeout500Us | Timeout set to 500 us. |
startupTimeout667Us | Timeout set to 667 us. |
CMU_PRS_Status_Output_Select_TypeDef#
CMU_PRS_Status_Output_Select_TypeDef
PRS status select output signal.
Enumerator | |
---|---|
PRS_Status_select_0 | PRS status 0 output signal. |
PRS_Status_select_1 | PRS status 1 output signal. |
Typedef Documentation#
Function Documentation#
CMU_Calibrate#
uint32_t CMU_Calibrate (uint32_t cycles, CMU_Select_TypeDef ref)
Calibrate an oscillator.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | cycles | The number of HCLK cycles to run calibration. Increasing this number increases precision, but the calibration will take more time. |
CMU_Select_TypeDef | [in] | ref | The reference clock used to compare against HCLK. |
Run a calibration of a selectable reference clock againt HCLK. Please refer to the reference manual, CMU chapter, for further details.
Note
This function will not return until calibration measurement is completed.
Returns
The number of ticks the selected reference clock ticked while running cycles ticks of the HCLK clock.
CMU_CalibrateConfig#
void CMU_CalibrateConfig (uint32_t downCycles, CMU_Select_TypeDef downSel, CMU_Select_TypeDef upSel)
Configure clock calibration.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | downCycles | The number of downSel clock cycles to run calibration. Increasing this number increases precision, but the calibration will take more time. |
CMU_Select_TypeDef | [in] | downSel | The clock which will be counted down downCycles cycles. |
CMU_Select_TypeDef | [in] | upSel | The 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. |
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 with the CMU_CalibrateCountGet() function call.
CMU_CalibrateCountGet#
uint32_t CMU_CalibrateCountGet (void )
Get calibration count value.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
If continuous calibration mode is active, calibration busy will almost always be off, and reading the value will be just needed, 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.
CMU_ClkOutPinConfig#
void CMU_ClkOutPinConfig (uint32_t clkNo, CMU_Select_TypeDef sel, CMU_ClkDiv_TypeDef clkDiv, GPIO_Port_TypeDef port, unsigned int pin)
Direct a clock to a GPIO pin.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | clkNo | Selects between CLKOUT0, CLKOUT1 or CLKOUT2 outputs. Use values 0, 1 or 2. |
CMU_Select_TypeDef | [in] | sel | Select clock source. |
CMU_ClkDiv_TypeDef | [in] | clkDiv | Select a clock divisor (1..32). Only applicable when cmuSelect_EXPCLK is selected as clock source. |
GPIO_Port_TypeDef | [in] | port | GPIO port. |
unsigned int | [in] | pin | GPIO pin. |
Note
Refer to the reference manual and the datasheet for details on which GPIO port/pins that are available.
CMU_ClockDivGet#
CMU_ClkDiv_TypeDef CMU_ClockDivGet (CMU_Clock_TypeDef clock)
Get clock divisor.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Clock_TypeDef | [in] | clock | Clock point to get divisor for. Notice that not all clock points have a divisors. Please refer to CMU overview in reference manual. |
Returns
The current clock point divisor. 1 is returned if
clock
specifies a clock point without divisor.
CMU_ClockDivSet#
void CMU_ClockDivSet (CMU_Clock_TypeDef clock, CMU_ClkDiv_TypeDef div)
Set clock divisor.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Clock_TypeDef | [in] | clock | Clock point to set divisor for. Notice that not all clock points have a divisor, please refer to CMU overview in the reference manual. |
CMU_ClkDiv_TypeDef | [in] | div | The clock divisor to use. |
CMU_ClockEnable#
void CMU_ClockEnable (CMU_Clock_TypeDef clock, bool enable)
Enable/disable a clock.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Clock_TypeDef | [in] | clock | The clock to enable/disable. |
bool | [in] | enable |
|
Module clocks sre disabled after reset. If a module clock is disabled, the registers of that module are not accessible and accessing such registers will hardfault the Cortex core.
CMU_ClockFreqGet#
uint32_t CMU_ClockFreqGet (CMU_Clock_TypeDef clock)
Get clock frequency for a clock point.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Clock_TypeDef | [in] | clock | Clock point to fetch frequency for. |
Returns
The current frequency in Hz.
CMU_ClockSelectGet#
CMU_Select_TypeDef CMU_ClockSelectGet (CMU_Clock_TypeDef clock)
Get currently selected reference clock used for a clock branch.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Clock_TypeDef | [in] | clock | Clock branch to fetch selected ref. clock for. |
Returns
Reference clock used for clocking selected branch, cmuSelect_Error if invalid
clock
provided.
CMU_ClockSelectSet#
void CMU_ClockSelectSet (CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
Select reference clock/oscillator used for a clock branch.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Clock_TypeDef | [in] | clock | Clock branch to select reference clock for. |
CMU_Select_TypeDef | [in] | ref | Reference selected for clocking, please refer to reference manual for for details on which reference is available for a specific clock branch. |
CMU_LF_ClockPrecisionGet#
uint16_t CMU_LF_ClockPrecisionGet (CMU_Clock_TypeDef clock)
Gets the precision (in PPM) of the specified low frequency clock branch.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Clock_TypeDef | [in] | clock | Clock branch. |
Returns
Precision, in PPM, of the specified clock branch.
Note
This function is only for internal usage.
The current implementation of this function is used to determine if the clock has a precision <= 500 ppm or not (which is the minimum required for BLE). Future version of this function should provide more accurate precision numbers to allow for further optimizations from the stacks.
CMU_HF_ClockPrecisionGet#
uint16_t CMU_HF_ClockPrecisionGet (CMU_Clock_TypeDef clock)
Gets the precision (in PPM) of the specified high frequency clock branch.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Clock_TypeDef | [in] | clock | Clock branch. |
Returns
Precision, in PPM, of the specified clock branch.
Note
This function is only for internal usage.
The current implementation of this function is used to determine if the clock has a precision <= 500 ppm or not (which is the minimum required for BLE). Future version of this function should provide more accurate precision numbers to allow for further optimizations from the stacks.
CMU_HFRCODPLLBandGet#
CMU_HFRCODPLLFreq_TypeDef CMU_HFRCODPLLBandGet (void )
Get HFRCODPLL band in use.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
HFRCODPLL band in use.
CMU_HFRCODPLLBandSet#
void CMU_HFRCODPLLBandSet (CMU_HFRCODPLLFreq_TypeDef freq)
Set HFRCODPLL band and the tuning value based on the value in the calibration table made during production.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_HFRCODPLLFreq_TypeDef | [in] | freq | HFRCODPLL frequency band to activate. |
CMU_DPLLLock#
bool CMU_DPLLLock (const CMU_DPLLInit_TypeDef * init)
Lock the DPLL to a given frequency.
Type | Direction | Argument Name | Description |
---|---|---|---|
const CMU_DPLLInit_TypeDef * | [in] | init | DPLL setup parameter struct. |
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.
N & M limitations:
300 < N <= 4095
0 <= M <= 4095
Any peripheral running off HFRCODPLL should be switched to a lower frequency clock (if possible) prior to calling this function to avoid over-clocking.
Returns
Returns false on invalid target frequency or DPLL locking error.
CMU_HFXOInit#
void CMU_HFXOInit (const CMU_HFXOInit_TypeDef * hfxoInit)
Initialize all HFXO control registers.
Type | Direction | Argument Name | Description |
---|---|---|---|
const CMU_HFXOInit_TypeDef * | [in] | hfxoInit | HFXO setup parameters. |
Note
HFXO configuration should be obtained from a configuration tool, app note or crystal datasheet. This function returns early if HFXO is already selected as SYSCLK.
CMU_HFXOStartCrystalSharingLeader#
void CMU_HFXOStartCrystalSharingLeader (const CMU_BUFOUTLeaderInit_TypeDef * bufoutInit, GPIO_Port_TypeDef port, unsigned int pin)
Initialize HFXO Bufout (Crystal sharing) leader control registers.
Type | Direction | Argument Name | Description |
---|---|---|---|
const CMU_BUFOUTLeaderInit_TypeDef * | [in] | bufoutInit | Bufout setup parameters. |
GPIO_Port_TypeDef | [in] | port | Bufout request GPIO port. |
unsigned int | [in] | pin | Bufout request GPIO pin. |
Configure the bufout request input GPIO as a clock request signal to add the crystal sharing follower chip as a source of clock request.
Warnings
If EM2 capabilities are needed, a GPIO that fully retains its capabilities while in EM2 must be selected.
CMU_HFXOCrystalSharingFollowerInit#
void CMU_HFXOCrystalSharingFollowerInit (CMU_PRS_Status_Output_Select_TypeDef prsStatusSelectOutput, unsigned int prsAsyncCh, GPIO_Port_TypeDef port, unsigned int pin)
Initialize HFXO Bufout (Crystal sharing) follower control registers.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_PRS_Status_Output_Select_TypeDef | [in] | prsStatusSelectOutput | Selected HFXO PRS signal output. |
unsigned int | [in] | prsAsyncCh | PRS producer asynchronous signal channel. |
GPIO_Port_TypeDef | [in] | port | Bufout request GPIO port. |
unsigned int | [in] | pin | Bufout request GPIO pin. |
Configure the clock request signal to a specified GPIO to automatically request the high frequency crystal oscillator sine wave clock. This function must be used in conjunction with CMU_HFXOInit() configured with EXTERNAL_SINE or EXTERNAL_SINEPKDET mode.
Warnings
If EM2 capabilities are needed, a GPIO that fully retains its capabilities while in EM2 must be selected.
Note
This function can be emulated on XG21/XG22 chips by controlling the clock request GPIO to ask the crystal sharing leader clock when needed.
CMU_HFXOCTuneSet#
sl_status_t CMU_HFXOCTuneSet (uint32_t ctune)
Set the HFXO crystal tuning capacitance.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | ctune | The desired tuning capacitance value. Each step corresponds to approximately 80fF. Min value is 0. Max value is 255. |
Returns
SL_STATUS_OK if initialization parameter is valid. SL_STATUS_INVALID_PARAMETER if initialization parameter is invalid.
Note
While the oscillator is running in steady operation state, it may be desirable to modify the tuning capacitance via CTUNEXIANA and CTUNEXOANA fields in the HFXO_XTALCTRL register. When tuning, care should be taken to make small changes to the CTUNE registers. Ideally, change the CTUNE registers by one LSB at a time and alternate between the XI and XO registers. Sufficient wait time for settling, on the order of TIMEOUTSTEADY, should pass before new frequency measurement is taken.
CMU_HFXOCTuneGet#
uint32_t CMU_HFXOCTuneGet (void )
Get the HFXO crystal tuning capacitance.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
The HFXO crystal tuning capacitance.
Note
This function only returns the CTUNE XI value. The XO value can be different and can be found using the delta (difference between XI and XO). See CMU_HFXOCTuneCurrentDeltaGet to retrieve the delta value.
CMU_HFXOCTuneDeltaSet#
void CMU_HFXOCTuneDeltaSet (int32_t delta)
Set the HFXO crystal tuning delta.
Type | Direction | Argument Name | Description |
---|---|---|---|
int32_t | [in] | delta | Chip dependent crystal capacitor bank delta between HFXO XI and XO. |
Note
The delta between XI and XO is applicable for the series 2 EFR32xG2x devices only. Neither XI nor XO is actually modified by this function, CMU_HFXOCTuneSet() needs to be called for the change to be propagated.
CMU_HFXOCTuneDeltaGet#
int32_t CMU_HFXOCTuneDeltaGet (void )
Get the HFXO crystal tuning delta.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
It can be default recommended delta value or value set by CMU_HFXOCTuneDeltaSet.
Returns
Chip dependent crystal capacitor bank tuning delta.
CMU_HFXOCTuneCurrentDeltaGet#
int32_t CMU_HFXOCTuneCurrentDeltaGet (void )
Get the current delta between HFXO XI and XO.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
the current delta between HFXO XI and XO.
CMU_HFXOCoreBiasCurrentCalibrate#
void CMU_HFXOCoreBiasCurrentCalibrate (void )
Recalibrate the HFXO's Core Bias Current.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
Care should be taken when using this function as it can cause disturbance on the HFXO frequency while the optimization is underway. It's recommended to only use this function when HFXO isn't being used. It's also a blocking function that can be time consuming.
CMU_LFXOInit#
void CMU_LFXOInit (const CMU_LFXOInit_TypeDef * lfxoInit)
Initialize LFXO control registers.
Type | Direction | Argument Name | Description |
---|---|---|---|
const CMU_LFXOInit_TypeDef * | [in] | lfxoInit | LFXO setup parameters |
Note
LFXO configuration should be obtained from a configuration tool, app note or crystal datasheet. This function disables the LFXO to ensure a valid state before update.
CMU_LFXOPrecisionSet#
void CMU_LFXOPrecisionSet (uint16_t precision)
Sets LFXO's crystal precision, in PPM.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | precision | LFXO's crystal precision, in PPM. |
Note
LFXO precision should be obtained from a crystal datasheet.
CMU_LFXOPrecisionGet#
uint16_t CMU_LFXOPrecisionGet (void )
Gets LFXO's crystal precision, in PPM.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | [in] | LFXO's crystal precision, in PPM. |
CMU_HFXOPrecisionSet#
void CMU_HFXOPrecisionSet (uint16_t precision)
Sets HFXO's crystal precision, in PPM.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | precision | HFXO's crystal precision, in PPM. |
Note
HFXO precision should be obtained from a crystal datasheet.
CMU_HFXOPrecisionGet#
uint16_t CMU_HFXOPrecisionGet (void )
Gets HFXO's crystal precision, in PPM.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | [in] | HFXO's crystal precision, in PPM. |
CMU_OscillatorTuningGet#
uint32_t CMU_OscillatorTuningGet (CMU_Osc_TypeDef osc)
Get oscillator frequency tuning setting.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Osc_TypeDef | [in] | osc | Oscillator to get tuning value for. |
Returns
The oscillator frequency tuning setting in use.
CMU_OscillatorTuningSet#
void CMU_OscillatorTuningSet (CMU_Osc_TypeDef osc, uint32_t val)
Set the oscillator frequency tuning control.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Osc_TypeDef | [in] | osc | Oscillator to set tuning value for. |
uint32_t | [in] | val | The oscillator frequency tuning setting to use. |
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.
CMU_UpdateWaitStates#
void CMU_UpdateWaitStates (uint32_t freq, int vscale)
Configure wait state settings necessary to switch to a given core clock frequency at a certain voltage scale level.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | freq | The core clock frequency to configure wait-states. |
int | [in] | vscale | The voltage scale to configure wait-states. Expected values are 0 or 1, higher number is lower voltage.
|
This function will set up the necessary flash wait states. Updating the wait state configuration must be done before increasing the clock frequency and it must be done after decreasing the clock frequency. Updating the wait state configuration must be done before core voltage is decreased and it must be done after a core voltage is increased.
CMU_PCNTClockExternalSet#
void CMU_PCNTClockExternalSet (unsigned int instance, bool external)
Select the PCNTn clock.
Type | Direction | Argument Name | Description |
---|---|---|---|
unsigned int | [in] | instance | PCNT instance number to set selected clock source for. |
bool | [in] | external | Set to true to select the external clock, false to select EM23GRPACLK. |
CMU_HFRCOEM23BandGet#
CMU_HFRCOEM23Freq_TypeDef CMU_HFRCOEM23BandGet (void )
Get HFRCOEM23 band in use.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
HFRCOEM23 band in use.
CMU_HFRCOEM23BandSet#
void CMU_HFRCOEM23BandSet (CMU_HFRCOEM23Freq_TypeDef freq)
Set HFRCOEM23 band and the tuning value based on the value in the calibration table made during production.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_HFRCOEM23Freq_TypeDef | [in] | freq | HFRCOEM23 frequency band to activate. |
CMU_CalibrateCont#
void CMU_CalibrateCont (bool enable)
Configure continuous calibration mode.
Type | Direction | Argument Name | Description |
---|---|---|---|
bool | [in] | enable | If true, enables continuous calibration, if false disables continuous calibration. |
CMU_CalibrateStart#
void CMU_CalibrateStart (void )
Start calibration.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
This call is usually invoked after CMU_CalibrateConfig() and possibly CMU_CalibrateCont().
CMU_CalibrateStop#
void CMU_CalibrateStop (void )
Stop calibration counters.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
CMU_DPLLUnlock#
void CMU_DPLLUnlock (void )
Unlock the DPLL.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
The HFRCODPLL oscillator is not turned off.
CMU_IntClear#
void CMU_IntClear (uint32_t flags)
Clear one or more pending CMU interrupt flags.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | CMU interrupt sources to clear. |
CMU_IntDisable#
void CMU_IntDisable (uint32_t flags)
Disable one or more CMU interrupt sources.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | CMU interrupt sources to disable. |
CMU_IntEnable#
void CMU_IntEnable (uint32_t flags)
Enable one or more CMU interrupt sources.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | CMU interrupt sources to enable. |
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.
CMU_IntGet#
uint32_t CMU_IntGet (void )
Get pending CMU interrupt sources.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
CMU interrupt sources pending.
CMU_IntGetEnabled#
uint32_t CMU_IntGetEnabled (void )
Get enabled and pending CMU interrupt flags.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
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
CMU_IntSet#
void CMU_IntSet (uint32_t flags)
Set one or more pending CMU interrupt sources.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | CMU interrupt sources to set to pending. |
CMU_Lock#
void CMU_Lock (void )
Lock CMU register access in order to protect registers contents against unintended modification.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
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.
CMU_OscillatorEnable#
void CMU_OscillatorEnable (CMU_Osc_TypeDef osc, bool enable, bool wait)
Enable/disable oscillator.
Type | Direction | Argument Name | Description |
---|---|---|---|
CMU_Osc_TypeDef | [in] | osc | The oscillator to enable/disable. |
bool | [in] | enable |
|
bool | [in] | wait | Only used if
|
Note
This is a dummy function to solve backward compatibility issues.
CMU_Unlock#
void CMU_Unlock (void )
Unlock CMU register access so that writing to registers is possible.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
CMU_WdogLock#
void CMU_WdogLock (void )
Lock WDOG register access in order to protect registers contents against unintended modification.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
If locking the WDOG registers, they must be unlocked prior to using any emlib API functions modifying registers protected by the lock.
CMU_WdogUnlock#
void CMU_WdogUnlock (void )
Unlock WDOG register access so that writing to registers is possible.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
CMU_PrescToLog2#
uint32_t CMU_PrescToLog2 (uint32_t presc)
Convert prescaler divider to a logarithmic value.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | presc | Prescaler value used to set the frequency divider. The divider is equal to ('presc' + 1). If a divider value is passed for 'presc', 'presc' will be equal to (divider - 1). |
It only works for even numbers equal to 2^n.
Returns
Logarithm base 2 (binary) value, i.e. exponent as used by fixed 2^n prescalers.