CC26xx Driver Library |

- Main Page
- Related Pages
- CC26xx APIs
- Register Descriptions
- Online Resources

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Functions
[osc] Oscillator

## Functions
__STATIC_INLINE void | OSCXHfPowerModeSet (uint32_t ui32Mode)
| Set Power Mode for High Frequency XTAL Oscillator. 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_INLINE bool | OSCHfSourceReady (void)
| Check if the HF clock source is ready to be switched. More...
__STATIC_INLINE void | OSCHfSourceSwitch (void)
| Switch the high frequency clock. More...
void | OSCInterfaceEnable (void)
| Enable CM3 access to the OSC_DIG module. More...
__STATIC_INLINE void | OSCInterfaceDisable (void)
| Disable CM3 access to the OSC_DIG module. 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...

## Detailed Description

## Function Documentation

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

  ui32SrcClk | is the source clock to check. OSC_SRC_CLK_HF OSC_SRC_CLK_MF OSC_SRC_CLK_LF

Returns
  Returns the type of oscillator that drives the clock source.
  - OSC_RCOSC_HF
  - OSC_XOSC_HF
  - OSC_RCOSC_LF
  - OSC_XOSC_LF

See also
  OSCHfSourceSwitch()

Definition at line 155 of file osc.c.

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

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 as much as 500us (TBD), so the actual switch is split into a seperate function, leaving CM3 free to perform other tasks as the XTAL starts up.

TBD: How long does it take to start the XTAL?

Note
  The High Frequency (OSC_SRC_CLK_HF) and Medium Frequency (OSC_SRC_CLK_MF) can only be derived from the 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 before 7.5 ms (TBD) later.

Parameters

  ui32SrcClk | is the source clocks to configure. OSC_SRC_CLK_HF OSC_SRC_CLK_MF OSC_SRC_CLK_LF
  ui32Osc | is the oscillator that drives the source clock. OSC_RCOSC_HF OSC_XOSC_HF OSC_RCOSC_LF OSC_XOSC_LF

Returns
  None

Definition at line 85 of file osc.c.

Referenced by OSCHF_SwitchToRcOscTurnOffXosc(), OSCHF_TurnOnXosc(), SysCtrlPowerdown(), SysCtrlPowerEverything(), SysCtrlShutdown(), and SysCtrlStandby().

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 275 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

  timeUntilWakeupInMs | indicates how long time (milliseconds) to the startup will occur.

Returns
  Time margin to use in microseconds.

Definition at line 213 of file osc.c.

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 310 of file osc.c.

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 262 of file osc.c.

__STATIC_INLINE bool OSCHfSourceReady | ( | void |  | ) |

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 swithced.

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 235 of file osc.h.

Referenced by OSCHF_AttemptToSwitchToXosc().

__STATIC_INLINE void OSCHfSourceSwitch | ( | void |  | ) |

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 265 of file osc.h.

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

__STATIC_INLINE void OSCInterfaceDisable | ( | void |  | ) |

Disable CM3 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 AUX controller and the CPU, so enabling or disabling this interface must be done with consideration.

Returns
  None

Definition at line 303 of file osc.h.

Referenced by SysCtrlPowerdown(), SysCtrlShutdown(), and SysCtrlStandby().

void OSCInterfaceEnable | ( | void |  | ) |

Enable CM3 access to the OSC_DIG module.

Force power on AUX and enable clocks to allow CM3 access on the OSC_DIG interface.

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

Returns
  None

Definition at line 189 of file osc.c.

Referenced by SysCtrlPowerdown(), SysCtrlShutdown(), and SysCtrlStandby().

__STATIC_INLINE void OSCXHfPowerModeSet | ( | uint32_t | ui32Mode | ) |

Set Power Mode for High Frequency XTAL Oscillator.

Parameters

  ui32Mode | is the power mode for the HF XTAL. LOW_POWER_XOSC HIGH_POWER_XOSC

Returns
  None

Definition at line 144 of file osc.h.

## Macro Definition Documentation

#define HIGH_POWER_XOSC 0

Definition at line 99 of file osc.h.

Referenced by OSCXHfPowerModeSet().

#define LOW_POWER_XOSC 1

Definition at line 98 of file osc.h.

Referenced by OSCXHfPowerModeSet().

#define OSC_RCOSC_HF 0x00000000

Definition at line 110 of file osc.h.

Referenced by OSCClockSourceSet(), OSCHF_SwitchToRcOscTurnOffXosc(), SysCtrlPowerdown(), and SysCtrlShutdown().

#define OSC_RCOSC_LF 0x00000002

Definition at line 112 of file osc.h.

Referenced by OSCClockSourceSet(), and SysCtrlShutdown().

#define OSC_SRC_CLK_HF 0x00000001

Definition at line 106 of file osc.h.

Referenced by OSCClockSourceGet(), OSCClockSourceSet(), OSCHF_AttemptToSwitchToXosc(), OSCHF_SwitchToRcOscTurnOffXosc(), OSCHF_TurnOnXosc(), SysCtrlPowerdown(), SysCtrlPowerEverything(), and SysCtrlShutdown().

#define OSC_SRC_CLK_LF 0x00000004

Definition at line 108 of file osc.h.

Referenced by OSCClockSourceGet(), OSCClockSourceSet(), SysCtrlPowerdown(), SysCtrlPowerEverything(), SysCtrlShutdown(), and SysCtrlStandby().

#define OSC_SRC_CLK_MF 0x00000002

Definition at line 107 of file osc.h.

Referenced by OSCClockSourceSet(), OSCHF_SwitchToRcOscTurnOffXosc(), OSCHF_TurnOnXosc(), SysCtrlPowerdown(), SysCtrlPowerEverything(), and SysCtrlShutdown().

#define OSC_XOSC_HF 0x00000001

Definition at line 111 of file osc.h.

Referenced by OSCClockSourceSet(), OSCHF_AttemptToSwitchToXosc(), OSCHF_TurnOnXosc(), and SysCtrlPowerEverything().

#define OSC_XOSC_LF 0x00000003

Definition at line 113 of file osc.h.

Referenced by OSCClockSourceSet(), SysCtrlPowerdown(), SysCtrlPowerEverything(), and SysCtrlStandby().

#define SCLK_HF_RCOSC_HF 0

Definition at line 115 of file osc.h.

#define SCLK_HF_XOSC_HF 1

Definition at line 116 of file osc.h.

#define SCLK_LF_FROM_RCOSC_HF 0

Definition at line 121 of file osc.h.

#define SCLK_LF_FROM_RCOSC_LF 2

Definition at line 123 of file osc.h.

#define SCLK_LF_FROM_XOSC_HF 1

Definition at line 122 of file osc.h.

#define SCLK_LF_FROM_XOSC_LF 3

Definition at line 124 of file osc.h.

#define SCLK_MF_RCOSC_HF 0

Definition at line 118 of file osc.h.

#define SCLK_MF_XOSC_HF 1

Definition at line 119 of file osc.h.