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

How to reconnect faster after a disconnection

Hello there,

I am working on a project in which two devices(one is central and other is peripheral ) uses Nordic bluetooth controller  for connection and data exchange. nrf51822 for peripheral and nrf51422 for the central. We are using SDK 12.3 and S130.
As in our product, there are high chances of peripheral going out of range and reconnecting back quite frequently. Now the reconnection takes alonger time.
I wanted to understand how the reconnection can be made faster.
Currently in our code, at the time disconnection
    case BLE_GAP_EVT_DISCONNECTED:  
   err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gattc_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
  sd_ble_gap_scan_stop();
  scan_start();    
  sd_ble_gap_adv_stop ();
  sd_softdevice_disable()
  nrf_drv_clock_on_sd_disable()
  nrf_drv_rng_on_sd_disable();
  NVIC_DisableIRQ(TIMER2_IRQn);
  NRF_TIMER2->TASKS_STOP = 1; 
  NRF_TIMER2->POWER = 0; 
  nrf_power_pofcon_set(true, NRF_POWER_POFTHR_V27);

case BLE_GAP_EVT_CONNECTED:
 conn_handle=p_ble_evt->evt.gattc_evt.conn_handle;
 err_code = ble_db_discovery_start(&m_ble_db_discovery, p_ble_evt->evt.gap_evt.conn_handle);
Please suggest if this is the correct way of implementing connection and disconnection, so that we have a faster reconnection.
Thanks,
Thomas
Parents
  • Now the reconnection takes alonger time.

    Please clarify: do you just mean that it is a "long" time, or has something changed so that it is now "longer" than it once was?

    How long is it actually taking?

    How long do you need it to take?

    The peripheral's Advertising Interval will affect how quickly the Central can find it - and, thus, how quickly it can connect.

    If either the Central or the Peripheral spends time not scanning or advsrtising (eg, sleeping) that will obviously impact connection time.

    How to properly post source code:

Reply
  • Now the reconnection takes alonger time.

    Please clarify: do you just mean that it is a "long" time, or has something changed so that it is now "longer" than it once was?

    How long is it actually taking?

    How long do you need it to take?

    The peripheral's Advertising Interval will affect how quickly the Central can find it - and, thus, how quickly it can connect.

    If either the Central or the Peripheral spends time not scanning or advsrtising (eg, sleeping) that will obviously impact connection time.

    How to properly post source code:

Children
Related