Kinetis SDK v.1.3 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
The section describes the programming interface of the OSC HAL driver. The OSC module is a crystal oscillator. The module and the external crystal or resonator generate a reference clock for the MCU.
The OSC HAL driver provides APIs to:
To enable/disable OSCERCLK, use the functions OSC_HAL_SetExternalRefClkCmd() and OSC_HAL_SetExternalRefClkInStopModeCmd(). These functions configure the OSCERCLK enabling or disabling in normal mode or stop mode.
The function OSC_HAL_SetExternalRefClkDiv() configures the OSCERCLK divider.
To configure capacitor load, use the function OSC_HAL_SetCapacitor and pass the capacitor load as parameter. Example:
Files | |
file | fsl_osc_hal.h |
Enumerations | |
enum | osc_capacitor_config_t { kOscCapacitor2p = OSC_CR_SC2P_MASK, kOscCapacitor4p = OSC_CR_SC4P_MASK, kOscCapacitor8p = OSC_CR_SC8P_MASK, kOscCapacitor16p = OSC_CR_SC16P_MASK } |
Oscillator capacitor load configurations. More... | |
oscillator control APIs | |
static void | OSC_HAL_SetExternalRefClkCmd (OSC_Type *base, bool enable) |
Enables the external reference clock for the oscillator. More... | |
static bool | OSC_HAL_GetExternalRefClkCmd (OSC_Type *base) |
Gets the external reference clock enable setting for the oscillator. More... | |
static void | OSC_HAL_SetExternalRefClkInStopModeCmd (OSC_Type *base, bool enable) |
Enables/disables the external reference clock in stop mode. More... | |
void | OSC_HAL_SetCapacitor (OSC_Type *base, uint32_t bitMask) |
Sets the capacitor configuration for the oscillator. More... | |
|
inlinestatic |
This function enables the external reference clock output for the oscillator, OSCERCLK. This clock is used by many peripherals. It should be enabled at an early system initialization stage to ensure the peripherals can select and use it.
base | Oscillator register base address |
enable | enable/disable the clock |
|
inlinestatic |
This function gets the external reference clock output enable setting for the oscillator , OSCERCLK. This clock is used by many peripherals. It should be enabled at an early system initialization stage to ensure the peripherals could select and use it.
base | Oscillator register base address |
|
inlinestatic |
This function enables/disables the external reference clock (OSCERCLK) when an MCU enters the stop mode.
base | Oscillator register base address |
enable | enable/disable setting |
void OSC_HAL_SetCapacitor | ( | OSC_Type * | base, |
uint32_t | bitMask | ||
) |
This function sets the specified capacitors configuration for the oscillator. This should be done in the early system level initialization function call based on the system configuration.
base | Oscillator register base address |
bitMask | Bit mask for the capacitor load option. |
Example: