Scanning parameter settings to get the most advertisements but also handle connections

Hi,

I'm struggling to fully understand the scan window and scan interval. According to the graph of the "Nordic Primary channel scanner timing" the scan window should always be smaller than the scan interval, so there is time to handle connections.

So in some posts I read that I should set the scan interval the same size as the scan window. From my understanding that means the central is always in receive and scanning? I've tried that and thought all my connections will "break", but surprisingly they all worked; slow but they worked.

So what exactly does the SoftDevice in the background, if I set the scan interval and window to the same size and still have connections running.
I'm using NRF52840, NCS 2.5.1 (Zephyr)

To my scenario:

  • I have up to 20 connections with a connection interval of 200ms
  • My data throughput is minimal
  • Furthermore I have beacons with advertisements every second.

What would be the best setting to handle all connections good, but receive as much advertisements from the beacons as possible.

Thanks and Best Regards,

Phobios

  • Hi Manuel

    Sorry for the slow response, it has been pretty hectic here around the Easter holidays. 

    Setting the scan interval and window to the same is not a good idea, then you will get a lot of scheduling conflicts between your connections and the scanning. Scanning has lower priority than connections and would typically be down prioritized, and you would see scanning duty cycle drop. 

    By default the central connections should be scheduled 2.5ms apart, which means 20 connections should occupy 50ms every 200ms when using this connection interval. 

    Could you try to set the scan interval to 200ms and the scan window somewhere in the 100-150ms range? 

    Then the stack should be able to schedule scanning and connections without any conflict. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    I've tried your settings. The peripherals are currently sending periodic advertisements every second
    With the scanning to 200/150 I only get around 1/3 of the advertisements which are sent out, with greater distance even only about 1/6 - I have far better results with 50 /50...

    What can I do to improve the receiving of the advertisements?
    Is it better to send out advertisement bursts in a greater interval?

    Thanks and best Regards,
    Manuel

  • Hi Manuel

    I discussed this with the developers, and they pointed out that when you set the scan interval and window to the same value the scheduler uses so called cooperative scanning to maximize scanning duty cycle, while letting other activities such as connections or advertisements occur in between. 

    This is described in more detail here.

    In other words my earlier comment regarding scan interval and window is incorrect, sorry for the confusion. 

    With this in mind it makes sense that you see better performance when using 50/50 compared to 200/150. You could try higher values also, like 100/100 or 200/200, but I wouldn't expect a dramatic difference. 

    Best regards
    Torbjørn 

Related