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

Start the timer and disconnect bluetooth connection conflict

Hi,

I have a question.

  • SDK:8.1.0

  • softdevice:8.0.0

I create two APP_TIMER, as follow:

image description image description image description

I will start the adc_sample_timer, as follow: image description image description

After the device advtising, I use my phone connect with this device, at the same time, I start the disconnect_timer,as follow: image description image description image description

When the disconnect timer is timeout, it will go to function disconnect_level_meas_timeout_handler()

  • (1)the device will restart when it use err_code = sd_ble_gap_disconnect(m_conn_handle,BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); err_code = 0x00000000; NRF_POWER->RESETREAS = 0x00000000 or Reset from AIRCR.SYSRESETREQ detected;

  • (2) the device will not restart when it use not err_code = sd_ble_gap_disconnect(m_conn_handle,BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);

  • (3)the device will not restart when it use err_code = sd_ble_gap_disconnect(m_conn_handle,BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION) and not use adc_timers_start() at main();

who can tell me why? Thanks.

Parents
  • @zcmm: I tried to reproduce the issue here but I haven't managed to. Attach is an example where I trigger a 1 second timer after I connect. The device got disconected and start advertising again.

    Have you make sure you don't set the interrupt priority of RTC1 and SWI0 to something higher than APP_IRQ_PRIORITY_LOW ? Also please check if you have an assert when in Disconnect event. You can add a breakpoint in the app assert handler to find the error code, line number & file name of the code that cause the issue, if any.

    ble_app_template - disconnectWithaTimer.zip

  • thanks. i'm sure i can't set the interrupt priority.i find the reasons that sd_ble_gap_conn_param_updata fuc is conflict with sd_ble_gap_disconnect. After use sd_ble_gap_disconnect fuc, the link is still connected,then sd_ble_gap_conn_param_updata fuc is used and the response code is 0x00000008. at the same time,i have other questions.the APP_timer is not accuracy. In the case of the same time both #define DISCONNECT_LEVEL_MEAS_INTERVAL APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER) and #define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER) , first of all, first open app_timer_start(m_conn_params_timer_id, timeout_ticks, NULL)(timer1) at conn_params_negotiation fuc, and then open the disconnect timer (timer 2), but the timer 2 faster than the timer 1. why ?

Reply
  • thanks. i'm sure i can't set the interrupt priority.i find the reasons that sd_ble_gap_conn_param_updata fuc is conflict with sd_ble_gap_disconnect. After use sd_ble_gap_disconnect fuc, the link is still connected,then sd_ble_gap_conn_param_updata fuc is used and the response code is 0x00000008. at the same time,i have other questions.the APP_timer is not accuracy. In the case of the same time both #define DISCONNECT_LEVEL_MEAS_INTERVAL APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER) and #define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER) , first of all, first open app_timer_start(m_conn_params_timer_id, timeout_ticks, NULL)(timer1) at conn_params_negotiation fuc, and then open the disconnect timer (timer 2), but the timer 2 faster than the timer 1. why ?

Children
No Data
Related