Bluetooth: Controller: Fix missing window widening in ull_periph_setup

No window widening was applied to conn_offset_us causing the initial
ticker_cb to get called slightly too late

Apply window_widening_periodic_us to conn_offset_us, since this is the
worst-case window widening (win_offset is not allowed to be larger than
a connection interval) and is applied in the LLL window size already

Fixes EBQ failure in LL/TIM/PER/BV-02-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
This commit is contained in:
Troels Nilsson 2025-04-10 15:19:52 +02:00 committed by Benjamin Cabé
commit 6a5fa60ad4

View file

@ -418,6 +418,19 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr,
conn_offset_us -= EVENT_TICKER_RES_MARGIN_US;
conn_offset_us -= EVENT_JITTER_US;
conn_offset_us -= ready_delay_us;
/*
* NOTE: Correct window widening for the first connection will be:
*
* conn_offset_us -=
* DIV_ROUND_UP(((lll_clock_ppm_local_get() +
* lll_clock_ppm_get(conn->periph.sca)) *
* (win_offset * CONN_INT_UNIT_US + win_delay_us)), USEC_PER_SEC);
*
* But, as currently in the implementation the drift compensation uses the
* `lll->periph.window_widening_periodic_us` value, we may as well use that value here
* as well. Adding another value for LLL to use seems overkill for this one case.
*/
conn_offset_us -= lll->periph.window_widening_periodic_us;
#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
/* disable ticker job, in order to chain stop and start to avoid RTC