BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

tharunjoy
Posts: 22
Joined: Wed Dec 12, 2018 5:30 am

BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

Postby tharunjoy » Fri Sep 06, 2019 7:42 am

Hi,

I am trying to build an ESP32 as a BLE GATT client to receive a connection from BLE remote(ATB110x). While trying to connect to the device I am immediately disconnecting from the server.

Code: Select all

 
W (23898) BT_APPL: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0013
I (23908) GATT_CLIENT :::: EVT 41, gattc if 3
I (23908) GATT_CLIENT :::: ESP_GATTC_DISCONNECT_EVT, reason = 0x13
0x13 defines : Remote User Terminated Connection

I have connected this remote to android devices and It was connecting without any issue. What am I missing in esp client side? How should I address it?

tharunjoy
Posts: 22
Joined: Wed Dec 12, 2018 5:30 am

Re: BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

Postby tharunjoy » Mon Sep 09, 2019 12:40 am

Hi,
I am adding more logs to this.

Code: Select all

 Unhandled GAP event: 14
D (13167) BT_GATT: GATT   ATT protocol channel with BDA: 000XXXXXXX16 is disconnected
D (13167) BT_GATT: gatt_is_bda_in_the_srv_chg_clt_list :00-0b-20-07-05-16
D (13177) BT_GATT: gatt_cleanup_upon_disc 
D (13177) BT_GATT: found p_tcb 
D (13177) BT_GATT: gatt_set_ch_state: old=4 new=0
D (13187) BT_GATT: gatt_free_pending_ind
D (13187) BT_GATT: gatt_free_pending_enc_queue
D (13197) BT_GATT: gatt_free_pending_prepare_write_queue
D (13197) BT_GATT: found p_reg tcb_idx=0 gatt_if=1  conn_id=0x1
D (13207) BT_GATT: gatt_connect_cback: from 000XXXXXXXX16 connected:0 conn_id=1 reason = 0x0013
D (13217) BT_GATT: gatt_get_ch_state: ch_state=0
I (13217) BT_GATT: GATT_GetConnIdIfConnected status=0

D (13227) BT_GATT: found p_reg tcb_idx=0 gatt_if=2  conn_id=0x2
D (13237) BT_GATT: found p_reg tcb_idx=0 gatt_if=3  conn_id=0x3
W (13237) BT_APPL: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0013
D (13247) BT_GATT: found p_reg tcb_idx=0 gatt_if=4  conn_id=0x4
W (13257) BT_APPL: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0013
D (13257) BT_GATT: gatt_delete_dev_from_srv_chg_clt_list
D (13267) BT_GATT: gatt_is_bda_in_the_srv_chg_clt_list :00-0X-XX-XX-XX-16
D (13277) BT_GATT: ATT disconnected
I (13277) GATT_CLIENT :::: EVT 41, gattc if 3
I (13277) GATT_CLIENT :::: ESP_GATTC_DISCONNECT_EVT, reason = 0x13
I (13287) GATT_CLIENT :::: EVT 5, gattc if 3
Unhandled GATT Profile Event: 5
I (13297) GATT_CLIENT :::: EVT 41, gattc if 4
I (13297) GATT_CLIENT :::: ESP_GATTC_DISCONNECT_EVT, reason = 0x13
I (13307) GATT_CLIENT :::: EVT 5, gattc if 4
Unhandled GATT Profile Event: 5
I (24247) WEBSOCKET :::: Connection error
-- Connection error: 113
I (24247) WEBSOCKET :::: Disconnected

Why I am getting this error? Could anyone help me to resolve this?
Thanks in advance.

tharunjoy
Posts: 22
Joined: Wed Dec 12, 2018 5:30 am

Re: BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

Postby tharunjoy » Mon Sep 09, 2019 9:59 am

Hi,
I have to add one more analysis to this.

'ESP IDF is getting disconnected when the peripheral device stops advertising'.

How to stabilize the connection even after the advertisement stops?

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

Postby chegewara » Tue Sep 10, 2019 11:45 am

Based on your earlier description I thought it may be problem with connection parameters update, which device may not accept and disconnecting.

After reading your last update I am starting to think you are trying to connect esp32 and android device at the same time to peripheral that can use/handle only 1 connection.

tharunjoy
Posts: 22
Joined: Wed Dec 12, 2018 5:30 am

Re: BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

Postby tharunjoy » Mon Sep 16, 2019 6:22 am

Hi @chegewara ,
'ESP IDF is getting disconnected when the peripheral device stops advertising'.
I found this based on one of my analyses on ble server(remote) disconnection from ble client(esp32).

Before I was worried about my server configuration, so in-order to replicate another ble server I downloaded an android app https://play.google.com/store/apps/deta ... eral&hl=en. Using this app I was able to simulate a battery(ble server) and connect to ble client(esp32). I was able to connect and read the value from this app until I stop advertising the app(App Screen off will stop advertising). After I am getting the same error that I used to get when I tried to connect to the remote, where the remote use stop advertising when get connected.
Based on your earlier description I thought it may be problem with connection parameters update, which device may not accept and disconnecting.
I am attaching the code here. Please let me know if I am doing something wrong.
Attachments
ble_client.c
ble client code
(21.86 KiB) Downloaded 696 times

tharunjoy
Posts: 22
Joined: Wed Dec 12, 2018 5:30 am

Re: BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

Postby tharunjoy » Thu Nov 21, 2019 7:32 am

The issue was with the server device as per the reason=0x0013:: ESP_GATT_CONN_TERMINATE_PEER_USER
Reconfigured the BLE_GATT_Server device and the issue was resolved.

bhaskarr
Posts: 1
Joined: Tue Jan 05, 2021 6:57 pm

Re: BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

Postby bhaskarr » Tue Jan 05, 2021 7:05 pm

Hi Tharun,

I am facing the same issue, could you please elaborate how you reconfigured the server. Thanks in advance.

com.android.bluetooth D/bt_btm_pm: btm_pm_proc_mode_change switched from SNIFF to ACTIVE.
com.android.bluetooth E/rtk_parse: hci_interface->transmit_command Opcode:fc19
com.android.bluetooth W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0013
com.android.bluetooth W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0013
/com.android.bluetooth W/bt_btif: bta_gattc_conn_cback() - cif=5 connected=0 conn_id=5 reason=0x0013
com.android.bluetooth W/bt_btif: bta_dm_act no entry for connected service cbs
com.android.bluetooth D/BtGatt.GattService: onConnected() connId=6, address=9C:6B:72:59:42:E8, connected=false

adrian-fratila
Posts: 6
Joined: Sat May 15, 2021 2:40 pm

Re: BLE disconnection: cif=3 connected=0 conn_id=3 reason=0x0013

Postby adrian-fratila » Wed Jun 16, 2021 1:39 pm

Hi tharunjoy, I experience the same kind of problem as you describe above: disconnection of an ESP32 client from a ATB110x BLE remote after a couple of seconds.
How did you get the issue fixed?
Thank you!

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot], ok-home and 87 guests