From 6af809041b81087e0fd44419d04ba6eeffcaf24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikolai=20G=C3=BCtschow?= Date: Tue, 14 May 2024 16:23:28 +0200 Subject: [PATCH] cpu/nrf5x_common: properly calibrate RC-based low-frequency clock --- cpu/nrf5x_common/clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpu/nrf5x_common/clock.c b/cpu/nrf5x_common/clock.c index d5686fffbd..3ee5691a53 100644 --- a/cpu/nrf5x_common/clock.c +++ b/cpu/nrf5x_common/clock.c @@ -103,10 +103,12 @@ void clock_start_lf(void) clock_lf_running = true; /* calibrate the RC LF clock if applicable */ -#if (CLOCK_HFCLK && (CLOCK_LFCLK == 0)) +#if (CLOCK_LFCLK == CLOCK_LFCLKSRC_SRC_RC) + clock_hfxo_request(); NRF_CLOCK->EVENTS_DONE = 0; NRF_CLOCK->TASKS_CAL = 1; while (NRF_CLOCK->EVENTS_DONE == 0) {} + clock_hfxo_release(); #endif }