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

BLE event after stop advertising nRF52840 s140 SDK16

Hi everyone.

I am working on the ble_app_bps_pca10056_s140 example. I want to confirm that a BLE event is received when the APP_ADV_DURATION has been expired. 

After searching I found that the BLE event that is associated with non-advertising is the BLE_ADV_EVT_IDLE meaning "no connectable advertising is ongoing"

So after setting the APP_ADV_DURATION 3000 (just for debugging), I placed two NRF_LOG_INFO after the BLE_ADV_EVT_IDLE  event, just like this:

static void on_adv_evt(ble_adv_evt_t ble_adv_evt) {
  ret_code_t err_code;

  switch (ble_adv_evt) {
  case BLE_ADV_EVT_FAST:
    NRF_LOG_INFO("Fast advertising");
    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
    APP_ERROR_CHECK(err_code);
    break;

  case BLE_ADV_EVT_IDLE:
    NRF_LOG_INFO("Advertising event received %d", BLE_ADV_EVT_IDLE);
    NRF_LOG_INFO("Stop advertising and go to sleep."); // na
    //sleep_mode_enter();
    advertising_start(false);

    break;

  default:
    break;
  }
}

My problem is that, while debugging and after the APP_ADV_DURATION is being expired (stop advertising) the NRF_LOG_INFO does not print.

The strange thing is that if I comment the sleep_mode_enter() and I replace it with advertising_start() then the debugging info is printed at it is expected...

So, what is the problem? How could I confirm that a BLE_ADV_EVT_IDLE event is received after APP_ADV_DURATION is been expired?

Thanks in advance

Nick

Related