HEllo,
I am trying to set up a whitelist advertising and scanning, and while the advertising seems to go fine, I am getting an APP_ERROR:ERROR:Fatal
on my central while scanning. Why is this happening? Should I set something more on the central?
EDIT: I see that sd_ble_gap_scan_start()
return as error 0x07
I have the following scanning function
void scan_start(void)
{
uint32_t flash_busy;
// If there is any pending write to flash, defer scanning until it completes.
(void) fs_queued_op_count_get(&flash_busy);
// if (flash_busy != 0)
// {
// m_memory_access_in_progress = true;
// return;
// }
// Whitelist buffers.
ble_gap_addr_t whitelist_addrs[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
ble_gap_irk_t whitelist_irks[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
memset(whitelist_addrs, 0x00, sizeof(whitelist_addrs));
memset(whitelist_irks, 0x00, sizeof(whitelist_irks));
uint32_t addr_cnt = (sizeof(whitelist_addrs) / sizeof(ble_gap_addr_t));
uint32_t irk_cnt = (sizeof(whitelist_irks) / sizeof(ble_gap_irk_t));
// Reload the whitelist and whitelist all peers.
whitelist_load();
ret_code_t ret;
// Get the whitelist previously set using pm_whitelist_set().
ret = pm_whitelist_get(whitelist_addrs, &addr_cnt,
whitelist_irks, &irk_cnt);
if ( ! ( (addr_cnt == 0) && (irk_cnt == 0) ) && !m_whitelist_disabled )
{
// Use whitelist.
#if (NRF_SD_BLE_API_VERSION == 3)
m_scan_param.use_whitelist = 1;
m_scan_param.adv_dir_report = 0;
#endif
m_scan_param.timeout = 0x001E; // 30 seconds.
}
NRF_LOG_INFO("Starting scan.\r\n");
ret_code_t err_code;
err_code = sd_ble_gap_scan_start(&m_scan_param);
APP_ERROR_CHECK(err_code);
bsp_board_led_on(LED_SCANNING_ADVERTISING);
}
where
static ble_gap_scan_params_t const m_scan_param =
{
.active = 0x00,
.interval = SCAN_INTERVAL,
.window = SCAN_WINDOW,
.use_whitelist = 0x01, //0x00,
.adv_dir_report = 0x01, //0x00,
.timeout = 0x0000, // No timeout.
};