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

Parents Reply Children
  • I searched in debugging mode but I didn't found that the function was called. However, on the peer I receive the messages below :

    ERROR:pc_ble_driver_py.ble_driver:Exception: MTU exchange reply failed. Common causes are: missing att_mtu setting in ble_cfg_set, different config tags used in ble_cfg_set and adv_start.
    ERROR:pc_ble_driver_py.ble_driver:<FrameSummary file C:xxxx\lib\site-packages\pc_ble_driver_py\ble_driver.py, line 2701 in ble_event_handler_sync>
    ERROR:pc_ble_driver_py.ble_driver:<FrameSummary file C:xxxx\lib\site-packages\pc_ble_driver_py\ble_adapter.py, line 772 in on_gatts_evt_exchange_mtu_request>
    ERROR:pc_ble_driver_py.ble_driver:

    Thanks

    Joe

  • It should be possible to search through your project for sd_ble_gap_disconnect(), I don't expect it is used many places.

    Looking at your pc ble driver log it may seem realted to MTU settings, you can for test simply comment out on_connected_evt() that is called in nrf_ble_gatt_on_ble_evt() from nrf_ble_gatt.c. This is far fetched, but could be worth a try.

    Do you by any chance have an on-air sniffer log (e.g. nrf sniffer)?

    Kenneth

  • I will try to find a sniffer and comment the function on_connected_evt() . But could you please try to lunch my code in the attachements to see what will happens.

    Thanks

    Joe

  • Hello,

    I edited the function connect() and I added a tag = 1 = CFG_TAG (the macro in the line number 33), I don't have anymore the problem BLEHci.remote_user_terminated_connection neither the errors.

    However, after like 250~253 secondes the connection will stop and I receive the message below :

    ---> Disconnected: 0 BLEHci.conn_interval_unacceptable

    Does anyone have any solution?

    Thanks in advance.

    Joe

  • Again, it should be possible to find where you are calling sd_ble_gap_disconnect() in your project, you can search for it in your project. I would assume it called in ble_conn_params.c, where you can find sd_ble_gap_disconnect(conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE);.

    Typically setting cp_init.disconnect_on_fail             = false; when calling ble_conn_params_init() in main.c can remedy this.

    Kenneth

Related