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

why BLE_ADV_MODE_FAST is working but BLE_ADV_MODE_SLOW not working

im using sdk10, I initialiszed ble_stack_init and advertising_init but when starting advertising, it works with BLE_ADV_MODE_FAST but not with BLE_ADV_MODE_SLOW.

why it's not working with BLE_ADV_MODE_SLOW, according to nordic the only difference is it that is uses a longer advertising interval and time-out than fast advertising

image description

Parents
  • Before you can activate any kind of advertising, you have to initialize the parameters of that mode, that means ble_adv_slow_enabled = BLE_ADV_SLOW_ENABLED and also ble_adv_slow_interval and ble_adv_slow_timeout must be set when calling ble_advertising_init(). After that you can call ble_advertising_start(BLE_ADV_MODE_SLOW).

    Here an example where fast and and slow mode are initialized, but slow mode is activated afterwards:

    ble_adv_modes_config_t options;
    memset(&options, 0, sizeof(options));
    options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
    options.ble_adv_fast_interval = 20*1.6; // 20 ms
    options.ble_adv_fast_timeout  = 30;
    
    options.ble_adv_slow_enabled = BLE_ADV_SLOW_ENABLED;
    options.ble_adv_slow_interval = 1285*1.6; // 1285 ms
    options.ble_adv_slow_timeout  = 0;
    
    err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code);
    
    err_code = ble_advertising_start(BLE_ADV_MODE_SLOW);
    APP_ERROR_CHECK(err_code);
    

    Instead of starting the slow mode, the fast mode can be activated. After the fast mode timeout expires, it will switch to slow mode when it is enabled.

    When the timeout is set to 0 it will not expire and advertising will be running forever. The values of this example have been chosen as the most powersaving ones from the Apple recommendation in chapter "3.5 Advertising Interval" of developer.apple.com/.../BluetoothDesignGuidelines.pdf.

    Michael

  • You must set options.ble_adv_slow_timeout to some value > 0, zero is a invalid parameter.

Reply Children
No Data
Related