-
Notifications
You must be signed in to change notification settings - Fork 27
softdevice_handler, boards: improvements to LF clock and oscillator configuration #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
softdevice_handler, boards: improvements to LF clock and oscillator configuration #482
Conversation
|
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
|
You can find the documentation preview for this PR here. |
subsys/softdevice_handler/Kconfig
Outdated
| However, always calibrate when this many intervals have passed. | ||
|
|
||
| choice | ||
| prompt "Clock accuracy" if NRF_SDH_CLOCK_LF_SRC_RC |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
subsys/softdevice_handler/nrf_sdh.c
Outdated
|
|
||
| #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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
subsys/softdevice_handler/nrf_sdh.c
Outdated
| 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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
bjorn-tore-taraldsen
left a comment
There was a problem hiding this 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
0c3f1d6 to
052e4ea
Compare
Thanks. I have added a commit where the GRTC timer source is explicitly set/mentioned in the board defconfig. |
| # Select GRTC timer source | ||
| # CONFIG_NRF_GRTC_TIMER_SOURCE_LFLPRC=y | ||
| CONFIG_NRF_GRTC_TIMER_SOURCE_LFXO=y |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
subsys/softdevice_handler/nrf_sdh.c
Outdated
| #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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
052e4ea to
1c48f90
Compare
1c48f90 to
dbc1777
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
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>
dbc1777 to
be0b4d9
Compare
| 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * The nrf54l15DK board variants for the S145 SoftDevice. | |
| * The nrf54L15 DK board variants for the S145 SoftDevice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks
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>
be0b4d9 to
c4c97ee
Compare
Improve clock and oscillator configuration. See individual commit messages for more info.