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

Significant difference in connection time with different adv intervals

Hi,

I have the following set up:

The remote: nrf51822 acts as central

The wheels: Each wheel has nrf51822 acting as peripheral.

The remote needs to first connect(at time: T1), then bond with both the wheels, exchange some handshake information regarding wheel status with both wheels, then proceed to active mode at time: T2(where both wheels are controlled by the remote).Connection interval is : 7.5msec to 30msec.

Case 1: When both wheels have advertisement interval as: 50msec, T2-T1 is less than a second.

Case 2: When both wheels have advertisement interval as: 200msec, T2-T1 is approximately 3 seconds.

Why is the huge time difference (more than a second) in case 1 and 2? Is this an expected behaviour?

Thanks.

  • Most likely it is expected behavior. But could you also tell us what you scan interval and window is? that could help understanding this. Rememer that the time it takes to establish a connection depends on both the advertiser and the scanner settings.

  • Hi run_ar, thanks for the reply. Please find my settings:

    Hash define SCAN_INTERVAL 0x00A0 // Determines scan interval in units of 0.625 millisecond.

    Hash define SCAN_WINDOW 0x0050 // Determines scan window in units of 0.625 millisecond.

    Hash define SCAN_TIMEOUT 0x0000 // Timout when scanning. 0x0000 disables timeout.

    Hash define MIN_CONNECTION_INTERVAL MSEC_TO_UNITS(7.5, UNIT_1_25_MS)

    Hash define MAX_CONNECTION_INTERVAL MSEC_TO_UNITS(30, UNIT_1_25_MS)

    I thought, from a logical point of view, there wouldnt be much of a difference (from a user point of view - seeing how long it takes to connect) when advertisement interval is 50msec Vs200msec. Please correct me if I am wrong.

  • image description

    This means that with a scan interval 100ms and a scan window 50, when using an advertisement interval of 50 ms or 200 ms, there is a significatn risk you will have to wait for a long time. Maybe you could try using 190ms as advertisemenet interval instead? I would also assume that if you use 40 instead of 50 ms you should see considerable faster connection esthablishement.

    Diclaimer: the advertising random delay is not accounted for in the picture above.

  • Hi run_ar, This makes sense. Thank you very much for the clear explanation. What if I have the scan interval as 40msec and scan window of 50msec? Then, there would be more chance of hits than misses, right?

  • The scan window cannot be larger that the scan interval. But, yes, if you scan all the time that would increase the chance of establishing the connection faster. Or at least receive the advertisement packet. If you have several scanners performing active scanning it might not be a good idea if all of them scans and sends scan requests that interfere with the connection request.

Related