Skip to content

Bluetooth: controller: Fix for scanner Rx window hang #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions samples/bluetooth/scan_adv/prj.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
CONFIG_BLUETOOTH=y
CONFIG_BLUETOOTH_BROADCASTER=y
CONFIG_BLUETOOTH_OBSERVER=y
CONFIG_BLUETOOTH_DEBUG_LOG=y
12 changes: 11 additions & 1 deletion subsys/bluetooth/controller/ll_sw/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -8141,6 +8147,7 @@ static u32_t role_disable(u8_t ticker_id_primary, u8_t ticker_id_stop)
_radio.ticker_id_stop = ticker_id_primary;

/* Step 1: Is Primary started? Stop the Primary ticker */
ret_cb = TICKER_STATUS_BUSY;
ret = ticker_stop(RADIO_TICKER_INSTANCE_ID_RADIO,
RADIO_TICKER_USER_ID_APP, ticker_id_primary,
ticker_if_done, (void *)&ret_cb);
Expand Down Expand Up @@ -8351,6 +8358,7 @@ u32_t radio_adv_enable(u16_t interval, u8_t chl_map, u8_t filter_policy)
goto failure_cleanup;
}

ret_cb = TICKER_STATUS_BUSY;
ret =
ticker_start(RADIO_TICKER_INSTANCE_ID_RADIO,
RADIO_TICKER_USER_ID_APP,
Expand Down Expand Up @@ -8481,7 +8489,9 @@ u32_t radio_scan_enable(u8_t type, u8_t init_addr_type, u8_t *init_addr,
TICKER_US_TO_TICKS(RADIO_TICKER_XTAL_OFFSET_US);
_radio.scanner.hdr.ticks_preempt_to_start =
TICKER_US_TO_TICKS(RADIO_TICKER_PREEMPT_PART_MIN_US);
_radio.scanner.hdr.ticks_slot = _radio.scanner.ticks_window;
_radio.scanner.hdr.ticks_slot =
_radio.scanner.ticks_window +
TICKER_US_TO_TICKS(RADIO_TICKER_START_PART_US);

ticks_interval = TICKER_US_TO_TICKS((u64_t) interval * 625);
if (_radio.scanner.hdr.ticks_slot >
Expand Down