I'm trying to test long range beacons with coded phy on the nrf52840 dongle, so I've set out to turn my nrf52840 DK into a beacon scanner that will spit out data over uart.
I've started with the ble_app_uart_c example and added the BLE_GAP_EVT_ADV_REPORT to the ble_evt_handler to pick them up.
I'm running into trouble actually changing to a coded phy for scanning, and the application seems to crash when I set the init_scan.p_scan_param.
static ble_gap_scan_params_t const m_scan_param_coded_phy = { .extended = 1, .active = 0x01, .interval = BLE_GAP_SCAN_INTERVAL_MIN, .window = 10, .timeout = 0x0000, // No timeout. .scan_phys = BLE_GAP_PHY_CODED, .filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL, }; 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_param_coded_phy; // My addition err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler); APP_ERROR_CHECK(err_code); err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, &m_nus_uuid); APP_ERROR_CHECK(err_code); err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_UUID_FILTER, false); APP_ERROR_CHECK(err_code); }
Not sure what's going on here at all, or if I'm at all doing the right thing!