Clock Manager#

Overview#

Clock Manager is a platform-level software module that manages the device's oscillators and clock tree. The Clock Manager module is split into two main parts: The Initialization part and the Runtime part. The runtime part has its component clock_manager_runtime and can be used independently from the initialization part. The clock_manager component includes both the initialization part and the runtime part and it should be the component added to your project slcp file.

Initialization#

The initialization part includes the configuration files sl_clock_manager_oscillator_config.h and sl_clock_manager_tree_config.h. As their name indicates, those C header files are used to configure the different device oscillators and the device clock tree. Those header files use the CMSIS Configuration Wizard Annotations and are specific to each device. The API function sl_clock_manager_init() is used to initialize the Clock Manager module based on the configuration values specified in the two configuration files. This function must be called early during your initialization sequence. If the SL System component (System Initialization and Action Processing) is used by your application, the sl_clock_manager_init() call will be added automatically to your initialization sequence.

Oscillators Configuration#

Oscillators' configurations are all grouped in the sl_clock_manager_oscillator_config.h file. Crystal-based oscillators, HFXO and LFXO, have an enable/disable configuration to indicate if the required crystal is present or not. In the absence of the required crystal, the configuration must be disabled and the associated oscillator will not be initialized.

The HFXO configuration also provides the configuration for the Crystal Sharing feature when supported by the device. This feature allows to use the dedicated HFCLKOUT pin to output a sinusoidal clock that can be used as the HFXO input for another EFR device. In the configuration, you need to specify if your device is the leader or the follower. The leader will be the one outputting the clock and the follower, the one receiving the clock signal. In the leader configuration, the GPIO pin is used to receive the request from the follower. You can refer to your device datasheet to know the available location for the HFXO BUFOUT_REQ pin. In the follower mode, the pin configuration can be used to send an HFXO request signal to the leader. The "High Frequency Clock Ouput" section of your device reference manual also provides more details about this feature.

The first HFRCO module, whose output clock is called HFRCODPLL, can be connected to the DPLL module to have a better precision clock. When the DPLL is enabled through the configuration define SL_CLOCK_MANAGER_HFRCO_DPLL_EN, the DPLL settings take precedence over the HFRCO band configuration.

Clock Tree Configuration#

The device clock tree configurations are all grouped in the sl_clock_manager_tree_config.h file. Refer to your device's reference manual for the clock tree diagram and see which peripherals are connected to which clock branches. In the configuration file, each clock branch can be independently configured. However, to facilitate the clock setup for users, two additional configurations were added: SL_CLOCK_MANAGER_DEFAULT_HF_CLOCK_SOURCE and SL_CLOCK_MANAGER_DEFAULT_LF_CLOCK_SOURCE. Those configurations allow the selection of the default high-frequency and low-frequency oscillators to be used inside the clock tree. Every clock branch that can benefit from those default selections will use them by default. On certain devices, the Power Manager module offers an Execution Modes feature with the SL_POWER_MANAGER_EXECUTION_MODES_FEATURE_EN configuration. When this feature is enabled, the SL_CLOCK_MANAGER_SYSCLK_SOURCE configuration could be overriden by the Execution Modes feature. Refer to the description of SL_CLOCK_MANAGER_SYSCLK_SOURCE in sl_clock_manager_tree_config.h file to know if this is the case.

Some peripherals have an internal clock divider. Those are not handled by the Clock Manager configuration. The peripheral driver will usually expose the divider configuration when such a divider is present inside the peripheral module.

The Clock tree configuration is available at compile-time only. The Clock Manager module does not offer API functions to manipulate the clock tree at runtime.

The more oscillators are used by different clock branches the more power consumption you will have. To limit your power consumption, you can try to limit the number of oscillators used. So for example, only use one High-frequency oscillator and one Low-frequency oscillator across the clock tree. However, if the application is radio-based, the HFXO oscillator is mandatory for the Radio clock branch and if the Radio clock branch is connected to the SYSCLK branch, this will limit you to use HFXO for SYSCLK as well. In this specific case, SYSCLK could also be configured to use HFRCO with DPLL, but the chosen frequency must be two times the HFXO frequency so that the Radio module can retrieve the HF crystal frequency with its divider. This will also come with an increase in power consumption since both HFXO and HFRCO oscillators will be used. Refer to your device reference manual to know if your Radio clock is connected to the SYSCLK clock branch or not.

Note

The runtime part, which is associated with the clock_manager_runtime component, has also an initialization function of its own, sl_clock_manager_runtime_init(). This function must also be part of the initialization sequence. If the SL System component (System Initialization and Action Processing) is used by your application, the sl_clock_manager_runtime_init() call will be added automatically to your initialization sequence.

Functionalities#

The Runtime part includes functionalities related to oscillators, clock tree and the CMU hardware module features. The main functionalities are:

  • Retrieving the frequency or precision of an oscillator or clock branch

  • Enabling/Disabling modules' bus clock

  • Retrieving or setting calibration values for oscillators

  • Exporting clocks to GPIO

  • Starting an RCO Calibration process based on a reference clock source

Retrieve the frequency or precision of an oscillator or clock branch#

API functions sl_clock_manager_get_oscillator_frequency() and sl_clock_manager_get_oscillator_precision() allow retrieving respectively the frequency and precision of a given oscillator. Similar functions exist for clock branches: sl_clock_manager_get_clock_branch_frequency() and sl_clock_manager_get_clock_branch_precision().

To retrieve the frequency or precision of a specific peripheral, you will first need to retrieve to which clock branch this peripheral is connected. To do so, the Device Manager and its Device Abstraction Peripheral can be used. The below code example shows how to retrieve the clock branch of the TIMER0 peripheral.

#include "sl_clock_manager.h"
#include "sl_device_peripheral.h"

sl_status_t status;
uint32_t freq;
sl_clock_branch_t clock_branch;

clock_branch = sl_device_peripheral_get_clock_branch(SL_PERIPHERAL_TIMER0);
status = sl_clock_manager_get_clock_branch_frequency(clock_branch, &freq);

Enable/Disable modules' bus clock#

Before accessing a peripheral's register interface, its bus clock must be enabled, or else a bus fault exception will be triggered. API functions sl_clock_manager_enable_bus_clock() and sl_clock_manager_disable_bus_clock() allow to perform such operations.

Note that the peripheral clock will automatically be enabled when a peripheral is enabled with the clock on-demand feature.

Oscillator Calibration#

The Clock Manager initialization, if present, will calibrate the different oscillators during the initialization sequence, but sometimes calibration values must be updated during runtime in certain conditions, for example, if the device temperature changes too much. This is considered an advanced functionality and users must be careful as to when to use this functionality.

API functions sl_clock_manager_set_rc_oscillator_calibration() and sl_clock_manager_get_rc_oscillator_calibration() allow to set or get the CAL register of HFRCO and LFRCO oscillators. Not all devices have an LFRCO module with a CAL register. Some LFRCO modules will have a high-precision configuration allowing to use the HFXO to auto-calibrate the LFRCO. Refer to your device reference manual to retrieve oscillator specifications.

API functions sl_clock_manager_set_hfxo_calibration() and sl_clock_manager_get_hfxo_calibration() allow to set or get the COREBIASANA inside the HFXO XTALCTRL register. The HFXO module has a Core Bias Optimization stage at the end of the oscillator startup sequence that allows to further optimize current consumption. This optimization will automatically set the COREBIASANA bitfield when finished. Upon reset, this optimization will run the first time HFXO is started and afterwards, the XTALCTRL->SKIPCOREBIASOPT bit will automatically be set so that next time HFXO is started during the application lifetime, the optimization stage will be skipped. This optimization stage takes a while to run, in the order of hundreds of milliseconds, therefore we don't want it to run each time HFXO is started. With the function sl_clock_manager_set_hfxo_calibration() it is possible to manually set the COREBIASANA bitfield and set the SKIPCOREBIASOPT bit. This function will usually be used in the context of an EM4 wake-up where to save on the initialization sequence time, we want to skip the Core Bias Optimization stage and manually set the value that would have previously been retrieved with sl_clock_manager_get_hfxo_calibration() and saved in an EM4 retained memory. In this context, sl_clock_manager_set_hfxo_calibration() will need to be called early in the initialization sequence, before the usual clock initialization function.

slx_clock_manager_hfxo_set_ctune(), slx_clock_manager_hfxo_get_ctune() and slx_clock_manager_hfxo_calibrate_ctune() functions allow to manipulate the HFXO tuning capacitances. Changing the CTUNE value while HFXO is running can result in significant clock glitches for one clock period. Therefore, those functions should be used with caution. The difference between the slx_clock_manager_hfxo_set_ctune() and slx_clock_manager_hfxo_calibrate_ctune() functions is that the calibration one will also start and wait for the HFXO Core Bias Optimization stage to complete.

API functions sl_clock_manager_set_lfxo_calibration() and sl_clock_manager_get_lfxo_calibration() allow to set and get the LFXO CTUNE value.

Export clocks to GPIO#

The CMU module offers the functionality to export a given clock source to a GPIO pin. Refer to function sl_clock_manager_set_gpio_clock_output() for more details and the sl_clock_manager_export_clock_source_t enum for a list of acceptable clock sources. Note that there is a specific clock branch named EXPCLK that is usually connected to the SYSCLK and offers an additional divider.

RCO Calibration#

The CMU module also offers RCO Calibration hardware support. This can be used to calibrate at runtime HFRCO and LFRCO oscillators using a high-precision reference clock. Refer to your device reference manual for more details about this functionality. API function sl_clock_manager_configure_rco_calibration() can be used to configure the calibration process. Then sl_clock_manager_start_rco_calibration() and sl_clock_manager_stop_rco_calibration() can be called to start/stop the process. sl_clock_manager_wait_rco_calibration() function can be called to actively wait for the process to finish. And finally, sl_clock_manager_get_rco_calibration_count() can be called to retrieve the calibration process result.

Enumerations#

enum
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_DISABLED
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_FSRCO
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HFXO
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HFRCODPLL
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HFRCOEM23
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HFEXPCLK
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_LFXO
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_PLFRCO
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_LFRCO
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_ULFRCO
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HCLK
}

Export clock source.

enum
SL_CLOCK_MANAGER_EXPORT_CLOCK_OUTPUT_SELECT_0 = 0
SL_CLOCK_MANAGER_EXPORT_CLOCK_OUTPUT_SELECT_1
SL_CLOCK_MANAGER_EXPORT_CLOCK_OUTPUT_SELECT_2
}

Export clock output selection.

enum
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_HCLK
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_PRS
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_HFXO
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_LFXO
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_HFRCODPLL
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_HFRCOEM23
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_FSRCO
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_LFRCO
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_ULFRCO
}

Clocks available for Calibration.

Functions#

sl_status_t

Performs Clock Manager runtime initialization.

sl_status_t
sl_clock_manager_get_oscillator_frequency(sl_oscillator_t oscillator, uint32_t *frequency)

Gets frequency of given oscillator.

sl_status_t
sl_clock_manager_get_oscillator_precision(sl_oscillator_t oscillator, uint16_t *precision)

Gets precision of given oscillator.

sl_status_t
sl_clock_manager_get_clock_branch_frequency(sl_clock_branch_t clock_branch, uint32_t *frequency)

Gets frequency of given clock branch.

sl_status_t
sl_clock_manager_get_clock_branch_precision(sl_clock_branch_t clock_branch, uint16_t *precision)

Gets precision of given clock branch.

sl_status_t
sl_clock_manager_enable_bus_clock(sl_bus_clock_t module_bus_clock)

Enables the given module's bus clock.

sl_status_t
sl_clock_manager_disable_bus_clock(sl_bus_clock_t module_bus_clock)

Disables the given module's bus clock.

sl_status_t
sl_clock_manager_set_gpio_clock_output(sl_clock_manager_export_clock_source_t export_clock_source, sl_clock_manager_export_clock_output_select_t output_select, uint16_t hfexp_divider, uint32_t port, uint32_t pin)

Configures one clock export output with specified clock source.

sl_status_t
sl_clock_manager_set_rc_oscillator_calibration(sl_oscillator_t oscillator, uint32_t val)

Sets the RC oscillator frequency tuning control.

sl_status_t
sl_clock_manager_get_rc_oscillator_calibration(sl_oscillator_t oscillator, uint32_t *val)

Gets the RC oscillator frequency tuning setting.

sl_status_t

Sets the HFXO calibration value.

sl_status_t

Gets the HFXO calibration value.

sl_status_t

Sets the HFXO's CTUNE.

sl_status_t

Gets the HFXO's CTUNE.

sl_status_t

Updates the tuning capacitances and calibrate the Core Bias Current.

sl_status_t

Sets the LFXO frequency tuning control.

sl_status_t

Gets the LFXO frequency tuning setting.

sl_status_t
sl_clock_manager_configure_rco_calibration(uint32_t cycles, sl_clock_manager_clock_calibration_t down_counter_selection, sl_clock_manager_clock_calibration_t up_counter_selection, bool continuous_calibration)

Configures the RCO calibration.

void

Starts the RCO calibration.

void

Stops the RCO calibration.

void

Waits for the RCO calibration to finish.

sl_status_t

Gets calibration count value, returns the value of the up counter.

sl_status_t

Waits for USBPLL clock to be ready.

void

When this callback function is called, it means that HFXO failed twice in a row to start with normal configurations.

sl_status_t

Initializes Oscillators and Clock branches.

Enumeration Documentation#

sl_clock_manager_export_clock_source_t#

sl_clock_manager_export_clock_source_t

Export clock source.

This is to be used with the sl_clock_manager_set_gpio_clock_output() API function.

Enumerator
SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_DISABLED

Export Clock Source Disabled.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_FSRCO

Export Clock Source FSRCO.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HFXO

Export Clock Source HFXO.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HFRCODPLL

Export Clock Source HFRCODPLL.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HFRCOEM23

Export Clock Source HFRCOEM23.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HFEXPCLK

Export Clock Source HFEXPCLK.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_LFXO

Export Clock Source LFXO.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_PLFRCO

Export Clock Source PLFRCO.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_LFRCO

Export Clock Source LFRCO.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_ULFRCO

Export Clock Source ULFRCO.

SL_CLOCK_MANAGER_EXPORT_CLOCK_SOURCE_HCLK

Export Clock Source HCLK.


Definition at line 267 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_export_clock_output_select_t#

sl_clock_manager_export_clock_output_select_t

Export clock output selection.

This is to be used with the sl_clock_manager_set_gpio_clock_output() API function.

Enumerator
SL_CLOCK_MANAGER_EXPORT_CLOCK_OUTPUT_SELECT_0

Export Clock Output #0.

SL_CLOCK_MANAGER_EXPORT_CLOCK_OUTPUT_SELECT_1

Export Clock Output #1.

SL_CLOCK_MANAGER_EXPORT_CLOCK_OUTPUT_SELECT_2

Export Clock Output #2.


Definition at line 283 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_clock_calibration_t#

sl_clock_manager_clock_calibration_t

Clocks available for Calibration.

This is to be used with the sl_clock_manager_configure_rco_calibration() API function.

Enumerator
SL_CLOCK_MANAGER_CLOCK_CALIBRATION_HCLK

Clock Calibration HCLK.

SL_CLOCK_MANAGER_CLOCK_CALIBRATION_PRS

Clock Calibration PRS.

SL_CLOCK_MANAGER_CLOCK_CALIBRATION_HFXO

Clock Calibration HFXO.

SL_CLOCK_MANAGER_CLOCK_CALIBRATION_LFXO

Clock Calibration LFXO.

SL_CLOCK_MANAGER_CLOCK_CALIBRATION_HFRCODPLL

Clock Calibration HFRCODPLL.

SL_CLOCK_MANAGER_CLOCK_CALIBRATION_HFRCOEM23

Clock Calibration HFRCOEM23.

SL_CLOCK_MANAGER_CLOCK_CALIBRATION_FSRCO

Clock Calibration FSRCO.

SL_CLOCK_MANAGER_CLOCK_CALIBRATION_LFRCO

Clock Calibration LFRCO.

SL_CLOCK_MANAGER_CLOCK_CALIBRATION_ULFRCO

Clock Calibration ULFRCO.


Definition at line 291 of file platform/service/clock_manager/inc/sl_clock_manager.h

Function Documentation#

sl_clock_manager_runtime_init#

sl_status_t sl_clock_manager_runtime_init (void )

Performs Clock Manager runtime initialization.

Parameters
N/A

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 312 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_get_oscillator_frequency#

sl_status_t sl_clock_manager_get_oscillator_frequency (sl_oscillator_t oscillator, uint32_t * frequency)

Gets frequency of given oscillator.

Parameters
[in]oscillator

Oscillator

[out]frequency

Oscillator's frequency in Hertz

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 324 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_get_oscillator_precision#

sl_status_t sl_clock_manager_get_oscillator_precision (sl_oscillator_t oscillator, uint16_t * precision)

Gets precision of given oscillator.

Parameters
[in]oscillator

Oscillator

[out]precision

Oscillator's precision in PPM

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 337 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_get_clock_branch_frequency#

sl_status_t sl_clock_manager_get_clock_branch_frequency (sl_clock_branch_t clock_branch, uint32_t * frequency)

Gets frequency of given clock branch.

Parameters
[in]clock_branch

Clock Branch

[out]frequency

Clock Branch's frequency in Hertz

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 350 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_get_clock_branch_precision#

sl_status_t sl_clock_manager_get_clock_branch_precision (sl_clock_branch_t clock_branch, uint16_t * precision)

Gets precision of given clock branch.

Parameters
[in]clock_branch

Clock Branch

[out]precision

Clock Branch's precision in PPM

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 363 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_enable_bus_clock#

sl_status_t sl_clock_manager_enable_bus_clock (sl_bus_clock_t module_bus_clock)

Enables the given module's bus clock.

Parameters
[in]module_bus_clock

module's bus clock to enable.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note


Definition at line 377 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_disable_bus_clock#

sl_status_t sl_clock_manager_disable_bus_clock (sl_bus_clock_t module_bus_clock)

Disables the given module's bus clock.

Parameters
[in]module_bus_clock

module's bus clock to disable.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note


Definition at line 390 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_set_gpio_clock_output#

sl_status_t sl_clock_manager_set_gpio_clock_output (sl_clock_manager_export_clock_source_t export_clock_source, sl_clock_manager_export_clock_output_select_t output_select, uint16_t hfexp_divider, uint32_t port, uint32_t pin)

Configures one clock export output with specified clock source.

Parameters
[in]export_clock_source

One of the exportable clock source.

[in]output_select

Selected export clock output channel.

[in]hfexp_divider

HFEXP clock divider (1 to 32). Note: This parameter only affects the EXPCLK branch frequency.

[in]port

GPIO port to output exported clock.

[in]pin

GPIO pin number to output exported clock.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 410 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_set_rc_oscillator_calibration#

sl_status_t sl_clock_manager_set_rc_oscillator_calibration (sl_oscillator_t oscillator, uint32_t val)

Sets the RC oscillator frequency tuning control.

Parameters
[in]oscillator

RC Oscillator to set tuning value for.

[in]val

The RC oscillator frequency tuning setting to use.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note

  • RC Oscillator tuning is done during production, and the tuning value is loaded after a reset by the Clock Manager initialization code. Changing the tuning value from the calibrated value is for more advanced use. Certain oscillators also have build-in tuning optimization.

  • Supported RC oscillators include:

    • SL_OSCILLATOR_HFRCODPLL

    • SL_OSCILLATOR_HFRCOEM23

    • SL_OSCILLATOR_LFRCO


Definition at line 436 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_get_rc_oscillator_calibration#

sl_status_t sl_clock_manager_get_rc_oscillator_calibration (sl_oscillator_t oscillator, uint32_t * val)

Gets the RC oscillator frequency tuning setting.

Parameters
[in]oscillator

An RC oscillator to get tuning value for.

[out]val

The RC oscillator frequency tuning setting in use.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note

  • Supported RC oscillators include:

    • SL_OSCILLATOR_HFRCODPLL

    • SL_OSCILLATOR_HFRCOEM23

    • SL_OSCILLATOR_LFRCO


Definition at line 454 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_set_hfxo_calibration#

sl_status_t sl_clock_manager_set_hfxo_calibration (uint32_t val)

Sets the HFXO calibration value.

Parameters
[in]val

The HFXO calibration setting to use.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 466 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_get_hfxo_calibration#

sl_status_t sl_clock_manager_get_hfxo_calibration (uint32_t * val)

Gets the HFXO calibration value.

Parameters
[out]val

The current HFXO calibration value.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 476 of file platform/service/clock_manager/inc/sl_clock_manager.h

slx_clock_manager_hfxo_set_ctune#

sl_status_t slx_clock_manager_hfxo_set_ctune (uint32_t ctune)

Sets the HFXO's CTUNE.

Parameters
[in]ctune

The HFXO's CTUNE value.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note

  • Sets the XI value to the given ctune value and sets the XO value based on that same value, but with an offset that is hardware dependent. Updating CTune while the crystal oscillator is running can result in significant clock glitches for one XO clock period. Should be used with caution.


Definition at line 492 of file platform/service/clock_manager/inc/sl_clock_manager.h

slx_clock_manager_hfxo_get_ctune#

sl_status_t slx_clock_manager_hfxo_get_ctune (uint32_t * ctune)

Gets the HFXO's CTUNE.

Parameters
[out]ctune

The returned HFXO's CTUNE value.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note

  • This function only returns the CTUNE XI value. The XO value follows the XI value with a fixed delta that is hardware dependent.


Definition at line 506 of file platform/service/clock_manager/inc/sl_clock_manager.h

slx_clock_manager_hfxo_calibrate_ctune#

sl_status_t slx_clock_manager_hfxo_calibrate_ctune (uint32_t ctune)

Updates the tuning capacitances and calibrate the Core Bias Current.

Parameters
[in]ctune

The HFXO's CTUNE value.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note

  • Calibrating the CTUNE is time consuming and will cause glitches on the HFXO's clock. Care and caution should be taken when using this API.


Definition at line 519 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_set_lfxo_calibration#

sl_status_t sl_clock_manager_set_lfxo_calibration (uint32_t val)

Sets the LFXO frequency tuning control.

Parameters
[in]val

The LFXO frequency tuning setting to use.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 529 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_get_lfxo_calibration#

sl_status_t sl_clock_manager_get_lfxo_calibration (uint32_t * val)

Gets the LFXO frequency tuning setting.

Parameters
[out]val

The LFXO frequency tuning setting to use.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 539 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_configure_rco_calibration#

sl_status_t sl_clock_manager_configure_rco_calibration (uint32_t cycles, sl_clock_manager_clock_calibration_t down_counter_selection, sl_clock_manager_clock_calibration_t up_counter_selection, bool continuous_calibration)

Configures the RCO calibration.

Parameters
[in]cycles

Number of cycles to run calibration. Increasing this number increases precision, but the calibration will take more time.

[in]down_counter_selection

The clock which will be counted down cycles.

[in]up_counter_selection

The number of cycles generated by this clock will be counted and added up, the result can be given with sl_clock_manager_get_rco_calibration_count().

[in]continuous_calibration

Flag when true configures continuous calibration.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note

  • RCO calibration related functions are not thread-safe and should therefore not be called across multiple tasks.


Definition at line 565 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_start_rco_calibration#

void sl_clock_manager_start_rco_calibration (void )

Starts the RCO calibration.

Parameters
N/A

Note

  • RCO calibration related functions are not thread-safe and should therefore not be called across multiple tasks.


Definition at line 576 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_stop_rco_calibration#

void sl_clock_manager_stop_rco_calibration (void )

Stops the RCO calibration.

Parameters
N/A

Note

  • RCO calibration related functions are not thread-safe and should therefore not be called across multiple tasks.


Definition at line 584 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_wait_rco_calibration#

void sl_clock_manager_wait_rco_calibration (void )

Waits for the RCO calibration to finish.

Parameters
N/A

Note

  • RCO calibration related functions are not thread-safe and should therefore not be called across multiple tasks.


Definition at line 592 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_get_rco_calibration_count#

sl_status_t sl_clock_manager_get_rco_calibration_count (uint32_t * count)

Gets calibration count value, returns the value of the up counter.

Parameters
[out]count

Calibration count value.

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.

Note

  • RCO calibration related functions are not thread-safe and should therefore not be called across multiple tasks.


Definition at line 605 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_wait_usbpll#

sl_status_t sl_clock_manager_wait_usbpll (void )

Waits for USBPLL clock to be ready.

Parameters
N/A

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 613 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_hfxo_notify_consecutive_failed_startups#

void sl_clock_manager_hfxo_notify_consecutive_failed_startups (void )

When this callback function is called, it means that HFXO failed twice in a row to start with normal configurations.

Parameters
N/A

This may mean that there is a bad crystal. When getting this callback, HFXO is running but its properties (frequency, precision) are not guaranteed. This should be considered as an error situation.

Note

  • This callback will be called only when the SL_CLOCK_MANAGER_HFXO_SLEEPY_CRYSTAL_SUPPORT config is enabled


Definition at line 625 of file platform/service/clock_manager/inc/sl_clock_manager.h

sl_clock_manager_init#

sl_status_t sl_clock_manager_init (void )

Initializes Oscillators and Clock branches.

Parameters
N/A

Returns

  • Status code. SL_STATUS_OK if successful. Error code otherwise.


Definition at line 54 of file platform/service/clock_manager/inc/sl_clock_manager_init.h