I'm using nRF52840 with nRF5_SDK_17.1.0_ddde560, using the ble_app_multirole_lesc example file.
When I set extended = 1 in scan_init, the debug session jumps to NRF_BREAKPOINT_COND with the message:// On assert, the system can only recover with a reset.
How can I correctly enable extended scanning?
Below is my scan_init configuration:
static void scan_init(void)
{
ret_code_t err_code;
ble_uuid_t target_uuid =
{
.uuid = BLE_UUID_HEART_RATE_SERVICE,
.type = BLE_UUID_TYPE_BLE
};
nrf_ble_scan_init_t init_scan;
memset(&init_scan, 0, sizeof(init_scan));
init_scan.connect_if_match = true;
init_scan.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
ble_gap_scan_params_t const m_scan_params =
{
.extended = 0, // Whenever I enable extended packet scanning, unidentified issues arise during runtime.
.active = 0,
.interval = NRF_BLE_SCAN_SCAN_INTERVAL,
.window = NRF_BLE_SCAN_SCAN_WINDOW,
.timeout = NRF_BLE_SCAN_SCAN_DURATION,
.scan_phys = BLE_GAP_PHY_1MBPS,
.filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL,
};
init_scan.p_scan_param = &m_scan_params;
err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
APP_ERROR_CHECK(err_code);
if (strlen(m_target_periph_name) != 0)
{
err_code = nrf_ble_scan_filter_set(&m_scan,
SCAN_NAME_FILTER,
m_target_periph_name);
APP_ERROR_CHECK(err_code);
}
err_code = nrf_ble_scan_filter_set(&m_scan,
SCAN_UUID_FILTER,
&target_uuid);
APP_ERROR_CHECK(err_code);
err_code = nrf_ble_scan_filters_enable(&m_scan,
NRF_BLE_SCAN_NAME_FILTER | NRF_BLE_SCAN_UUID_FILTER,
false);
APP_ERROR_CHECK(err_code);
}