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... | |
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
By knowing the relative frequency offset it is then possible to compensate any timing related values accordingly.
tempDegC | is the chip temperature in degrees Celsius. Use the function AONBatMonTemperatureGetDegC() to get current chip temperature. |
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
|
inlinestatic |
Disables OSC clock loss event detection.
Disabling the OSC clock loss event does also clear the clock loss event flag.
Definition at line 204 of file osc.h.
|
inlinestatic |
Enables OSC clock loss event detection.
Enables the clock loss event flag to be raised if a clock loss is detected.
Definition at line 181 of file osc.h.
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.
ui32SrcClk | is the source clock to check. |
Definition at line 160 of file osc.c.
Referenced by OSCHF_AttemptToSwitchToXosc(), OSCHF_SwitchToRcOscTurnOffXosc(), SetupAfterColdResetWakeupFromShutDownCfg3(), and SysCtrlPowerEverything().
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.
ui32SrcClk | is the source clocks to configure. |
ui32Osc | is the oscillator that drives the source clock.
|
Definition at line 101 of file osc.c.
Referenced by OSCHF_SwitchToRcOscTurnOffXosc(), OSCHF_TurnOnXosc(), SetupAfterColdResetWakeupFromShutDownCfg3(), and SysCtrlPowerEverything().
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.
true
: Switching to XOSC_HF has occurred.false
: Switching has not occurred. Definition at line 256 of file osc.c.
uint32_t OSCHF_DebugGetCrystalAmplitude | ( | void | ) |
Get crystal amplitude (assuming crystal is running).
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.
Definition at line 400 of file osc.c.
uint32_t OSCHF_DebugGetExpectedAverageCrystalAmplitude | ( | void | ) |
Get the expected average crystal amplitude.
This function read the configured high and low thresholds and returns the mean value converted to millivolt.
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.
timeUntilWakeupInMs | indicates how long time (milliseconds) to the startup will occur. |
Definition at line 194 of file osc.c.
void OSCHF_SwitchToRcOscTurnOffXosc | ( | void | ) |
void OSCHF_TurnOnXosc | ( | 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()
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().
|
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.
Definition at line 320 of file osc.h.
Referenced by OSCHF_AttemptToSwitchToXosc(), OSCHF_SwitchToRcOscTurnOffXosc(), and SysCtrlPowerEverything().
|
inlinestatic |
Deprecated: Empty function - original functionality is removed.
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.
|
inlinestatic |
Deprecated: Empty function - original functionality is removed.
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.
|
inlinestatic |
#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_HF 0x00000001 |
Definition at line 112 of file osc.h.
Referenced by OSCClockSourceGet(), OSCClockSourceSet(), OSCHF_AttemptToSwitchToXosc(), OSCHF_SwitchToRcOscTurnOffXosc(), OSCHF_TurnOnXosc(), SetupAfterColdResetWakeupFromShutDownCfg3(), and SysCtrlPowerEverything().
#define OSC_SRC_CLK_LF 0x00000004 |
Definition at line 114 of file osc.h.
Referenced by OSCClockSourceGet(), OSCClockSourceSet(), SetupAfterColdResetWakeupFromShutDownCfg3(), and SysCtrlPowerEverything().
#define OSC_SRC_CLK_MF 0x00000002 |
Definition at line 113 of file osc.h.
Referenced by OSCClockSourceSet(), OSCHF_SwitchToRcOscTurnOffXosc(), OSCHF_TurnOnXosc(), and SysCtrlPowerEverything().
#define OSC_XOSC_HF 0x00000001 |
Definition at line 117 of file osc.h.
Referenced by OSCClockSourceSet(), OSCHF_AttemptToSwitchToXosc(), OSCHF_TurnOnXosc(), SetupAfterColdResetWakeupFromShutDownCfg3(), and SysCtrlPowerEverything().
#define OSC_XOSC_LF 0x00000003 |
Definition at line 119 of file osc.h.
Referenced by OSCClockSourceSet(), SetupAfterColdResetWakeupFromShutDownCfg3(), and SysCtrlPowerEverything().