This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to get scan response data of connectable directed with sd_ble_gap_scan_start in the condition of reconnect?

Current I am using nRF52840 Dongle to develop a Bluetooth PC Tool base on nrf_ble_driver_obj_sd_api_v5 which shared on https://github.com/NordicSemiconductor/pc-ble-driver/blob/master/examples/heart_rate_collector/main.c

I add sd_ble_gap_connect and sd_ble_gap_authenticate into it. I believe I can pair with it now. 

Now I need to reconnect to it after the slave woke up. But I could not get scan response of connectable directed with sd_ble_gap_scan_start while I can get undirected scan response with it.

Please help. Thanks.

Parents
  • The directed advertisment packet (ADV_DIRECT_IND) contains only advertiser address + initiater address, there is no advertisement data or scan response to this packet. The directed advertisement packet is only intended for fast reconnection.

    Kenneth

  • Thanks, Kenneth. But how can I get the directed advertisement packet and how can I do a fast reconnection after I get it? which API should I use in nrf_ble_driver_obj_sd_api_v5 ? Thanks in advance.

  • The first question would be have you established a bond previously? Typically directed advertisement is only used after two peers have established a bond, thereby the advertiser and initiater have previously exchanged addresses (else the advertiser does not know which initiator address to place in the directed advertisment packet). 

    I am not familiar with the pc ble driver, but in principle the api and events should be the same as working on chip. In both cases (directed or undirected advertisement) the scanner should get an BLE_GAP_EVT_ADV_REPORT, and it should be possible to connect to the peer as normal in both cases, see message sequence charts:

    https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_p___s_c_a_n___m_s_c.html 
    https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_p___c_e_n_t_r_a_l___c_o_n_n___m_s_c.html 

    When scanning and connecting you should use BLE_GAP_SCAN_FP_ACCEPT_ALL, and on BLE_GAP_EVT_ADV_REPORT event while scanning you should check the ble_gap_evt_adv_report_t::direct_addr.addr_id_peer is set than you found proper peer, so just call sd_ble_gap_connect() with BLE_GAP_SCAN_FP_ACCEPT_ALL.

    Note: If the directed advertisment does not contain the initiater address of the scanner here, then the scanner will not receive the BLE_GAP_EVT_ADV_REPORT.

    Best regards,
    Kenneth

  • Thank you. Kenneth.

    Well, I think I should use the BLE_GAP_SCAN_FP_ACCEPT_ALL when scanning and connecting. But it only exist on SD_API_V6.

    Can you give me an instruction on how to update my nRF52840 dongle from SD_API_V5 to V6.

    Thanks.

  • It's not possible to use v6 without some major changes, I don't recommend trying that.

    What you are trying to do should work without updating. Do you have an on-air sniffer log that show that you are actually using directed advertisment to the peer device that is scanning?

    For v5 there is no specific filters, instead you can use the scan_params.adv_dir_report = 1; and possible .use_whitelist to achieve the same.

    Kenneth

Reply
  • It's not possible to use v6 without some major changes, I don't recommend trying that.

    What you are trying to do should work without updating. Do you have an on-air sniffer log that show that you are actually using directed advertisment to the peer device that is scanning?

    For v5 there is no specific filters, instead you can use the scan_params.adv_dir_report = 1; and possible .use_whitelist to achieve the same.

    Kenneth

Children
Related