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
  • My recommendations to minimize impact on a BLE peripheral link is to:

    - For BLE scanning set scan window to 5ms (or less) and adjust scan interval to fit your power consumption requirements (5ms or more).

    - For ANT search check out this thread: 
    https://devzone.nordicsemi.com/f/nordic-q-a/60158/how-to-arrange-ble-and-ant-event/244652#244652 

  • The BLE peripheral connection is impacted by either ANT+ or BLE heart rate belt searching. Based on the ANT settings listed above, I feel like I've set the scan parameters to be "friendly" to the BLE peripheral operation. I have not used the ANT coexistence functions to alter the behavior that way. Is that likely to make a big difference?

    I also ran experiments with the BLE by setting the scan window to 10 msec and the scan interval to 20 msec. There didn't appear to be any improvement, but I will recheck. My understanding was that by using a 20msec interval, the 250 msec BLE peripheral schedule would be allowed to happen generally unimpeded.

  • Further, it does appear that changing the scanning parameters improves BLE peripheral performance when explicitly starting a scan using sd_ble_gap_scan_start. But when attempting to connect to a known peer using sd_ble_gap_connect without having previously scanned, which should be using the same scan parameters, the BLE performance is impacted.

  • 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

  • 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?

Reply Children
  • 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?

  • I don't have more details than is written in the softdevice specifications. I would think that even if scanning and connecting are using the same parameters, there is a fundamental difference between the two; scanning is more of a passive operation, where it is allowed to skip periods, because it can receive the advertisement on next period. connecting is more active operation, the softdevice will try to establish a connection asap, and will less likely want other operations to interfere with this. I am not aware of any example that use connect directly.

    Kenneth

  • Ok. I will research it further myself. 

    Back to your original response about coexistence of BLE and ANT. You cite a forum post that discusses use of the sd_ant_coex_config_set() function. Do you know the time scope for setting the coexistence parameters? For example, if they are set once at initialization are the parameters applied to all succeeded ANT search operations?

Related