From 084eb382c5c11a57f7e704bf127abe675142bb52 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Mon, 12 Sep 2022 12:16:47 +0200 Subject: [PATCH] nimble/ll: Fix scheduling adv PDUs We schedule consecutive PDUs in advertising event at "now" timestamp, but to make sure we do not miss the slow we should account for an extra tick that can happen during processing. --- nimble/controller/src/ble_ll_adv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c index c2ab127bf..edca7527b 100644 --- a/nimble/controller/src/ble_ll_adv.c +++ b/nimble/controller/src/ble_ll_adv.c @@ -4842,12 +4842,12 @@ ble_ll_adv_done(struct ble_ll_adv_sm *advsm) ++advsm->adv_chan; } - /* - * We will transmit right away. Set next pdu start time to now - * plus a xcvr start delay just so we dont count late adv starts + /* We want to send next PDU right away so start time is set to "now" + * plus scheduling offset. Add an extra tick since LL timer may tick + * when we calculate other things in the meantime. */ advsm->adv_pdu_start_time = ble_ll_tmr_get() + - g_ble_ll_sched_offset_ticks; + g_ble_ll_sched_offset_ticks + 1; #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV) /* If we're past aux (unlikely, but can happen), just drop an event */