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

Device connects then disconnects immediately

This behavior only occurs when connecting to the phone using the native connection procedure, it does not disconnect when using the nRF Connect app on the phone (Android Pixel 3a). Wireshark and the packet sniffer didn't shed much light, I've played with the connection interval settings, slave latency, update count etc. when I play with the max connection interval and the MTU settings I get a hardware fault.

Parents Reply
  • the code never reaches that case in the ble_evt_handler

    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        ret_code_t err_code;
    
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                NRF_LOG_INFO("Connected");
                err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
                APP_ERROR_CHECK(err_code);
                m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
                err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
                APP_ERROR_CHECK(err_code);
                break;
    
            case BLE_GAP_EVT_DISCONNECTED:
                NRF_LOG_INFO("Disconnected");
                
                // Dequeue all keys without transmission.
                (void) buffer_dequeue(false);
    
                m_conn_handle = BLE_CONN_HANDLE_INVALID;
    

Children
Related