Does the nRF5 SDK Scanning module support scanning extended advertising packets? For example to discover a Peripheral advertising using the Coded PHY?
When I try this, I get the following error:
ble_scan: sd_ble_gap_scan_start returned 0x9 app: ERROR 9 [NRF_ERROR_INVALID_LENGTH] at main.c:177 PC at: 0x0002D295
After looking through at the scan data structure, I see that scan_buffer_data has a length of NRF_BLE_SCAN_BUFFER which is equal to 31. Does that mean it cannot handle extended advertising packets since their size can be up to 255 bytes?
This is my code for scan_init():// Scan parameters requested for scanning and connection. static ble_gap_scan_params_t const m_scan_params = { .extended = 1, .active = 0x00, .interval = SCAN_INTERVAL, .window = SCAN_WINDOW, .timeout = 0x0000, // No timeout. .scan_phys = BLE_GAP_PHY_CODED, .filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL, }; static char const m_target_periph_name[] = "Nordic_Blinky_Coded"; /**< Name of the device we try to connect to. This name is searched in the scan report data*/ static void scan_init(void) { ret_code_t err_code; 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; 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); // Setting filters for scanning. err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_NAME_FILTER, false); APP_ERROR_CHECK(err_code); err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_NAME_FILTER, m_target_periph_name); APP_ERROR_CHECK(err_code); }
My goal is to discover a Peripheral that is using Coded PHY for advertising and connect to it whenver the device is discovered by the Central (via its advertised name).