Skip to content

Commit 6a5fa60

Browse files
Tronilkartben
authored andcommitted
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 <[email protected]>
1 parent 7e23f8b commit 6a5fa60

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

subsys/bluetooth/controller/ll_sw/ull_peripheral.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,19 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr,
418418
conn_offset_us -= EVENT_TICKER_RES_MARGIN_US;
419419
conn_offset_us -= EVENT_JITTER_US;
420420
conn_offset_us -= ready_delay_us;
421+
/*
422+
* NOTE: Correct window widening for the first connection will be:
423+
*
424+
* conn_offset_us -=
425+
* DIV_ROUND_UP(((lll_clock_ppm_local_get() +
426+
* lll_clock_ppm_get(conn->periph.sca)) *
427+
* (win_offset * CONN_INT_UNIT_US + win_delay_us)), USEC_PER_SEC);
428+
*
429+
* But, as currently in the implementation the drift compensation uses the
430+
* `lll->periph.window_widening_periodic_us` value, we may as well use that value here
431+
* as well. Adding another value for LLL to use seems overkill for this one case.
432+
*/
433+
conn_offset_us -= lll->periph.window_widening_periodic_us;
421434

422435
#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
423436
/* disable ticker job, in order to chain stop and start to avoid RTC

0 commit comments

Comments
 (0)