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

Error 22 (0x16) GATT_CONN TERMINATE LOCAL HOST ISSUE

Platform NRF52832 SoftDevice S132 V6.1 SDK 15.0 FreeRTOS implemented

Hi,
In our application, once the mobile app is connected to the peripheral, it makes continuous writes to a characteristic every 1 second and then forwards the message to a different chip over UART. We expect this behavior to work for at least 2 hours.


Here are the connection parameters we are using
 MIN_CONN_INTERVAL MSEC_TO_UNITS(500, UNIT_1_25_MS)
MAX_CONN_INTERVAL MSEC_TO_UNITS(2000, UNIT_1_25_MS) 
SLAVE_LATENCY 0 
CONN_SUP_TIMEOUT MSEC_TO_UNITS(10000, UNIT_10_MS) 

However after some time (ranging from 3 minutes to 25 minutes at random), we see an error on nrf_connect app stating Error 22 (0x16) GATT_CONN_TERMINATE_LOCAL_HOST and the phone is disconnected. But on the dev board, we do not see any disconnect event and the board becomes unresponsive to any BLE command and remains stuck. The only way to recover is pressing the reset switch. This issue is quite problematic since the production version will not have any I/O for reset.

Could RTOS be causing any issue. I have increased the priority of the BLE task to 4 (Total of 4 tasks running)  from the default of 2 in nrf_sdh_freertos.c 

Parents
  • Hello, I experienced a similar issue, my bluetooth connection kept getting disconnected with error 22 after a somewhat random time intervals (mostly 30-90 seconds).

    First time this happened I tried forgetting the device in android settings, removing the bonding information.. That didnt help, then I played around with the connection parameters and thought that solved the issue.

    The problem reappeared some days later, even through I didnt change any of the settings. This time nothing seemed to help, until I erased bluetooth cache in the bluetooth system app in the App info settings (oneplus 6T,  Android 9, OxygenOS 9.0.17), which solved the issue completely and the connection is now stable again.

    I'm not sure whether the problem OP has is the same, but since I was looking for solution to this multiple times and didnt find anything, thought I'd share so ppl who have the same issue can try this.

Reply
  • Hello, I experienced a similar issue, my bluetooth connection kept getting disconnected with error 22 after a somewhat random time intervals (mostly 30-90 seconds).

    First time this happened I tried forgetting the device in android settings, removing the bonding information.. That didnt help, then I played around with the connection parameters and thought that solved the issue.

    The problem reappeared some days later, even through I didnt change any of the settings. This time nothing seemed to help, until I erased bluetooth cache in the bluetooth system app in the App info settings (oneplus 6T,  Android 9, OxygenOS 9.0.17), which solved the issue completely and the connection is now stable again.

    I'm not sure whether the problem OP has is the same, but since I was looking for solution to this multiple times and didnt find anything, thought I'd share so ppl who have the same issue can try this.

Children
No Data
Related