Skip to content

Commit b46070f

Browse files
committed
Bluetooth: Controller: Tune aux offset calculation overhead assertion
Tune the aux offset calculation overhead assertion to use EVENT_OVERHEAD_START_US; this is the correct maximum overhead causing ISR latency for start of a radio event that occurs thereafter. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 3db3810 commit b46070f

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_vendor.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@
1616
/* Measurement based on drifting roles that can overlap leading to collision
1717
* resolutions that consume CPU time between radio events.
1818
* Value include max end, start and scheduling CPU usage times.
19-
* Measurements based on central_gatt_write and peripheral_gatt_write sample on
20-
* nRF52833 SoC.
19+
* Measurements based on central_gatt_write, peripheral_gatt_write, observer and
20+
* broadcaster_multiple samples on nRF52833 SoC.
2121
*/
2222
#if defined(CONFIG_BT_CTLR_ADV_EXT)
2323
#if defined(CONFIG_BT_OBSERVER)
2424
#if defined(CONFIG_BT_CTLR_PHY_CODED)
25-
/* Active connection in peripheral role with extended scanning on 1M and Coded
26-
* PHY, scheduling and receiving auxiliary PDUs.
25+
/* Simultaneous 3 extended advertising sets with extended scanning on 1M and Coded PHY, scheduling
26+
* and receiving auxiliary PDUs.
2727
*/
2828
#define EVENT_OVERHEAD_START_US 733 /* 24 RTC ticks */
2929
#else /* !CONFIG_BT_CTLR_PHY_CODED */
30-
/* Active connection in peripheral role with extended scanning on 1M only,
31-
* scheduling and receiving auxiliary PDUs.
30+
/* Active connection in peripheral role with extended scanning on 1M only, scheduling and receiving
31+
* auxiliary PDUs.
3232
*/
3333
#define EVENT_OVERHEAD_START_US 428 /* 14 RTC ticks */
3434
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
3535
#else /* !CONFIG_BT_OBSERVER */
36-
/* Active connection in peripheral role with legacy scanning on 1M.
36+
/* Simultaneous 3 extended advertising sets calculating aux offsets.
3737
*/
38-
#define EVENT_OVERHEAD_START_US 275 /* 9 RTC ticks */
38+
#define EVENT_OVERHEAD_START_US 367 /* 12 RTC ticks */
3939
#endif /* !CONFIG_BT_OBSERVER */
4040
#else /* !CONFIG_BT_CTLR_ADV_EXT */
4141
/* Active connection in peripheral role with additional advertising state.

subsys/bluetooth/controller/ll_sw/ull_adv_aux.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,7 +3208,7 @@ static void mfy_aux_offset_get(void *param)
32083208
id = TICKER_NULL;
32093209
ticks_to_expire = 0U;
32103210
ticks_current = adv->ticks_at_expire;
3211-
retry = 1U; /* Assert on first ticks_current change */
3211+
retry = 4U; /* Assert on 2 other adv set ticks_current change, and 2 scanners expiring */
32123212
do {
32133213
uint32_t volatile ret_cb;
32143214
uint32_t ticks_previous;
@@ -3323,10 +3323,11 @@ static void mfy_aux_offset_get(void *param)
33233323

33243324
/* Assertion check for delayed aux_offset calculations */
33253325
ticks_now = ticker_ticks_now_get();
3326-
ticks_elapsed = ticker_ticks_diff_get(ticks_now, ticks_current);
3327-
ticks_to_start = HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_XTAL_US) -
3328-
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US);
3329-
LL_ASSERT(ticks_elapsed < ticks_to_start);
3326+
ticks_elapsed = ticker_ticks_diff_get(ticks_now, adv->ticks_at_expire);
3327+
ticks_to_start = HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US);
3328+
LL_ASSERT_MSG((ticks_elapsed <= ticks_to_start), "%s overhead = %u (%u) us.",
3329+
__func__, HAL_TICKER_TICKS_TO_US(ticks_elapsed),
3330+
HAL_TICKER_TICKS_TO_US(ticks_to_start));
33303331
}
33313332

33323333
static void ticker_op_cb(uint32_t status, void *param)

0 commit comments

Comments
 (0)