Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Failed to receive scan_response

Hello everyone,
I've been trying to get scan_response data from a specific advertiser. Advertiser being nrf52810 running the s112 SoftDevices and Scanner being nrf52832 running the s132 SoftDevices. When I scan for devices Scanner detects the advertiser, but due to some problem, it's not able to get the scan response data. I scanned for devices using nRF Connect Android app. There I received scan response data perfectly from the same advertiser.
I'm setting ble_gap_scan_params_t as given below:

{
    .active   = 1,
    .interval = (BLE_GAP_SCAN_INTERVAL_MAX),
    .window   = (BLE_GAP_SCAN_WINDOW_MAX),

    .extended = 0,
    .report_incomplete_evts = 0,
    .channel_mask = {0,0,0,0,0},

    .timeout           = BLE_GAP_SCAN_TIMEOUT_UNLIMITED,
    .scan_phys         = BLE_GAP_PHY_AUTO,
    .filter_policy     = BLE_GAP_SCAN_FP_ACCEPT_ALL,
};

I'm also scanning in continues mode.
Also, I already know the MAC address of the advertiser device. So I'm filtering out all the other devices.
The summary for the event handler for BLE_GAP_EVT_ADV_REPORT is as follow:
//req_mac_addr = MAC address of target advertiser.
//current_mac_addr = MAC address of most recently scanned advertiser.

{
    if(mem_cmp(req_mac_addr, current_mac_addr, 6) == 0)
        {
            print_data_from_evt(Data_in_Receiver_buffer);
            
            print_data_from_evt(Scan_Response_Value_from ble_gap_adv_report_type_t);
        }
}

Here Scan_Response_Value is always zero and hence I can't get scan response data.
please suggest me something if you can.

  • Hello,

    Does the device keep scanning after getting an address match on the main advertisement packet?  Looks like you have configured everything correctly, but not sure what happens after you get a match. Could you try to add this code to your BLE_GAP_EVT_ADV_REPORT event and comment out the rest just to check if it ever receives a scan response from this device:

     

        uint8_t req_mac_addr[] = {0x85, 0x8d, 0x5e, 0x32, 0xBC, 0xAC}; // Insert address here
        
        if(!memcmp(req_mac_addr, p_adv_report->peer_addr.addr, sizeof(req_mac_addr)))
        {
            if (p_adv_report->type.scan_response)
            {
                __BKPT(0); // Break here if we received scan response from known device
            }

Related