nrfx 3.3
Macros | Typedefs | Enumerations | Functions
OSCILLATORS HAL

Hardware access layer for managing the OSCILLATORS peripheral. More...

Macros

#define NRF_OSCILLATORS_HAS_PLL   1
 Symbol indicating whether PLL is present.
 
#define NRF_OSCILLATORS_HAS_CLOCK_QUALITY_IND   1
 Symbol indicating whether clock quality indicator is present.
 
#define NRF_OSCILLATORS_HAS_LFXO_CAP_AS_INT_VALUE   1
 Symbol indicating whether configuration of internal capacitor using integer value is present.
 
#define NRF_OSCILLATORS_HAS_LFXO_BYPASS   1
 Symbol indicating whether LFXO bypass is present.
 
#define OSCILLATORS_HFXO_CAP_CALCULATE(p_ficr_reg, cap_val)
 Macro for calculating HFXO internal capacitor value.
 
#define OSCILLATORS_LFXO_CAP_CALCULATE(p_ficr_reg, cap_val)
 Macro for calculating LFXO internal capacitor value.
 
#define NRF_OSCILLATORS_LFXO_CAP_EXTERNAL   ((nrf_oscillators_lfxo_cap_t)0)
 Symbol specifying usage of external capacitors.
 

Typedefs

typedef uint32_t nrf_oscillators_lfxo_cap_t
 LFXO capacitance type.
 

Enumerations

enum  nrf_oscillators_hfxo_clock_quality_t {
  NRF_OSCILLATORS_HFXO_CLOCK_QUALITY_NONE = OSCILLATORS_XOSC32M_CLOCKQUALITY_INDICATOR_NoStatus ,
  NRF_OSCILLATORS_HFXO_CLOCK_QUALITY_STARTING = OSCILLATORS_XOSC32M_CLOCKQUALITY_INDICATOR_Starting ,
  NRF_OSCILLATORS_HFXO_CLOCK_QUALITY_STARTED = OSCILLATORS_XOSC32M_CLOCKQUALITY_INDICATOR_Started
}
 HFXO clock quality indicator. More...
 
enum  nrf_oscillators_pll_freq_t {
  NRF_OSCILLATORS_PLL_FREQ_64M = OSCILLATORS_PLL_FREQ_FREQ_CK64M ,
  NRF_OSCILLATORS_PLL_FREQ_128M = OSCILLATORS_PLL_FREQ_FREQ_CK128M
}
 PLL frequencies. More...
 

Functions

NRF_STATIC_INLINE nrf_oscillators_hfxo_clock_quality_t nrf_oscillators_hfxo_clock_quality_get (NRF_OSCILLATORS_Type *p_reg)
 Function for reading HFXO clock quality indicator.
 
NRF_STATIC_INLINE void nrf_oscillators_pll_freq_set (NRF_OSCILLATORS_Type *p_reg, nrf_oscillators_pll_freq_t freq)
 Function for setting PLL frequency.
 
NRF_STATIC_INLINE nrf_oscillators_pll_freq_t nrf_oscillators_pll_freq_get (NRF_OSCILLATORS_Type *p_reg)
 Function for getting PLL frequency.
 
NRF_STATIC_INLINE void nrf_oscillators_lfxo_bypass_set (NRF_OSCILLATORS_Type *p_reg, bool enable)
 Function for enabling or disabling the bypass of LFXO with external clock source.
 
NRF_STATIC_INLINE void nrf_oscillators_lfxo_cap_set (NRF_OSCILLATORS_Type *p_reg, nrf_oscillators_lfxo_cap_t cap)
 Function for configuring the internal capacitors of LFXO.
 
NRF_STATIC_INLINE void nrf_oscillators_hfxo_cap_set (NRF_OSCILLATORS_Type *p_reg, bool enable, uint32_t cap_value)
 Function for configuring the internal capacitors of HFXO.
 

Detailed Description

Hardware access layer for managing the OSCILLATORS peripheral.

Macro Definition Documentation

◆ OSCILLATORS_HFXO_CAP_CALCULATE

#define OSCILLATORS_HFXO_CAP_CALCULATE (   p_ficr_reg,
  cap_val 
)
Value:
((((p_ficr_reg->XOSC32MTRIM & FICR_XOSC32MTRIM_SLOPE_Msk) \
<< FICR_XOSC32MTRIM_SLOPE_Pos) / 16 + 1) * \
(cap_val * 2 - 14) + \
((p_ficr_reg->XOSC32MTRIM & FICR_XOSC32MTRIM_OFFSET_Msk) \
<< FICR_XOSC32MTRIM_OFFSET_Pos))

Macro for calculating HFXO internal capacitor value.

Depending on the SoC used, a range of capacitance of internal capacitors is as follows:

  • From 7 pF to 20 pF in 0.5 pF steps for nRF5340.
  • From 4 pF to 17 pF in 0.25 pF steps for other SoCs. This macro should be used to calculate argument's value for nrf_oscillators_hfxo_cap_set function.

◆ OSCILLATORS_LFXO_CAP_CALCULATE

#define OSCILLATORS_LFXO_CAP_CALCULATE (   p_ficr_reg,
  cap_val 
)
Value:
((((cap_val - 4) * (((p_ficr_reg->XOSC32KTRIM & FICR_XOSC32KTRIM_SLOPE_Msk) \
<< FICR_XOSC32KTRIM_SLOPE_Pos)) + 392) >> 3 + \
((p_ficr_reg->XOSC32KTRIM & FICR_XOSC32KTRIM_OFFSET_Msk) \
<< FICR_XOSC32KTRIM_OFFSET_Pos)) >> 6)

Macro for calculating LFXO internal capacitor value.

The capacitance of internal capacitors ranges from 4 pF to 18 pF in 0.5 pF steps. This macro should be used to calculate argument's value for nrf_oscillators_lfxo_cap_set function.

Enumeration Type Documentation

◆ nrf_oscillators_hfxo_clock_quality_t

HFXO clock quality indicator.

Enumerator
NRF_OSCILLATORS_HFXO_CLOCK_QUALITY_NONE 

Clock XOSC32M status is not defined.

NRF_OSCILLATORS_HFXO_CLOCK_QUALITY_STARTING 

Clock XOSC32M has started but has not yet reached the specified frequency tolerance requirement fTOL_HFXO.

NRF_OSCILLATORS_HFXO_CLOCK_QUALITY_STARTED 

Clock XOSC32M has started and is operating with the specified frequency tolerance requirement fTOL_HFXO.

◆ nrf_oscillators_pll_freq_t

PLL frequencies.

Enumerator
NRF_OSCILLATORS_PLL_FREQ_64M 

PLL 64 MHz frequency.

NRF_OSCILLATORS_PLL_FREQ_128M 

PLL 128 MHz frequency.

Function Documentation

◆ nrf_oscillators_hfxo_cap_set()

NRF_STATIC_INLINE void nrf_oscillators_hfxo_cap_set ( NRF_OSCILLATORS_Type *  p_reg,
bool  enable,
uint32_t  cap_value 
)

Function for configuring the internal capacitors of HFXO.

To calculate the correct cap_value, use OSCILLATORS_HFXO_CAP_CALCULATE macro.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if internal capacitors are to be enabled, false otherwise.
[in]cap_valueValue representing capacitance, calculated using provided equation. Ignored when internal capacitors are disabled.

◆ nrf_oscillators_hfxo_clock_quality_get()

NRF_STATIC_INLINE nrf_oscillators_hfxo_clock_quality_t nrf_oscillators_hfxo_clock_quality_get ( NRF_OSCILLATORS_Type *  p_reg)

Function for reading HFXO clock quality indicator.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Clock quality indicator value.

◆ nrf_oscillators_lfxo_bypass_set()

NRF_STATIC_INLINE void nrf_oscillators_lfxo_bypass_set ( NRF_OSCILLATORS_Type *  p_reg,
bool  enable 
)

Function for enabling or disabling the bypass of LFXO with external clock source.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if bypass is to be enabled (use with rail-to-rail external source). False if bypass is to be disabled (use with xtal or low-swing external source).

◆ nrf_oscillators_lfxo_cap_set()

NRF_STATIC_INLINE void nrf_oscillators_lfxo_cap_set ( NRF_OSCILLATORS_Type *  p_reg,
nrf_oscillators_lfxo_cap_t  cap 
)

Function for configuring the internal capacitors of LFXO.

For SoCs other than nRF5340, to calculate the correct cap_value, use OSCILLATORS_LFXO_CAP_CALCULATE macro.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]capCapacitors configuration.

◆ nrf_oscillators_pll_freq_get()

NRF_STATIC_INLINE nrf_oscillators_pll_freq_t nrf_oscillators_pll_freq_get ( NRF_OSCILLATORS_Type *  p_reg)

Function for getting PLL frequency.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Current PLL frequency value.

◆ nrf_oscillators_pll_freq_set()

NRF_STATIC_INLINE void nrf_oscillators_pll_freq_set ( NRF_OSCILLATORS_Type *  p_reg,
nrf_oscillators_pll_freq_t  freq 
)

Function for setting PLL frequency.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]freqNew PLL frequency.

Documentation feedback | Developer Zone | Subscribe | Updated