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

The advertising parameter ".duration" only works when the J-Link debugger is attached.

I'm trying to use the duration advertising parameter to have the advertising timeout. The timeout works as expected when I have the J-Link debugger attached, however when I run my device standalone, it never times-out and continues to advertise. Here are my initialization parameters:

    memset(&m_adv_params, 0, sizeof(m_adv_params));
    m_adv_params.scan_req_notification = 0;
    m_adv_params.p_peer_addr           = NULL; // Undirected advertisement.
    m_adv_params.filter_policy         = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval              = NON_CONNECTABLE_ADV_INTERVAL;
    m_adv_params.duration              = DURATION;
    m_adv_params.max_adv_evts          = 0;

The interval is set to 5 seconds and the duration is set to 30 seconds.

I've also tried using ".max_adv_evts" to limit the advertising and again it works as expected using the J-Link debugger, but it will not stop advertising for any value greater than 1 running on standalone. Oddly, when the value is set to 1, it will stop the advertising after one cycle on the standalone, but anything greater than 1 doesn't stop.

Parents Reply Children
Related