This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE Central not getting a scan response message from a sensor

Shalom!

 Our central BLE nrf52840 device continuously scans using a UUID filter. I can see that the UUID is matched in nrf_ble_scan_on_adv_report().  In my ble_evt_handler's BLE_GAP_EVT_ADV_REPORT, I see all BLE devices in the central's range not only my sensor which is OK. I keep a list of the sensors with the filtered UUID and their RSSIs from their advertisements. I can select a MAC and connect to the device from the list without problems.

Now the company want to select a sensor according to its name which is sent in its scan response during he installation process.

I understand that I should be getting two events, one with the p_adv_report->type.scan_response flag raised. The flag is never raised.

Only for product installation, I would like to initiate a scan requests for the sensors, otherwise I would just like to sniff their advertisements.

static ble_gap_scan_params_t const m_scan_param =
{
    .active        = 0x01,
#if (NRF_SD_BLE_API_VERSION > 7)
    .interval_us   = NRF_BLE_SCAN_SCAN_INTERVAL * UNIT_0_625_MS,
    .window_us     = NRF_BLE_SCAN_SCAN_WINDOW * UNIT_0_625_MS,
#else
    .interval      = NRF_BLE_SCAN_SCAN_INTERVAL,
    .window        = NRF_BLE_SCAN_SCAN_WINDOW,
#endif // (NRF_SD_BLE_API_VERSION > 7)
    .filter_policy = BLE_GAP_SCAN_FP_WHITELIST,
    .timeout       = SCAN_DURATION_WITELIST,
    .scan_phys     = BLE_GAP_PHY_1MBPS,
};

/**@brief Function for initializing the scanning and setting the filters.
 */
static void scan_init(bool connect_if_matc)
{
    char sBuf[32];
    ret_code_t          err_code;
    nrf_ble_scan_init_t init_scan;

    memset(&init_scan, 0, sizeof(init_scan));
    init_scan.connect_if_match = connect_if_matc;
    init_scan.conn_cfg_tag     = APP_BLE_CONN_CFG_TAG;
#ifdef USE_PM
    init_scan.p_scan_param     = &m_scan_param;
#endif

    err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
    APP_ERROR_CHECK(err_code);
    //-------------------------------------------------------------------------
    // Remove any filters previously set
    //-------------------------------------------------------------------------
    err_code = nrf_ble_scan_all_filter_remove(&m_scan);
    APP_ERROR_CHECK(err_code);


    err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, &m_ami_uuid);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_UUID_FILTER, true);
    APP_ERROR_CHECK(err_code);
} // scan_init

How can I case a scan request to be sent?

Thank you

David Kaplan

Parents
  • I programmed my nRFDK52840 board with the sniffer and can see that my code is requesting a scan request and the sensor is replying with the information requested only I never get it in my event. As I wrote I am not getting two advertisement report messages. When I turn off my custom central board's power no scan reueasts are initiated so it has to be done by it.

    Thanks

Reply
  • I programmed my nRFDK52840 board with the sniffer and can see that my code is requesting a scan request and the sensor is replying with the information requested only I never get it in my event. As I wrote I am not getting two advertisement report messages. When I turn off my custom central board's power no scan reueasts are initiated so it has to be done by it.

    Thanks

Children
No Data
Related