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

Advertising doesn't start immediately after calling sd_ble_gap_adv_start

Hi everybody,

I'm having a problem with the advertising function of the SoftDevice.

When the application starts advertising the function "sd_ble_gap_adv_start()" returns without an error.

But it takes up to 10 seconds until I can see the advertising with the nRF Connect App.

How can I fix this?

I'm using

Laird BL654 (nRF 52840)

SDK16

SD140v7.0.1

Best regards Fabian

  • Hi,

    What advertisement interval are you using? Could you check with a sniffer when the first advertisement package is sent on air?

    Note that in case the advertiser and scanner interval uses similar intervals, it could take some time until the scanner captures the advertisement packet.

  • Hi,

    I'm using a 500ms advertising interval. 

    I don't have access to a BLE Sniffer (I could try using nRF Sniffer with a nRF52840 DK. But itwill take some time setting this up)

    We have been testing our BLE products with nrfConnect for Android and PC.

  • Hi,

    I've checked the advertising with a sniffer. After a disconnect the advertising starts immediatly.

    After a power up it takes up to 10 seconds until I can see advertising packets with the sniffer. (The application starts advertising  3s after power on).

    Can you recommend a good Bluetooth / BLE sniffer ?

  • We usually use the ble sniffer from ellisys if we do not use the nrfsniffer. There are other options, i.e. frontline, but this is not as intuitive as the ellisys sniffer, mainly because the gui is a bit dated.

    With 500ms adv interval it will take some time to establish the connection. After a disconnect the advertisement module would usually start fast advertising, then move to slow after some time. This could also be done on startup. i.e. configure the device to start fast advertising for a few secondes before changing to a slower more power conserving interval later.

  • Thanks for the answer.

    After the Disconnect I start the Advertsing with an interval of 500ms and a timeout of 30s.

    I'm using the same function to start advertising after a reset / power on.

    I don't use fast or slow advertising I've written my own advertising functions to init, start and stop advertising via the SoftDevice API.

    This code is part of my function to init and start advertising. It is called after disconnecgt and after reset.

    Advertising Data is the Devicename and Manufaturer Specific Data (Scan Response).

     // Those are the Parameters used for advertising
     
     // --- Set advertising Parameters ---------
     memset(&adv_params,0,sizeof(adv_params));
     
     adv_params.primary_phy     = BLE_GAP_PHY_1MBPS;
     adv_params.duration        = APP_ADV_TIMEOUT_IN_SECONDS;  // 30s
     adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
     adv_params.p_peer_addr     = NULL;
     adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
     adv_params.interval        = 5 * 160;             // ca 500ms
     
     // --- Update Advertising data & parameter --------
    err_code = 0;
    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle,&m_adv_data,&adv_params);    
    err_code++;
    
    // --- Start Advertiding
    err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
    NRF_LOG_INFO("Advertising started err_code: %d", err_code);
        
        

Related