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

The right flow to change the advertising data during run-time

I'm working on the product using the nRF51422 QFAAE00 , SD110_nrf51_8.0.0, SDK 10.0.0. My product has the advertising flow as below

  • The device advertises forever with advdata updated during run-time by using ble_advertising_init()

  • If the device is connected, it switches to the non-connectable advertising mode

    static void on_ble_evt(ble_evt_t * p_ble_evt) {

      switch (p_ble_evt->header.evt_id)
      {
          case BLE_GAP_EVT_CONNECTED:
              m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
              advertising_concurrent_init(adv_flags);
              advertising_concurrent_start();
              break;
    
          case BLE_GAP_EVT_DISCONNECTED:
              m_conn_handle = BLE_CONN_HANDLE_INVALID;
              sd_ble_gap_adv_stop();
              m_is_adv_running = false;
              advertising_init(adv_flags);
              break;
    
          default:
              // No implementation needed.
              break;
      }
    

    }

I have problem with the advertising, sometimes the nRF51422 does not advertise anymore. Is my flow correct? How do I check the advertising working?

Related