This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Fast advertising and slow advertising

Hi Im developing a filter - repeater signal on S130, and I want to advertise with a peridod of 20 ms for 10 seconds timeout. I'm confused with FAST ADVERTISING AND SLOW ADVERTISING, I don't know what to use and why. What is the recommended option for my purpose? I want that my device was unconnectable, but I have seen that the min time interval for unconnectable device is 100ms. What is the minimun interval for BLE_GAP_ADV_TYPE_ADV_SCAN_IND?

I have two structures: ble_gap_adv_params_t and ble_adv_modes_config_t, both has field for advertising interval and timeout. What has priority?

uint32_t      err_code;
ble_advdata_t advdata;


advdata.name_type               = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance      = true;
advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);

memset(&m_adv_params, 0, sizeof(m_adv_params));

m_adv_params.type				= BLE_GAP_ADV_TYPE_ADV_SCAN_IND;			
m_adv_params.fp				= BLE_GAP_ADV_FP_ANY;						
m_adv_params.p_whitelist		= NULL;
m_adv_params.interval           = BLE_GAP_ADV_INTERVAL;
m_adv_params.timeout            = BLE_GAP_ADV_TIMEOUT;


err_code = sd_ble_gap_adv_start(&m_adv_params);
APP_ERROR_CHECK(err_code);

Thank you

Parents
  • ble_adv_modes_config is the type that you use to set the advertising interval and timeout for a given advertising mode. In the example from advertising_init(..) below, fast advertising is enabled with a given advertising interval and timeout:

        ble_adv_modes_config_t options = {0};
        options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
        options.ble_adv_fast_interval = APP_ADV_INTERVAL;
        options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;
    

    ble_gap_adv_params_t is only used internally in advertising.c. It is used to apply the the advertising settings set in advertising_inti(..) for the various advertising cases in advertising_start(..).

    I would also recommend you to take a look at the documentation for the advertising module and the answer to this question, it explains the flow of the advertising module.

    The advertising interval should be within the range 20 ms to 10.24 s.

    Update 29.02.16: When advertising in a non-connectable mode, ADV_SCAN_IND or ADV_NONCONN_IND, the minimum advertising interval is 100 ms. The Bluetooth Core Specification v4.2 says the following in Vol 2, Part E, chapter 7.8.5:

    The Advertising_Interval_Min and Advertising_Interval_Max shall not be set to less than 0x00A0 (100 ms) if the Advertising_Type is set to 0x02 (ADV_SCAN_IND) or 0x03 (ADV_NONCONN_IND).

    ADV_SCAN_IND: Scannable undirected advertising

    ADV_NONCONN_IND: Non connectable undirected advertising

    For how to configure a non-connectable device, you can take a look at the ble_app_beacon example in the SDK.

Reply
  • ble_adv_modes_config is the type that you use to set the advertising interval and timeout for a given advertising mode. In the example from advertising_init(..) below, fast advertising is enabled with a given advertising interval and timeout:

        ble_adv_modes_config_t options = {0};
        options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
        options.ble_adv_fast_interval = APP_ADV_INTERVAL;
        options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;
    

    ble_gap_adv_params_t is only used internally in advertising.c. It is used to apply the the advertising settings set in advertising_inti(..) for the various advertising cases in advertising_start(..).

    I would also recommend you to take a look at the documentation for the advertising module and the answer to this question, it explains the flow of the advertising module.

    The advertising interval should be within the range 20 ms to 10.24 s.

    Update 29.02.16: When advertising in a non-connectable mode, ADV_SCAN_IND or ADV_NONCONN_IND, the minimum advertising interval is 100 ms. The Bluetooth Core Specification v4.2 says the following in Vol 2, Part E, chapter 7.8.5:

    The Advertising_Interval_Min and Advertising_Interval_Max shall not be set to less than 0x00A0 (100 ms) if the Advertising_Type is set to 0x02 (ADV_SCAN_IND) or 0x03 (ADV_NONCONN_IND).

    ADV_SCAN_IND: Scannable undirected advertising

    ADV_NONCONN_IND: Non connectable undirected advertising

    For how to configure a non-connectable device, you can take a look at the ble_app_beacon example in the SDK.

Children
  • Thanks for answering. I have readed the question, and documentation. I have a question of using advertising_init function, and it is that I don't know how to configure a no connectable device. If I configure a no_connectable_device using sd_ble_gap_adv_start manually, I can't advertise faster than a 100ms period. Is it possible to configure a no_connectable_device with advertising_init(...), or will I need to configure it manually? Can I reduce the advertising period, if I configure this kind of advertising?

    Thank you.

    Update 29.02.16: So I can't advertise faster than 100ms on non_connectable_mode. I was confused about it. My application is based on ble_app_hrs_c example and ble_app_beacon example. I guess that I have to configure Advertising type manually (calling to sd_ble_gap_adv_start(...)), like on ble_app_beacon. The code that I have written at first works fine, but I wanted to configure it by the best way.

    Thank you very much! Regards.

  • I have updated my answer to answer your questions.

  • If you want your device to have a shorter advertising interval than 100 ms, it can advertise as a connectable device and set it up to disconnect immediately upon a potential connection.

Related