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

Disconnected: 0 BLEHci.remote_user_terminated_connection [using pc_ble_driver_py]

Hello,

I am using the nordic nRF52840-DK and trying to connect to a nRF52840-Dongle and sending/receiving data to custom services and characteristics using pc_ble_driver_py. I modified the heart rate collector.

But the problem is that when I am connected to the Dongle the connection last 25 to 30 secondes and I receive a message : "Disconnected: 0 BLEHci.remote_user_terminated_connection" and the error message is : "line 477, in write_req attr_handle = self.db_conns[conn_handle].get_char_value_handle(uuid) KeyError: 0". However, when I use the nRF connect mobile/PC version I don't have this problem so I think it is a problem with my code. I check it out if there is some time out equal to like 25_30 secondes but I didn't find any solution.

Could someone help me please to find some solution.

Thanks in advance.

Cordially

Joe

  • We check with the enginneer who developped the firmware in debug mode, it appears the dongle get a BLE_GAP_EVT_DISCONNECTED when I get the error
    Disconnected: 0 BLEHci.conn_interval_unacceptable from python.
    Then we added a break point in this function
    static void on_conn_params_evt(ble_conn_params_evt_t * p_evt)
    {
    uint32_t err_code;
    if (p_evt->evt_type == BLE_CONN_PARAMS_EVT_FAILED)
    {
    err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE);
    APP_ERROR_CHECK(err_code);
    }
    }
    and as you previously mentionned
    sd_ble_gap_disconnect(conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE); is called.
    We check cp_init.disconnect_on_fail, it is already set "false"

    in fact we have this setting for cp_init:
    cp_init.p_conn_params = NULL;
    cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY;
    cp_init.next_conn_params_update_delay = NEXT_CONN_PARAMS_UPDATE_DELAY;
    cp_init.max_conn_params_update_count = MAX_CONN_PARAMS_UPDATE_COUNT;
    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;
    with
    #define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000)
    #define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(30000)
    #define MAX_CONN_PARAMS_UPDATE_COUNT 3
    #define BLE_GATT_HANDLE_INVALID 0x0000
  • we tried to add in the connect() function --> self.adapter.connect(peer_addr, conn_params=conn_params, tag=1) with conn_params = BLEGapConnParams(min_conn_interval_ms=125, max_conn_interval_ms=250, conn_sup_timeout_ms=4000, slave_latency=0)

    as it was in the dongle. But we still have the same error.

    Thanks

  • I need the sniffer log to help you further.

    Kenneth

  • Hello,

    I captured packets by sniffing blinky example on the dongle using wireshark. I send ON from master --> slave and then receiving the led state from slave --> master and when i receive Disconnected: 0 BLEHci.conn_interval_unacceptable using python, I receive in wireshark Control Opcode: LL_TERMINATE_IND (0x02) from slave --> master. I will put some screen captures in the first one you can see that it is normal I can send and receive and in the second one you will see that after some times I will receive the Control Opcode: LL_TERMINATE_IND.

    this is the first one

    first one

    this is the second one

    second one

    And the third one is when I double click on the error sniff.

    Thanks

  • Great, can you share the sniffer file (.pcapng) here?

    Kenneth

Related