Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

BLE_GAP_EVT_ADV_REPORT generation for Active Scan

Hi,

I'm a newbie here.

I have a device using NRF52840 running SDK17 with SD v7 configured as a Central/Observer device doing Active Scan.

I have a few questions:

  • When will BLE_GAP_EVT_ADV_REPORT event gets generated when communicating with a scannable device?
    • Is it generated twice: 1st is when receiving the ADV_IND and the 2nd is when receiving the SCAN_RSP? 
    • Or, is it only once after receiving the SCAN_RSP? Is there risk of data in the scan buffer getting overwritten if the event is only generated once?
    • Or, it depends on the timing - could be once or twice?
  • What is the timeout duration to wait for the SCAN_RSP from the peripheral? Is this a configurable setting?
  • Are there error events generated when SCAN_RSP is not received? Are there configurable settings related to the SCAN_RSP handling?
Parents
  • Hi,

    Or, is it only once after receiving the SCAN_RSP? Is there risk of data in the scan buffer getting overwritten if the event is only generated once?

    You will get the event BLE_GAP_EVT_ADV_REPORT, and in the event here there is a flag called scan_response that is set to 1 if it's a scan response packet.https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/structble__gap__adv__report__type__t.html

    You will get this event when the SoftDevice sends the scan response request packet, and the peer responds with the scan response packet. As far as I can recall, there is an algorithm in the SoftDevice that decides how often it will request this packet.

    What is the timeout duration to wait for the SCAN_RSP from the peripheral? Is this a configurable setting?

    No timeout. If the SoftDevice request this packet, but does not receive it, a new request will later be sent.

    Are there error events generated when SCAN_RSP is not received? Are there configurable settings related to the SCAN_RSP handling?

    No.

  • Hi  ,

    Thanks for the explanation.

    A couple more question on this statement:

    No timeout. If the SoftDevice request this packet, but does not receive it, a new request will later be sent.

    • Will the SoftDevice wait for another ADV_IND from that same device to send a new request?
    • What is the behaviour of the SoftDevice when it receives an ADV_IND from another device while waiting for the SCAN_RSP from the first device (especially when it has been missed/lost)?
Reply
  • Hi  ,

    Thanks for the explanation.

    A couple more question on this statement:

    No timeout. If the SoftDevice request this packet, but does not receive it, a new request will later be sent.

    • Will the SoftDevice wait for another ADV_IND from that same device to send a new request?
    • What is the behaviour of the SoftDevice when it receives an ADV_IND from another device while waiting for the SCAN_RSP from the first device (especially when it has been missed/lost)?
Children
  • npo said:
    Will the SoftDevice wait for another ADV_IND from that same device to send a new request?

    Yes. If a advertiser is doing scannable advertising, it will transmit the normal advertising packet first, and after it have done that, it will for a short period of time stay in RX mode, listening for a scan response request from a potential scanner. The scanner needs to send the request in this window.

    npo said:
    What is the behaviour of the SoftDevice when it receives an ADV_IND from another device while waiting for the SCAN_RSP from the first device (especially when it has been missed/lost)?

    If it has sent a scan response request, and waiting for the scan response, I believe it will discard other ADV_IND received in this window.

Related