Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE advertising does not consistently start

Hi,

I have been running into a problem where I am getting inconsistently failure to start advertising.

Calling:

err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);

returns NRF_SUCCESS, but the advertising process does not start. I.e.

static void on_adv_evt(ble_adv_evt_t ble_adv_evt)

handler is not being called.

This is mostly non-deterministic behaviour, however, I was able to get this to happen consistently if I flash using NRFJPROG and then using --reset option or --pinreset option.

Any advice is appreciated.

Using SDK 15.0 SD S140 6.1.0

Parents
  • Figured out the problem.

    When flash is in use when turning on advertising, 

    p_advertising->advertising_start_pending

    is set true, and NRF_SUCCESS returned.

    But 

    ble_advertising_on_sys_evt(uint32_t evt_id, void * p_context)

    is needed to actually process this flag and turn on BLE advertising later. Problem was it wasnt added as a softdevice observer, so the flag was never processed.




Reply
  • Figured out the problem.

    When flash is in use when turning on advertising, 

    p_advertising->advertising_start_pending

    is set true, and NRF_SUCCESS returned.

    But 

    ble_advertising_on_sys_evt(uint32_t evt_id, void * p_context)

    is needed to actually process this flag and turn on BLE advertising later. Problem was it wasnt added as a softdevice observer, so the flag was never processed.




Children
No Data
Related