-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Radio nrf54h20 clock control #18694
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
Radio nrf54h20 clock control #18694
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ | |
| CONFIG_NCS_SAMPLES_DEFAULTS=y | ||
| CONFIG_ESB=y | ||
| CONFIG_DK_LIBRARY=y | ||
| CONFIG_CLOCK_CONTROL=y | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ | |
| CONFIG_NCS_SAMPLES_DEFAULTS=y | ||
| CONFIG_ESB=y | ||
| CONFIG_DK_LIBRARY=y | ||
| CONFIG_CLOCK_CONTROL=y | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,8 @@ | |
| * | ||
| * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| */ | ||
| #if defined(CONFIG_CLOCK_CONTROL_NRF) | ||
| #include <zephyr/drivers/clock_control.h> | ||
| #include <zephyr/drivers/clock_control/nrf_clock_control.h> | ||
| #endif /* defined(CONFIG_CLOCK_CONTROL_NRF) */ | ||
| #if defined(NRF54L15_XXAA) | ||
| #include <hal/nrf_clock.h> | ||
| #endif /* defined(NRF54L15_XXAA) */ | ||
|
|
@@ -20,6 +18,9 @@ | |
| #include <zephyr/kernel.h> | ||
| #include <zephyr/types.h> | ||
| #include <dk_buttons_and_leds.h> | ||
| #if defined(CONFIG_CLOCK_CONTROL_NRF2) | ||
| #include <hal/nrf_lrcconf.h> | ||
| #endif | ||
|
|
||
| LOG_MODULE_REGISTER(esb_ptx, CONFIG_ESB_PTX_APP_LOG_LEVEL); | ||
|
|
||
|
|
@@ -97,7 +98,44 @@ int clocks_start(void) | |
| LOG_DBG("HF clock started"); | ||
| return 0; | ||
| } | ||
| #endif /* defined(CONFIG_CLOCK_CONTROL_NRF) */ | ||
|
|
||
| #elif defined(CONFIG_CLOCK_CONTROL_NRF2) | ||
|
|
||
| int clocks_start(void) | ||
| { | ||
| int err; | ||
| int res; | ||
| const struct device *radio_clk_dev = | ||
| DEVICE_DT_GET_OR_NULL(DT_CLOCKS_CTLR(DT_NODELABEL(radio))); | ||
| struct onoff_client radio_cli; | ||
|
|
||
| /** Keep radio domain powered all the time to reduce latency. */ | ||
| nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, NRF_LRCCONF_POWER_DOMAIN_1, true); | ||
|
|
||
| sys_notify_init_spinwait(&radio_cli.notify); | ||
|
|
||
| err = nrf_clock_control_request(radio_clk_dev, NULL, &radio_cli); | ||
|
|
||
| do { | ||
| err = sys_notify_fetch_result(&radio_cli.notify, &res); | ||
| if (!err && res) { | ||
| LOG_ERR("Clock could not be started: %d", res); | ||
| return res; | ||
| } | ||
| } while (err == -EAGAIN); | ||
|
|
||
| #if defined(NRF54L15_XXAA) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section is repeated from the other branch of the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For CONFIG_CLOCK_CONTROL_NRF2 it is not needed. |
||
| /* MLTPAN-20 */ | ||
| nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_PLLSTART); | ||
| #endif /* defined(NRF54L15_XXAA) */ | ||
|
|
||
| LOG_DBG("HF clock started"); | ||
| return 0; | ||
| } | ||
|
|
||
| #else | ||
| BUILD_ASSERT(false, "No Clock Control driver"); | ||
| #endif /* defined(CONFIG_CLOCK_CONTROL_NRF2) */ | ||
|
|
||
| int esb_initialize(void) | ||
| { | ||
|
|
@@ -162,12 +200,10 @@ int main(void) | |
|
|
||
| LOG_INF("Enhanced ShockBurst ptx sample"); | ||
|
|
||
| #if defined(CONFIG_CLOCK_CONTROL_NRF) | ||
| err = clocks_start(); | ||
| if (err) { | ||
| return 0; | ||
| } | ||
| #endif /* defined(CONFIG_CLOCK_CONTROL_NRF) */ | ||
|
|
||
| err = dk_leds_init(); | ||
| if (err) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.