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

Synchronize Central Connection Attempts with Known, but Slow, Peripheral Advertising Interval

Hello,

I have a system composed of one central that needs to 1) briefly connect to many (100+) peripherals, 2) download a small amount of data from each, and then 3) disconnect.  At the moment, the peripheral devices advertise with a 1 second interval for 60 seconds every 15 minutes.  The central and peripherals are all Nordic devices. 

My reading of the S140 documentation regarding "initiator timing" leads me to believe that if I call sd_ble_gap_connect() immediately after seeing an advertisement that SoftDevice will do nothing until the connection is established or the connection timeout occurs.  Is this a correct interpretation?

Instead of wasting this time between advertisements, I'd like the central to keep scanning for additional peripherals (and service any existing connections). Do you have recommendations for how to make this system as efficient as possible?

For example, once the central receives an advertisement from one of the peripherals, is it possible to use the SoftDevice to schedule the connection attempt to begin ~1s second later? 

Alternatively, it is possible for the peripherals to be modified to send 2-3 closely-spaced advertising events every 1 second so that sd_ble_gap_connect() could be called with a short scan timeout?

Thank you.

  • Hi Kyle,

    My reading of the S140 documentation regarding "initiator timing" leads me to believe that if I call sd_ble_gap_connect() immediately after seeing an advertisement that SoftDevice will do nothing until the connection is established or the connection timeout occurs.  Is this a correct interpretation?

    Yes, it will scan for advertising packets from connection target(s), also serve all established connections at the same time.

    Instead of wasting this time between advertisements, I'd like the central to keep scanning for additional peripherals (and service any existing connections). Do you have recommendations for how to make this system as efficient as possible?

    As I understood your case, you need to query each of 100+ devices once a 15 minutes. You can set a whitelist of up to 8 devices, it will connect to the first found one. From peripheral side, you can put device to 15-minute sleep right after successful connection, then wake up and advertise all the time until it's found by central again, maybe increasing advertising interval after 1 minute.

    Alternatively, it is possible for the peripherals to be modified to send 2-3 closely-spaced advertising events every 1 second so that sd_ble_gap_connect() could be called with a short scan timeout?

    I didn't get how this could help... Anyway, peripheral sends 3 advertising packets one-by-one on three channels (37,38,39), but you cannot know an exact time point - a random value is added to advertising interval each time.

Related