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

The conneted slave disconnects after some seconds after connection with the reason 8 "connection timout"

Hi averyone, We are developing the BLE project whith two devices master/slave.

The master device is built on the NRF52832 processor with SDK14.1 and it's program is built is the modified example "ble_app_hrs_rscs_relay" that has the two roles "Central" and "Peripheral". The slave device - on NRF51822 processor with SDK12.3 and it's program is the modified example "ble_app_hrs" that has the "Slave" role.

When the master device finds the slave device and connects to it by the command "sd_ble_gap_connect()" and discovers the required services it disconnects after some seconds. The reson of disconnection is 8 ( BLE_HCI_CONNECTION_TIMEOUT /**< Connection Timeout. */ ).

In the master unit the connection parameters are initilized by the comands:

memset(&gap_conn_params, 0, sizeof(gap_conn_params));
gap_conn_params.min_conn_interval = MIN_CONNECTION_INTERVAL;
gap_conn_params.max_conn_interval = MAX_CONNECTION_INTERVAL;
gap_conn_params.slave_latency     = SLAVE_LATENCY;
gap_conn_params.conn_sup_timeout  = SUPERVISION_TIMEOUT;
err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
APP_ERROR_CHECK(err_code);

where the definitions are:

#define MIN_CONNECTION_INTERVAL          (uint16_t) MSEC_TO_UNITS(7.5, UNIT_1_25_MS) /**< Determines minimum connection interval in milliseconds. */
#define MAX_CONNECTION_INTERVAL         (uint16_t) MSEC_TO_UNITS(30, UNIT_1_25_MS)  /**< Determines maximum connection interval in milliseconds. */
#define SLAVE_LATENCY                             0                                                                        /**< Determines slave latency in terms of connection events. */
#define SUPERVISION_TIMEOUT                  (uint16_t) MSEC_TO_UNITS(4000, UNIT_10_MS)  /**< Determines supervision time-out in units of 10 milliseconds. */

And in the slave unit the connecton parameters are defined by the commands:

  memset(&gap_conn_params, 0, sizeof(gap_conn_params));
  gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
  gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
  gap_conn_params.slave_latency     = SLAVE_LATENCY;
  gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;
  err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
  APP_ERROR_CHECK(err_code);

where the definitions are:

#define MIN_CONN_INTERVAL                MSEC_TO_UNITS(400, UNIT_1_25_MS)                /**< Minimum acceptable connection interval (0.4 seconds). */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(650, UNIT_1_25_MS)                /**< Maximum acceptable connection interval (0.65 second). */
#define SLAVE_LATENCY                        0                                                                       /**< Slave latency. */
#define CONN_SUP_TIMEOUT                 MSEC_TO_UNITS(4000, UNIT_10_MS)                 /**< Connection supervisory timeout (4 seconds). */

In the master unit we tried to set the change the parameters as in the salve, but it didn't helped us.

What is possible to do to prevent the unnessessary timeout terminations?

Related