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

GAP disconnect stops app timer

I'm running a BLE application on the nRF51822. And I have an application timer to keep track of the real time clock. However, when I receive a BLE_GAP_EVT_DISCONNECTED event, I notice the "m_conn_params_timer_id" timer gets stopped. But this timer ID is also the same as the RTC timer ID I have running (= 0), thus it is stopping my RTC app timer as well.

Is there a way around having to restart the RTC app timer whenever I receive the disconnect event? Or if I configure the RTC hardware registers directly will this get around this issue?

Thank you!

Parents
  • I found the real root of the problem. I was never initializing the connection parameters (ble_conn_params_init), and on disconnect my dispatch handler function was, however, calling ble_conn_params_on_ble_evt() which stops the one shot timer that ble_conn_params_init() should have created.

    Since the m_conn_params_timer_id is initialized to zero, app_timer_stop() stops the timer ID with ID = 0, which is ID of the real time clock.

Reply
  • I found the real root of the problem. I was never initializing the connection parameters (ble_conn_params_init), and on disconnect my dispatch handler function was, however, calling ble_conn_params_on_ble_evt() which stops the one shot timer that ble_conn_params_init() should have created.

    Since the m_conn_params_timer_id is initialized to zero, app_timer_stop() stops the timer ID with ID = 0, which is ID of the real time clock.

Children
No Data
Related