From b5235207d321525e9597d86a3db5ed3dc520ce95 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 30 Jun 2017 10:57:04 +0200 Subject: [PATCH] Bluetooth: controller: Fix for scanner Rx window hang With the fix in commit 3c23c6f53d69 ("Bluetooth: controller: Fix assert due to stale tick count") it is required that a skipping event shall abort the previous role in order to enable the ticker_job to resume and reschedule next ticker expiry. In the scan_adv sample, with continuous scanning, an advertiser would pre-empt it, but if the advertiser skipped its event without aborting the scanner, the scanner is hung with its rx window without a timeout, and HCI command to stop the advertiser will wait forever to complete. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ctrl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c index e6bb94675e4..baa96961cfa 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.c +++ b/subsys/bluetooth/controller/ll_sw/ctrl.c @@ -4358,6 +4358,12 @@ static u32_t event_common_prepare(u32_t ticks_at_expire, /* Check for stale ticks_at_expire */ if (ticker_ticks_diff_get(ticker_ticks_now_get(), ticks_at_expire) > TICKER_US_TO_TICKS(RADIO_TICKER_START_PART_US)) { + /* Abort any running role, as it probably is the cause for + * stale ticks_at_expire. + */ + event_stop(0, 0, 0, (void *)STATE_ABORT); + + /* TODO: How much consecutive skips is tolerable? */ return 1; }