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

BLE Scan Packet Receive Latency When Done Along Side Mesh.

Hi,

Scenario:  Scanning  non mesh BLE packet with different stacks.

H/W Device -  nRF52DK

Observation:

Case 1. Non Mesh BLE Stack (Soft device):: Here able to receive scan packets in less than 1 sec interval.

Case 2. Mesh stack device                          : Here the scan packets are received around 10 to 15 secs of interval..

Is this expected behavior in mesh stack? Is there any way to decreases the latency between the reception of scan packets when done along with mesh?

Note: There is no difference in the advertisement frequency/packet in both the cases.

Parents
  • Hi,

    I would like some more information regarding your solution and setup.

    What are the parameters for the advertisements being sent? Most importantly advertising interval.

    For Case 1, what application are you running and using what SDK and version? For instance, is it an example from the nRF5 SDK? Which one?

    For Case 2, I assume you are using an example from the nRF5 SDK for Mesh. Can you confirm? What example? Is it with or without GATT proxy feature? How do you scan for the advertisements? (Through setting up a scanner using the nRF5 SDK libraries or by hooking onto the mesh stack for getting the advertisements?)

    Regards,
    Terje

  • Case 1: SDK 15 ble_app_scan_c 

    Case 2: I have tried both integrating the scan in both proxy as well as non proxy server example of light switch. Both seems to give the same result.(nrf_mesh_sdk_2.1.1)

    I am scanning for the advertisements using the nRF5 SDK libraries (nrf_sdh libraries to be exact).

    As for the advertisement interval  it is set as small as possible. I am not able to tell the exact interval as the advertising device is an android phone and android ble sdk allows us to just set values like 1, 2, 3 levels.

  • Hi,

    I see that a lot of time has passed, but I will provide some more answers in case it is still relevant and for anyone reading this in the future.

    For Android, the three advertising modes are typically 100 ms, 250 ms and 1000 ms advertising interval.

    When combining scanning with the mesh stack, you can hook onto the advertisements getting scanned by the mesh stack.The mesh stack is already scanning most of the time, and it can forward the advertisements it scans to the application through a callback function that you set with nrf_mesh_rx_cb_set(). You can also hook into mesh_gatt_on_ble_evt() by adding a "case BLE_GAP_EVT_ADV_REPORT" there.

    The other option is to use the scan module from the SDK, but in that case the scan module in the SDK and the mesh stack will compete for the radio, and every advertising packet will only reach one of them. If the mesh stack "wins" and gets most of the scan time then the scan through the SDK module will suffer.

    Regards,
    Terje

  • Hi,

    Unfortunately no. The Link Layer of our Bluetooth mesh stack only supports passive scanning, so there will not be sent any scan requests. For that you would have to use the SoftDevice API (for instance using the scan module from the SDK.) That means you alternate between giving radio time to BLE scanning and mesh stack operation, and so each of them will get less scan time.

    Regards,
    Terje

  • Hmm, that's a shame, as i would like to be able to actively scan and listen to the mesh all the time.

    Is this a feature that might be implemented later?

Reply Children
  • Hi,

    For details on future plans and roadmaps, please contact our Regional Sales Manager for your area. If you do not know who that is, please create a private ticket or send a private message and we will provide you with the contact details.

    Regards,
    Terje

  • Righto, will do. And if i were to add it myself, where would i start? Can i add scan requests to the mesh code? Or is there a way to let the scanner callbacks, call a function of the mesh that handles scanned advertisements?

  • Hi,

    The problem is that if you start modifying the mesh stack, in this case the link layer, it will no longer be covered by the qualification we have done and so you must do those qualifications yourself (which costs both time and money.) So the ideal situation is if you can either do with the current stack (taking a loss in latency and throughput) or if we add active scanning to the stack.

    There are mainly two things required for active scanning:

    1) The stack must provide both advertisement packets and scan response packets to the application. It does provide advertisement packets, but I am not sure if it does the same for scan response packets. If it doesn't then you must alter the stack. Also it requires listening on the correct channel.

    2) You must send a scan request whenever you receive a scanable advertisement. You might be able to do that from the application (through the callback function) but you need to get the timing right and use the correct channel. You also need access to the radio peripheral for this, which I doubt is possible with current SoftDevices as you can only have one user of timeslots (and that user will be the mesh stack.) So basically that means the implementation must be done within the mesh stack.

    Regards,
    Terje

  • Where can the code be adjusted to also receive scan responses? At https://github.com/NordicSemiconductor/nRF5-SDK-for-Mesh there is a scanner_packet_process_cb in nrf_mesh.c. Are scan responses received but filtered. Or what's exactly the implementation?

  • I have combined ble scan example from sdk 11 and the mesh sdk light bulb example. The thing is since both mesh and the BLe soft device scan essentially uses the same scan apis internally we need not go making changes to mesh stack.

Related