From 154754b577f7fe42b24f699de89c3efa9fb64e36 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Fri, 24 Feb 2023 23:57:40 +0100 Subject: [PATCH] nimble/phy/nrf5x: Fix setting RTC CC[0] value CC[0] has only 24 bits valid so we should mask target value. Not really sure if this does matter on actual hardware (should not?), but BabbleSim does not handle it correctly. --- nimble/drivers/nrf5x/src/ble_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nimble/drivers/nrf5x/src/ble_phy.c b/nimble/drivers/nrf5x/src/ble_phy.c index c1e2df725..bf989e88e 100644 --- a/nimble/drivers/nrf5x/src/ble_phy.c +++ b/nimble/drivers/nrf5x/src/ble_phy.c @@ -782,7 +782,7 @@ ble_phy_set_start_now(void) */ now = os_cputime_get32(); NRF_RTC0->EVENTS_COMPARE[0] = 0; - nrf_rtc_cc_set(NRF_RTC0, 0, now + 3); + nrf_rtc_cc_set(NRF_RTC0, 0, (now + 3) & 0xffffff); nrf_rtc_event_enable(NRF_RTC0, RTC_EVTENSET_COMPARE0_Msk); #if PHY_USE_FEM_LNA