CC26xx Driver Library
[osc] Oscillator

Functions

static void OSCXHfPowerModeSet (uint32_t ui32Mode)
 Set Power Mode for High Frequency XTAL Oscillator. More...
 
static void OSCClockLossEventEnable (void)
 Enables OSC clock loss event detection. More...
 
static void OSCClockLossEventDisable (void)
 Disables OSC clock loss event detection. More...
 
void OSCClockSourceSet (uint32_t ui32SrcClk, uint32_t ui32Osc)
 Configure the oscillator input to the a source clock. More...
 
uint32_t OSCClockSourceGet (uint32_t ui32SrcClk)
 Get the source clock settings. More...
 
static bool OSCHfSourceReady (void)
 Check if the HF clock source is ready to be switched. More...
 
static void OSCHfSourceSwitch (void)
 Switch the high frequency clock. More...
 
static void OSCInterfaceEnable (void)
 Deprecated: Empty function - original functionality is removed. More...
 
static void OSCInterfaceDisable (void)
 Deprecated: Empty function - original functionality is removed. More...
 
uint32_t OSCHF_GetStartupTime (uint32_t timeUntilWakeupInMs)
 Returns maximum startup time (in microseconds) of XOSC_HF. More...
 
void OSCHF_TurnOnXosc (void)
 Turns on XOSC_HF (but without switching to XOSC_HF). More...
 
bool OSCHF_AttemptToSwitchToXosc (void)
 Switch to XOSC_HF if XOSC_HF is ready. More...
 
void OSCHF_SwitchToRcOscTurnOffXosc (void)
 Switch to RCOSC_HF and turn off XOSC_HF. More...
 
uint32_t OSCHF_DebugGetCrystalAmplitude (void)
 Get crystal amplitude (assuming crystal is running). More...
 
uint32_t OSCHF_DebugGetExpectedAverageCrystalAmplitude (void)
 Get the expected average crystal amplitude. More...
 
int32_t OSC_HPOSCRelativeFrequencyOffsetGet (int32_t tempDegC)
 Calculate the temperature dependent relative frequency offset of HPOSC. More...
 
int16_t OSC_HPOSCRelativeFrequencyOffsetToRFCoreFormatConvert (int32_t HPOSC_RelFreqOffset)
 Converts the relative frequency offset of HPOSC to the RF Core parameter format. More...
 

Detailed Description

Function Documentation

int32_t OSC_HPOSCRelativeFrequencyOffsetGet ( int32_t  tempDegC)

Calculate the temperature dependent relative frequency offset of HPOSC.

The HPOSC (High Precision Oscillator) frequency will vary slightly with chip temperature. The frequency offset from the nominal value can be predicted based on second order linear interpolation using coefficients measured in chip production and stored as factory configuration parameters.

This function calculates the relative frequency offset, defined as:

    F_HPOSC = F_nom * (1 + d/(2^22))

where

  • F_HPOSC is the current HPOSC frequency.
  • F_nom is the nominal oscillator frequency, assumed to be 48.000 MHz.
  • d is the relative frequency offset (the value returned).

By knowing the relative frequency offset it is then possible to compensate any timing related values accordingly.

Parameters
tempDegCis the chip temperature in degrees Celsius. Use the function AONBatMonTemperatureGetDegC() to get current chip temperature.
Returns
Returns the relative frequency offset parameter d.
See also
OSC_HPOSCRelativeFrequencyOffsetToRFCoreFormatConvert(), AONBatMonTemperatureGetDegC()

Definition at line 316 of file osc.c.

int16_t OSC_HPOSCRelativeFrequencyOffsetToRFCoreFormatConvert ( int32_t  HPOSC_RelFreqOffset)

Converts the relative frequency offset of HPOSC to the RF Core parameter format.

The HPOSC (High Precision Oscillator) clock is used by the RF Core. To compensate for a frequency offset in the frequency of the clock source, a frequency offset parameter can be provided as part of the radio configuration override setting list to enable compensation of the RF synthesizer frequency, symbol timing, and radio timer to still achieve correct frequencies.

The RF Core takes a relative frequency offset parameter defined differently compared to the relative frequency offset parameter returned from function OSC_HPOSCRelativeFrequencyOffsetGet() and thus needs to be converted:

    F_nom = F_HPOSC * (1 + RfCoreRelFreqOffset/(2^22))

where

  • F_nom is the nominal oscillator frequency, assumed to be 48.000 MHz.
  • F_HPOSC is the current HPOSC frequency.
  • RfCoreRelFreqOffset is the relative frequency offset in the "RF Core" format (the value returned).
Returns
Returns the relative frequency offset in RF Core format.
See also
OSC_HPOSCRelativeFrequencyOffsetGet()

Definition at line 355 of file osc.c.

static void OSCClockLossEventDisable ( void  )
inlinestatic

Disables OSC clock loss event detection.

Disabling the OSC clock loss event does also clear the clock loss event flag.

Note
OSC clock loss event must be disabled before SCLK_LF clock source is changed (by calling OSCClockSourceSet()) and remain disabled until the change is confirmed (by calling OSCClockSourceGet()).
Returns
None
See also
OSCClockLossEventEnable()

Definition at line 204 of file osc.h.

Here is the call graph for this function:

static void OSCClockLossEventEnable ( void  )
inlinestatic

Enables OSC clock loss event detection.

Enables the clock loss event flag to be raised if a clock loss is detected.

Note
OSC clock loss event must be disabled before SCLK_LF clock source is changed (by calling OSCClockSourceSet()) and remain disabled until the change is confirmed (by calling OSCClockSourceGet()).
Returns
None
See also
OSCClockLossEventDisable()

Definition at line 181 of file osc.h.

Here is the call graph for this function:

uint32_t OSCClockSourceGet ( uint32_t  ui32SrcClk)

Get the source clock settings.

Use this function to get the oscillator source for one of the system source clocks.

Parameters
ui32SrcClkis the source clock to check.
Returns
Returns the type of oscillator that drives the clock source.
See also
OSCClockSourceSet(), OSCHfSourceSwitch()

Definition at line 160 of file osc.c.

Referenced by OSCHF_AttemptToSwitchToXosc(), OSCHF_SwitchToRcOscTurnOffXosc(), SetupAfterColdResetWakeupFromShutDownCfg3(), and SysCtrlPowerEverything().

Here is the call graph for this function:

void OSCClockSourceSet ( uint32_t  ui32SrcClk,
uint32_t  ui32Osc 
)

Configure the oscillator input to the a source clock.

Use this function to set the oscillator source for one or more of the system source clocks.

When selecting the high frequency clock source, this function will not do the actual switch. Enabling the high frequency XTAL can take several hundred micro seconds, so the actual switch is split into a separate function, leaving System CPU free to perform other tasks as the XTAL starts up.

Note
The High Frequency (OSC_SRC_CLK_HF) and Medium Frequency (OSC_SRC_CLK_MF) can only be derived from the high frequency oscillator. The Low Frequency source clock (OSC_SRC_CLK_LF) can be derived from all 4 oscillators.
If enabling OSC_XOSC_LF it is not safe to go to powerdown/shutdown until the LF clock is running which can be checked using OSCClockSourceGet().
Clock loss reset generation must be disabled before SCLK_LF (OSC_SRC_CLK_LF) clock source is changed and remain disabled until the change is confirmed.
Parameters
ui32SrcClkis the source clocks to configure.
ui32Oscis the oscillator that drives the source clock.
See also
OSCClockSourceGet()
Returns
None

Definition at line 101 of file osc.c.

Referenced by OSCHF_SwitchToRcOscTurnOffXosc(), OSCHF_TurnOnXosc(), SetupAfterColdResetWakeupFromShutDownCfg3(), and SysCtrlPowerEverything().

Here is the call graph for this function:

bool OSCHF_AttemptToSwitchToXosc ( void  )

Switch to XOSC_HF if XOSC_HF is ready.

This is a non-blocking function checking if the XOSC_HF is ready and performs the switching if ready. The function is somewhat blocking in the case where switching is performed.

Returns
Returns status of the XOSC_HF switching:
  • true : Switching to XOSC_HF has occurred.
  • false : Switching has not occurred.

Definition at line 256 of file osc.c.

Here is the call graph for this function:

uint32_t OSCHF_DebugGetCrystalAmplitude ( void  )

Get crystal amplitude (assuming crystal is running).

Note
This is a debug function only. It is hence not recommended to call this function in normal operation.

This function uses an on-chip ADC and peak detector for reading the crystal amplitude. The measurement time is set to 4 milliseconds and this function does not return before the measurement is done.

Expected value is OSCHF_DebugGetExpectedAverageCrystalAmplitude +/- 50 millivolt.

Returns
Returns crystal amplitude in millivolt.
See also
OSCHF_DebugGetExpectedAverageCrystalAmplitude()

Definition at line 400 of file osc.c.

Here is the call graph for this function:

uint32_t OSCHF_DebugGetExpectedAverageCrystalAmplitude ( void  )

Get the expected average crystal amplitude.

Note
This is a debug function only. It is hence not recommended to call this function in normal operation.

This function read the configured high and low thresholds and returns the mean value converted to millivolt.

Returns
Returns expected average crystal amplitude in millivolt.
See also
OSCHF_DebugGetCrystalAmplitude()

Definition at line 437 of file osc.c.

uint32_t OSCHF_GetStartupTime ( uint32_t  timeUntilWakeupInMs)

Returns maximum startup time (in microseconds) of XOSC_HF.

The startup time depends on several factors. This function calculates the maximum startup time based on statistical information.

Parameters
timeUntilWakeupInMsindicates how long time (milliseconds) to the startup will occur.
Returns
Time margin to use in microseconds.

Definition at line 194 of file osc.c.

Here is the call graph for this function:

void OSCHF_SwitchToRcOscTurnOffXosc ( void  )

Switch to RCOSC_HF and turn off XOSC_HF.

This operation takes approximately 50 microseconds (can be shorter if RCOSC_HF already was running).

Returns
None

Definition at line 291 of file osc.c.

Here is the call graph for this function:

void OSCHF_TurnOnXosc ( void  )

Turns on XOSC_HF (but without switching to XOSC_HF).

This function simply indicates the need for XOSC_HF to the hardware which initiates the XOSC_HF startup.

Returns
None

Definition at line 243 of file osc.c.

Here is the call graph for this function:

static bool OSCHfSourceReady ( void  )
inlinestatic

Check if the HF clock source is ready to be switched.

If a request to switch the HF clock source has been made, this function can be used to check if the clock source is ready to be switched.

Once the HF clock source is ready the switch can be performed by calling the OSCHfSourceSwitch()

Returns
Returns status of HF clock source:
  • true : HF clock source is ready.
  • false : HF clock source is not ready.

Definition at line 290 of file osc.h.

Referenced by OSCHF_AttemptToSwitchToXosc().

Here is the call graph for this function:

static void OSCHfSourceSwitch ( void  )
inlinestatic

Switch the high frequency clock.

When switching the HF clock source the clock period might be prolonged leaving the clock 'stuck-at' high or low for a few cycles. To ensure that this does not coincide with a read access to the Flash potentially freezing the device, the HF clock source switch must be executed from ROM.

Note
This function will not return until the clock source has been switched. It is left to the programmer to ensure, that there is a pending request for a HF clock source switch before this function is called.
Returns
None
See also
OSCClockSourceSet()

Definition at line 320 of file osc.h.

Referenced by OSCHF_AttemptToSwitchToXosc(), OSCHF_SwitchToRcOscTurnOffXosc(), and SysCtrlPowerEverything().

static void OSCInterfaceDisable ( void  )
inlinestatic

Deprecated: Empty function - original functionality is removed.

Deprecated:
Functionality has been moved to the startup code. The dummy function will be removed in the next major release of CC26xxWare/CC13xxWare.

The original functionality was described as follows: Disable System CPU access to the OSC_DIG module. Release the "force power on" of AUX and disable clock to AUX.

Note
Access to the OSC_DIG interface is a shared resource between the Sensor Controller and the CPU, so enabling or disabling this interface must be done with consideration.
Returns
None

Definition at line 371 of file osc.h.

static void OSCInterfaceEnable ( void  )
inlinestatic

Deprecated: Empty function - original functionality is removed.

Deprecated:
Functionality has been moved to the startup code. The dummy function will be removed in the next major release of CC26xxWare/CC13xxWare.

The original functionality was described as follows: Enable System CPU access to the OSC_DIG module. Force power on AUX and enable clocks to allow System CPU access on the OSC_DIG interface.

Note
Access to the OSC_DIG interface is a shared resource between the Sensor Controller and the CPU, so enabling or disabling this interface must be done with consideration.
Returns
None

Definition at line 348 of file osc.h.

static void OSCXHfPowerModeSet ( uint32_t  ui32Mode)
inlinestatic

Set Power Mode for High Frequency XTAL Oscillator.

Parameters
ui32Modeis the power mode for the HF XTAL.
Returns
None

Definition at line 150 of file osc.h.

Here is the call graph for this function:

Macro Definition Documentation

#define HIGH_POWER_XOSC   0

Definition at line 105 of file osc.h.

Referenced by OSCXHfPowerModeSet().

#define LOW_POWER_XOSC   1

Definition at line 104 of file osc.h.

Referenced by OSCXHfPowerModeSet().

#define OSC_RCOSC_HF   0x00000000

Definition at line 116 of file osc.h.

Referenced by OSCClockSourceSet(), and OSCHF_SwitchToRcOscTurnOffXosc().

#define OSC_RCOSC_LF   0x00000002

Definition at line 118 of file osc.h.

Referenced by OSCClockSourceSet(), and SetupAfterColdResetWakeupFromShutDownCfg3().

#define OSC_SRC_CLK_LF   0x00000004
#define OSC_SRC_CLK_MF   0x00000002
#define OSC_XOSC_HF   0x00000001
#define OSC_XOSC_LF   0x00000003
#define SCLK_HF_RCOSC_HF   0

Definition at line 121 of file osc.h.

#define SCLK_HF_XOSC_HF   1

Definition at line 122 of file osc.h.

#define SCLK_LF_FROM_RCOSC_HF   0

Definition at line 127 of file osc.h.

#define SCLK_LF_FROM_RCOSC_LF   2

Definition at line 129 of file osc.h.

#define SCLK_LF_FROM_XOSC_HF   1

Definition at line 128 of file osc.h.

#define SCLK_LF_FROM_XOSC_LF   3

Definition at line 130 of file osc.h.

#define SCLK_MF_RCOSC_HF   0

Definition at line 124 of file osc.h.

#define SCLK_MF_XOSC_HF   1

Definition at line 125 of file osc.h.