Skip to content

clock_control: add vendor specific API to get HF clock startup time #90615

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

Conversation

bjarki-andreasen
Copy link
Collaborator

@bjarki-andreasen bjarki-andreasen commented May 26, 2025

  • Add vendor specific API to get HF clock startup time
  • Clean up HF clock bindings (HFXO)
  • Add HF clock bindings where missing

Note that for the nRF51, the clock was not called HFXO, but for simplicity its called HFXO in the devicetree

Copy link
Collaborator

@rugeGerritsen rugeGerritsen left a comment

Choose a reason for hiding this comment

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

@cvinayak , after this change EVENT_OVERHEAD_XTAL_US could start using the device-tree defined startup latency

@bjarki-andreasen bjarki-andreasen force-pushed the z_nrf_clock_control_get_startup_time branch from 4662a26 to f37b306 Compare May 27, 2025 11:00
@cvinayak
Copy link
Collaborator

@cvinayak , after this change EVENT_OVERHEAD_XTAL_US could start using the device-tree defined startup latency

@rugeGerritsen PR to cover the use of devicetree in bsim CI(not testing on target today, will test in the future at the next opportunity).
#90665

@cvinayak
Copy link
Collaborator

@aescolar do we need any DTS updates for bsim boards to pick the node value?

@cvinayak
Copy link
Collaborator

@aescolar do we need any DTS updates for bsim boards to pick the node value?

Looks like bsim CI already picks it up :-) .. there is mesh test failing.

@bjarki-andreasen bjarki-andreasen force-pushed the z_nrf_clock_control_get_startup_time branch from 09ce64a to 327cbc7 Compare May 27, 2025 12:36
rugeGerritsen added a commit to rugeGerritsen/sdk-zephyr that referenced this pull request May 27, 2025
This default matches the default before it got changed in
nrfconnect/sdk-nrf#22369. This ensures
that the current consumption when using Bluetooth remains unchanged.

The default of 854 is likely good enough for this board.

This noup commit can be replaced once:
* HFXO startup latency is defined in device tree
  zephyrproject-rtos/zephyr#90615
* The startup latency is configured per board and not per SoC.
  The startup latency is board specific as the HFXO is an SOC-external
  component.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
rugeGerritsen added a commit to rugeGerritsen/sdk-zephyr that referenced this pull request May 27, 2025
This default matches the default before it got changed in
nrfconnect/sdk-nrf#22369. This ensures
that the current consumption when using Bluetooth remains unchanged.

The default of 854 is likely good enough for this board.

This noup commit can be replaced once:
* HFXO startup latency is defined in device tree:
  zephyrproject-rtos/zephyr#90615
* The startup latency is configured per board and not per SoC.
  The startup latency is board specific as the HFXO is an SOC-external
  component.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
rugeGerritsen added a commit to rugeGerritsen/sdk-zephyr that referenced this pull request May 27, 2025
This default matches the default before it got changed in
nrfconnect/sdk-nrf#22369. This ensures
that the current consumption when using Bluetooth remains unchanged.

The default of 854 is slightly smaller than what is recommended
by the documentation provided for MPSL_HFCLK_LATENCY.
It is still likely good enough for this board and its use cases.

This noup commit can be replaced once:
* HFXO startup latency is defined in device tree:
  zephyrproject-rtos/zephyr#90615
* The startup latency is configured per board and not per SoC.
  The startup latency is board specific as the HFXO is an SOC-external
  component.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
@cvinayak cvinayak dismissed their stale review May 27, 2025 13:12

my requests addressed.

Add nrf51 series hfxo binding and nodes to socs.

Note that the values added to the soc .dtsi files are worst case
defaults, which will be replaced with optimal values at board level
in the future, as they depend on the specific crystal in use.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Add nrf52 series hfxo binding and nodes to socs.

Note that the values added to the soc .dtsi files are worst case
defaults, which will be replaced with optimal values at board level
in the future, as they depend on the specific crystal in use.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Add the clock startup time property to the nrf53 series HFXO binding.

Note that the values added to the soc .dtsi files are worst case
defaults, which will be replaced with optimal values at board level
in the future, as they depend on the specific crystal in use.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Each nrf series has its own variant of the hfxo clock, specified
by the binding which includes the series in the name. The nrf54L
series is no different, hence the binding should be clearly
specified by having the series name within it.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Each nrf series has its own variant of the lfxo clock, specified
by the binding which includes the series in the name. The nrf54L
series is no different, hence the binding should be clearly
specified by having the series name within it.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Add the clock startup time property to the nrf54l series HFXO binding.

Note that the values added to the soc .dtsi files are worst case
defaults, which will be replaced with optimal values at board level
in the future, as they depend on the specific crystal in use.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Implement vendor specific
z_nrf_clock_bt_ctlr_hf_get_startup_time_us() which gets the startup
time of the high frequency clock used for Bluetooth.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
CLOCK_CONTROL_NRF_HFINT_CALIBRATION depended on the renamed
nordic,nrf-hfxo -> nordic,nrf54l-hfxo. Update config to depend on
DT_HAS_NORDIC_NRF54L_HFXO_ENABLED to match new compat name.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
@bjarki-andreasen bjarki-andreasen force-pushed the z_nrf_clock_control_get_startup_time branch from 327cbc7 to ee4c537 Compare May 27, 2025 14:26
Copy link

*
* @retval HFCLK startup time in microseconds
*/
uint32_t z_nrf_clock_bt_ctlr_hf_get_startup_time_us(void);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could the bt_ctrl part be removed? The use-cases go beyond just Bluetooth controller.

Copy link
Collaborator Author

@bjarki-andreasen bjarki-andreasen May 28, 2025

Choose a reason for hiding this comment

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

The naming is intended to match z_nrf_clock_bt_ctlr_hf_request() and _release() to make it recognizable and clearly differentiate it from nrf_clock_control_hfxo_request() and newer APIs. It is planned to be replaced by the newer APIs in the future by #90399 in any case :)

rlubos pushed a commit to nrfconnect/sdk-zephyr that referenced this pull request May 28, 2025
This default matches the default before it got changed in
nrfconnect/sdk-nrf#22369. This ensures
that the current consumption when using Bluetooth remains unchanged.

The default of 854 is slightly smaller than what is recommended
by the documentation provided for MPSL_HFCLK_LATENCY.
It is still likely good enough for this board and its use cases.

This noup commit can be replaced once:
* HFXO startup latency is defined in device tree:
  zephyrproject-rtos/zephyr#90615
* The startup latency is configured per board and not per SoC.
  The startup latency is board specific as the HFXO is an SOC-external
  component.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
@kartben kartben merged commit b668e9d into zephyrproject-rtos:main May 28, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants