From cca9d4e026be71cb5d24fb61a1c33c522354454f Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 27 Sep 2025 16:25:06 +0200 Subject: [PATCH] Bluetooth: Controller: Fix single switch timer use in ISO Sync Fix implementation of Broadcast ISO Synchronized Receiver using single switch timer to consider minimum compare value requirement. This fix reduces latencies to setup radio receptions and fixes an assertion in lll_sync_iso when radio_tmr_start_us() is checked for latencies. Relates to commit 5dfc58cff9c3 ("Bluetooth: Controller: Fix single switch timer minimum compare value"). Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/lll/lll_sync_iso.c | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c index 4f4dad90754f5..2083d8d7780ae 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c @@ -1352,22 +1352,25 @@ static void isr_rx(void *param) hcto -= addr_us_get(lll->phy); hcto -= radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); - overhead_us = radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); - overhead_us += addr_us_get(lll->phy); - overhead_us += radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); + /* Overhead within EVENT_IFS_US to exclude from max. jitter */ + /* Required radio ready duration, settling time */ + overhead_us = radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); + /* If single timer used, then consider required max. latency */ + overhead_us += HAL_RADIO_ISR_LATENCY_MAX_US; + /* Add chain delay overhead */ + overhead_us += radio_rx_chain_delay_get(lll->phy, PHY_FLAGS_S8); + /* Add base clock jitter overhead */ overhead_us += (EVENT_CLOCK_JITTER_US << 1); - LL_ASSERT(EVENT_IFS_US > overhead_us); + /* Max. available clock jitter */ jitter_max_us = (EVENT_IFS_US - overhead_us) >> 1; + /* Max. clock jitter per subevent */ jitter_max_us = (jitter_max_us * nse) / (lll->num_bis * lll->nse); - overhead_us = HAL_RADIO_TMR_START_DELAY_US; - if (jitter_max_us > overhead_us) { - jitter_max_us -= overhead_us; - } else { - jitter_max_us = 0U; - } + /* Min. clock jitter we shall use */ + jitter_max_us = MAX(jitter_max_us, (EVENT_CLOCK_JITTER_US << 1)); + /* Jitter for current subevent */ jitter_us = (EVENT_CLOCK_JITTER_US << 1) * nse; if (jitter_us > jitter_max_us) { jitter_us = jitter_max_us;