Skip to content

Conversation

@anhmolt
Copy link
Contributor

@anhmolt anhmolt commented Nov 14, 2025

Improve clock and oscillator configuration. See individual commit messages for more info.

@github-actions github-actions bot added manifest changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. labels Nov 14, 2025
@NordicBuilder
Copy link

NordicBuilder commented Nov 14, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions
Copy link

You can find the documentation preview for this PR here.

However, always calibrate when this many intervals have passed.

choice
prompt "Clock accuracy" if NRF_SDH_CLOCK_LF_SRC_RC

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Clock accuracy" should be set for both RC and XO.
Default values should be
IF RC default = 500_PPM (=1)
IF XO default = 250_PPM (=0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have fixed the prompt and default values.


#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) && defined(CONFIG_NRF_GRTC_TIMER_SOURCE_LFXO)
#warning Please select CONFIG_NRF_GRTC_TIMER_SOURCE_LFLPRC or \
CONFIG_NRF_GRTC_TIMER_SOURCE_SYSTEM_LFCLK when using CONFIG_NRF_SDH_CLOCK_LF_SRC_RC

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave out "CONFIG_NRF_GRTC_TIMER_SOURCE_SYSTEM_LFCLK" as an suggested option (RC should be the only option)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I have removed this.


&grtc {
owned-channels = <0 1 2 3 4 5 6 7 8 9 10 11>;
/* Channels 7-11 reserved for Zero Latency IRQs, 3-4 for FLPR */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we modify this one to match Bare Metal/ SoftDevice use case?

  • SoftDevice (MPSL) will use channel 7-11 (i.e. set as child-owned-channel)
  • Update comment to reflect this (replace Zero Latency IRQ)
  • We don't support FLPR in BM, i.e. should we remove channel 3 and 4 from "child-owned-channel"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a commit to modify this. Please have a look.

BUILD_ASSERT(CONFIG_NRF_SDH_CLOCK_LF_RC_TEMP_CTIV == 0, "rc_temp_ctiv must be 0 when usings LFXO");
BUILD_ASSERT(CONFIG_NRF_SDH_CLOCK_LF_ACCURACY == 0, "accuracy must be 0 when using LFXO");

#if defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) && !defined(CONFIG_NRF_GRTC_TIMER_SOURCE_LFXO)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding SYSCOUNTER, should we add a separate WARNING ?
SoftDevice (MPSL) have the following requirements: Before enabling SoftDevice: "GRTC must be started by the application ......... the SYSCOUNTER must be enabled ......."
ref: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrfxlib/mpsl/doc/mpsl.html#:~:text=For%20the%20nRF54L%20Series%3A

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a build assert. Please have a look.

Copy link

@bjorn-tore-taraldsen bjorn-tore-taraldsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing the GRTC configuration, how/ where should we place that:
We should guide customer to select between :
CONFIG_NRF_GRTC_TIMER_SOURCE_LFXO=y
CONFIG_NRF_GRTC_TIMER_SOURCE_LFLPRC=y

@anhmolt anhmolt force-pushed the sdh-oscillator-clock-improvements branch 2 times, most recently from 0c3f1d6 to 052e4ea Compare November 17, 2025 17:23
@anhmolt
Copy link
Contributor Author

anhmolt commented Nov 17, 2025

I'm missing the GRTC configuration, how/ where should we place that: We should guide customer to select between : CONFIG_NRF_GRTC_TIMER_SOURCE_LFXO=y CONFIG_NRF_GRTC_TIMER_SOURCE_LFLPRC=y

Thanks. I have added a commit where the GRTC timer source is explicitly set/mentioned in the board defconfig.

@anhmolt anhmolt marked this pull request as ready for review November 17, 2025 17:26
@anhmolt anhmolt requested review from a team as code owners November 17, 2025 17:26
@anhmolt anhmolt removed the DNM Do not merge label Nov 17, 2025
Comment on lines +32 to +34
# Select GRTC timer source
# CONFIG_NRF_GRTC_TIMER_SOURCE_LFLPRC=y
CONFIG_NRF_GRTC_TIMER_SOURCE_LFXO=y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even need to default here, this is the default already since we don't have CLOCK_CONTROL enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose one reason to do it is that it some copy-pasta friendly when customers create their own boards?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted both options to be visible/ available here.
My thinking is that customer should select on of the options based on their need, without having to know what is the default.

#if ((CONFIG_NRF_SDH_CLOCK_LF_SRC == NRF_CLOCK_LF_SRC_RC) && \
(CONFIG_NRF_SDH_CLOCK_LF_ACCURACY != NRF_CLOCK_LF_ACCURACY_500_PPM))
#warning Please select NRF_CLOCK_LF_ACCURACY_500_PPM when using NRF_CLOCK_LF_SRC_RC
#if (CONFIG_NRF_SDH_CLOCK_LF_SRC == NRF_CLOCK_LF_SRC_XTAL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's okay, but we are using a macro from somewhere else when we have our own
#if defined(CONFIG_NRF_SDH_CLOCK_LF_SRC_XO) this would have the same effect, right?

Copy link
Contributor Author

@anhmolt anhmolt Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I have changed to #if defined(CONFIG_NRF_SDH_CLOCK_LF_SRC_XO). I was (over)thinking that CONFIG_NRF_SDH_CLOCK_LF_SRC could have its value set from elsewhere. But that would be wrong usage.

@anhmolt anhmolt force-pushed the sdh-oscillator-clock-improvements branch from 052e4ea to 1c48f90 Compare November 19, 2025 08:58
@NordicBuilder NordicBuilder added the DNM Do not merge label Nov 19, 2025
@eivindj-nordic eivindj-nordic added this to the v1.0.0 milestone Nov 19, 2025
@anhmolt anhmolt force-pushed the sdh-oscillator-clock-improvements branch from 1c48f90 to dbc1777 Compare November 21, 2025 11:36
@NordicBuilder NordicBuilder removed the DNM Do not merge label Nov 21, 2025
@anhmolt

This comment was marked as outdated.

@eivindj-nordic
Copy link
Contributor

Would be good with a changelog entry and some documentation for this :)

GRTC channels 7 to 11 are used by SoftDevice. FLPR is not
currently in use in the nRF Bare Metal and the channels
for FLPR have been allocated to application CPU.

Signed-off-by: Andreas Moltumyr <andreas.moltumyr@nordicsemi.no>
@anhmolt anhmolt force-pushed the sdh-oscillator-clock-improvements branch from dbc1777 to be0b4d9 Compare November 24, 2025 09:07
@anhmolt anhmolt requested a review from a team as a code owner November 24, 2025 09:07
@github-actions github-actions bot added doc-required PR must not be merged without tech writer approval. and removed manifest changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. labels Nov 24, 2025
The default GRTC timer source of the ``bm_nrf54l15dk`` board is LFXO :kconfig:option:`CONFIG_NRF_GRTC_TIMER_SOURCE_LFXO`.
Select the :kconfig:option:`CONFIG_NRF_GRTC_TIMER_SOURCE_LFLPRC` Kconfig option if it is desired to run the GRTC from RC.
* The :kconfig:option:`CONFIG_NRF_SDH_CLOCK_LF_RC_CTIV` and :kconfig:option:`CONFIG_NRF_SDH_CLOCK_LF_RC_TEMP_CTIV` Kconfig options with ranges, default values, help text, and conditional prompt.
These Kconfig options are zero if the LF clock source is XO and are only user configurable when the LF clock source is RC.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These Kconfig options are zero if the LF clock source is XO and are only user configurable when the LF clock source is RC.
These Kconfig options are zero if the LF clock source is XO and are only user-configurable when the LF clock source is RC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks.

* Added nrf54l15DK board variants for the S145 SoftDevice.
* Added

* The nrf54l15DK board variants for the S145 SoftDevice.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The nrf54l15DK board variants for the S145 SoftDevice.
* The nrf54L15 DK board variants for the S145 SoftDevice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks

@anhmolt
Copy link
Contributor Author

anhmolt commented Nov 24, 2025

Would be good with a changelog entry and some documentation for this :)

Added some lines to changelog. Documentation to follow.

Add dtsi file, with comments, for configuring HF and LF external
oscillators.
The file is to be used for configuring external/internal
load-capacitance for HF and LF oscillators. If an external oscillator
for the LF clock is not desired, the LFXO can be disabled to use
the internal LFRC.

Signed-off-by: Andreas Moltumyr <andreas.moltumyr@nordicsemi.no>
* Add a Kconfig choice for LF clock source selection.
* Only allow selecting LFXO if enabled in oscillator dts.
* Only allow selecting LFXO or LFRC if GRTC is configured to the same.
* Add a Kconfig choice for the LFRC calibration accuracy setting.
* Improve the LFRC calibration Kconfigs by adding conditional
  prompts and default values dependent on the LF clock source selection.
* Add some build asserts for checking that the GRTC is configured
  appropriately for SoftDevice use.
* Correct the prompt of CONFIG_NRF_SDH_CLOCK_LF_RC_TEMP_CTIV.

Signed-off-by: Andreas Moltumyr <andreas.moltumyr@nordicsemi.no>
Explicitly set the GRTC timer source to LFXO in the board defconfig.
Also add the associated LFLPRC choice, but commented out.

Signed-off-by: Andreas Moltumyr <andreas.moltumyr@nordicsemi.no>
@anhmolt anhmolt force-pushed the sdh-oscillator-clock-improvements branch from be0b4d9 to c4c97ee Compare November 24, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-required PR must not be merged without tech writer approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants