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

Scanning for ANT+ Heart Rate Monitor Noticeably Impacts Existing BLE Peripheral Connection Performance

I am configuring the ANT+ scan on two separate channels with the following parameters:

ROMDATA_T ant_search_config_t aprfant_dynastream_search_config =
{
.channel_number = APRFANT_HRM_DYNASTREAM_SCAN_CHANNEL_NUMBER,
.low_priority_timeout = ANT_LOW_PRIORITY_TIMEOUT_DISABLE,
.high_priority_timeout = ANT_HIGH_PRIORITY_SEARCH_DISABLE,
.search_sharing_cycles = 64, //ANT_SEARCH_SHARING_CYCLES_DISABLE,
.search_priority = ANT_SEARCH_PRIORITY_DEFAULT,
.waveform = ANT_WAVEFORM_DEFAULT,
};

ROMDATA_T ant_search_config_t aprfant_suunto_search_config =
{
.channel_number = APRFANT_HRM_SUUNTO_SCAN_CHANNEL_NUMBER,
.low_priority_timeout = ANT_LOW_PRIORITY_TIMEOUT_DISABLE,
.high_priority_timeout = ANT_HIGH_PRIORITY_SEARCH_DISABLE,
.search_sharing_cycles = 64, //ANT_SEARCH_SHARING_CYCLES_DISABLE,
.search_priority = ANT_SEARCH_PRIORITY_DEFAULT,
.waveform = ANT_WAVEFORM_DEFAULT,
};

While the scan is active, an existing BLE peripheral connection (with notifications being sent every 250msec) is substantially impacted resulting in "bursty" delivery of notifications. Additionally, trying to establish a BLE peripheral connection while the scan is active works sometimes and not other times (this depends on the central device behavior).

I see other posts on the forum talking about BLE heart monitor scanning strategy related to reducing the scan window/interval to minimize the impact on an existing connection. I also see the same impact when scanning for a BLE heart rate monitor with an existing BLE peripheral connection.  I am currently using a 50 msec window and a 100 msec interval. I assume I should reduce both the lessen the impact on the BLE peripheral connection.

Could someone please suggest reasonable parameters for ANT+ and BLE scanning that will reduce the impact on the BLE peripheral connection while still giving good performance?

Parents Reply
  • I do not see how using sd_ble_gap_scan_start() before sd_ble_gap_connect() should have any influence, however if you look at the table 16-1 scheduling priorities in the S332 softdevice specification you can find that central connection setup have higher priority than serving BLE in a connection. I do not see any good workaround to that, maybe establish new connection with a very slow interval (>250ms) may help and/or prior to this period reduce the connection interval of the already established BLE link to 125ms for a short period of time (thereby indirectly every other BLE interval can be interrupted without any problems).

    Best regards,
    Kenneth

Children
  • Perhaps I wasn't clear. My application has two use cases: 1. Scanning and discovering unknown heart rate belts, followed by selecting one and establishing a connection. 2. Establishing a connection to a previously connected (but no longer connected) heart rate belts using device number (peer address).

    In use case 1, sd_ble_gap_scan_start() is used to discover and sd_ble_gap_connect() is used to connect. In use case 2, sd_ble_gap_connect() is used to connect which much use scan (?) to locate the specific peer address device.

  • I recommend you always do a scan first (sd_ble_gap_scan_start()), followed by a connect (sd_ble_gap_connect()), independent of use case 1 or 2. Using sd_ble_gap_connect() should only be called once you have received an advertisement packet first using sd_ble_gap_scan_start(). Using sd_ble_gap_connect() should only be used after you know the peer is in range and actively wanting to connect.

  • The approach I describe works so I'm not sure why I would need to scan first. What does the sd_ble_gap_connect() function use the scan parameter argument for if not to locate the specific device? Are you suggesting that "scanning while in the gap connect functionality" will be less likely to allow the peripheral work to get done?

  • Feel free to do this as you like.

    The "benefit" by scanning first is for instance if you have more than one peer that you may want to connect to, then by scanning first you will get an advertisement packet from any peer, and then you can connect with that one since you know it's in range and powered. While if you go straight to connect, then you will not know if there are other peers that you have a relationship with that is in range and powered up.

  • Can you point me to an example of how to connect using sd_ble_gap_connect() and a whitelist? Is it possible that will improve the behavior? If the BLE central his priority over all BLE peripheral connections why does scanning using 10 msec/20 msec scan parameters while the BLE peripheral is connected seem to improve behavior?

Related