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

Fast vs Slow advertising, where is the border between?

Hello all, I am trying to adjust the current consumption of my device based on nrf51822 s130. A have read the https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf recomendations and want to follow them. In code I found struct ble_adv_modes_config_t

bool     ble_adv_fast_enabled;      /**< Enable or disable fast advertising mode. */
uint32_t ble_adv_fast_interval;     /**< Advertising interval for fast advertising. */
uint32_t ble_adv_fast_timeout;      /**< Time-out (in seconds) for fast advertising. */
bool     ble_adv_slow_enabled;      /**< Enable or disable slow advertising mode. */
uint32_t ble_adv_slow_interval;     /**< Advertising interval for slow advertising. */
uint32_t ble_adv_slow_timeout;      /**< Time-out (in seconds) for slow advertising. */

It seems that both fast and slow could be configured at init and it should be the trigger that switches between fast and slow. Am I correct? Otherwice it hard to imagine cases like :

  ble_adv_fast_enabled == true;   //& 
  ble_adv_slow_enabled == true; 

So I have two time windows for fast and slow advertising ( 20ms @ 30s and 1285ms@10min) the timeouts could be catched in BLE_GAP_EVT_TIMEOUT event

 if(ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING){ ... }

Please direct me to sample code or explain how to configure and switch advertisement modes in the most proper way.

sincerely yours,

Parents
  • I haven't used the advertising module too much, but from the documentation it seems you can just enable fast advertising mode and slow advertising mode like this in advertising_init():

    ble_adv_modes_config_t options = {0};
    options.ble_adv_fast_enabled = BLE_ADV_FAST_ENABLED;
    options.ble_adv_fast_interval = APP_ADV_FAST_INTERVAL;
    options.ble_adv_fast_timeout = APP_ADV_FAST_TIMEOUT_IN_SECONDS;
    
    options.ble_adv_slow_enabled = BLE_ADV_SLOW_ENABLED;
    options.ble_adv_slow_interval = APP_ADV_SLOW_INTERVAL;
    options.ble_adv_slow_timeout = APP_ADV_SLOW_TIMEOUT_IN_SECONDS;
    

    When advertising, the module will pass through the enabled advertising modes until either a connection is made or advertising times out. The flow of advertising is Direct -> Direct Slow -> Fast -> Slow -> Idle. If you start advertising in direct mode, the module first attempts direct advertising. If no information about a previous connection is available or the previous peer is not available, the module attempts fast advertising. If no peer connects before the fast advertising times out, the application moves on to a longer advertising interval, thus slow advertising. If no peer connects before the configured time-out, advertising stops.

    Disabled advertising modes are skipped.

    So if you only have enabled fast and slow, you will have Fast -> Slow -> Idle.

  • Thanks! the link was helpful. However I have no possibility to use adv module due to low memory budget. As fas as I understand this module is just CASE that calls sd_ble_gap_adv_start with regard to modes order after BLE_GAP_TIMEOUT_SRC_ADVERTISING received.

Reply Children
Related