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

Infinite advertising with SD 8.0.0

Hi,

Recently I updated my SoftDevice on beacon from 7.1.0 to 8.0.0. Unfortunately, I met the same problem with advertising timeout which I faced with in SD 7.1.0, but the solution which worked for the older SD: devzone.nordicsemi.com/.../ doesn't work for SD 8.0.0 anymore.

The question is: how to turn off advertising timeout in SD 8.0.0?

My advertising_init function:

static void advertising_init(void)
{
    uint32_t      err_code;
    ble_advdata_t advdata;
    uint8_t       flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;//BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

	
    ble_uuid_t adv_uuids[] = {{LBS_UUID_SERVICE, BLE_UUID_TYPE_BLE}};

    // Build and set advertising data
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance      = true;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    advdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
    advdata.uuids_complete.p_uuids  = adv_uuids;

		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);
}
Parents
  • Thanks a lot Konrad, this worked.

    Code:

    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
        ble_conn_params_on_ble_evt(p_ble_evt);
        ble_nus_on_ble_evt(&m_nus, p_ble_evt);
        on_ble_evt(p_ble_evt);
    
    	if (p_ble_evt->header.evt_id == BLE_GAP_EVT_TIMEOUT)
    		ble_advertising_start(BLE_ADV_MODE_FAST);
    	else
    		ble_advertising_on_ble_evt(p_ble_evt);
        bsp_btn_ble_on_ble_evt(p_ble_evt);
    }
    
  • Hi. I added RTT_printf as the first statement in ble_evt_dispatch function because of tracing ble events. As result, when advertising timeout with APP_ADV_TIMEOUT_IN_SECONDS happened, the ble_evt_dispatch function was not called back. So, infinite advertising cannot be configured with the above code. Please let me know how to get advertising timeout event. Thanks.

Reply
  • Hi. I added RTT_printf as the first statement in ble_evt_dispatch function because of tracing ble events. As result, when advertising timeout with APP_ADV_TIMEOUT_IN_SECONDS happened, the ble_evt_dispatch function was not called back. So, infinite advertising cannot be configured with the above code. Please let me know how to get advertising timeout event. Thanks.

Children
No Data
Related