Central disconnect reason BLE_HCI_CONNECTION_TIMEOUT

Hello 

     We have a product where the central can connect almost every slave. It works fine, but when connecting client slave it connects fine and finds service fine but always disconnects after 4s with reason BLE_HCI_CONNECTION_TIMEOUT.

SDK:16.0


Base Project:ble_central_and_peripheral


Crystal Oscillator

NRF_CLOCK_LF_SRC_XTAL 

NRF_SDH_CLOCK_LF_RC_CTIV

NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 

NRF_CLOCK_LF_ACCURACY_20_PPM

Connect Pamans

conn_params.min_conn_interval  = MSEC_TO_UNITS(20, UNIT_1_25_MS);
conn_params.max_conn_intervalMSEC_TO_UNITS(40, UNIT_1_25_MS);
conn_params.slave_latency          = 0;
conn_params.conn_sup_timeout  = MSEC_TO_UNITS(4000, UNIT_10_MS);
static void conn_params_init(void)
{
    ble_conn_params_init_t cp_init;
    memset(&cp_init, 0, sizeof(cp_init));

    cp_init.p_conn_params                               = NULL;
    cp_init.first_conn_params_update_delay    = APP_TIMER_TICKS(100);
    cp_init.next_conn_params_update_delay   = APP_TIMER_TICKS(5000);
    cp_init.max_conn_params_update_count   = 3;
    cp_init.start_on_notify_cccd_handle            = BLE_GATT_HANDLE_INVALID;
    cp_init.disconnect_on_fail                            = false;
    cp_init.evt_handler                                       = on_conn_params_evt;
    cp_init.error_handler                                    = conn_params_error_handler;

    APP_ERROR_CHECK(ble_conn_params_init(&cp_init));
}
static void ble_evt_handler(ble_evt_t const *p_ble_evt, void *p_context)
{
                      ...
        case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
            APP_ERROR_CHECK(sd_ble_gap_conn_param_update(
                p_ble_evt->evt.gap_evt.conn_handle,
                &p_gap_evt->params.conn_param_update_request.conn_params));
            break;
                     ...
}
Personally I think external 32khz crystal oscillator may cause this problem,so I change to use the internal crystal oscillator, It works well.
#define LF_CLK_SRC_RC                                                         \
    {                                                                                               \
        .source = NRF_CLOCK_LF_SRC_RC,                               \
        .rc_ctiv = 16,                                                                        \
        .rc_temp_ctiv = 2,                                                                \
        .accuracy = NRF_CLOCK_LF_ACCURACY_500_PPM     \
    }
I'm confused about this, our 32khz crystal is ±20 ppm and it works fine in our other products.
Can you give me some advice,thanks.
  • Hi,

    When a peripheral device maintain a connection with a central device it uses the tolerance of the two peers to find the maximum drift that can occur due to the tolerance of both clocks of the two peers. If one of the tolerances are higher than specified, then the peripheral may not be able to maintain connection. If one of the two peers then set a higher tolerance value (for instance to compensate for the tolerance of the peer is out of specification), then this will workaround the issue. So even though you are using an crystal of 20ppm, it may be a good idea unfortunately to set it to 50 or 100ppm to compensate for a peer that might be out of specification.

    Kenneth

Related