gatts_profile_event_handler returns ESP_GATT_CONGESTED and ESP_GATT_INTERNAL_ERROR

Prasad
Posts: 48
Joined: Sun Jul 23, 2017 5:26 pm

gatts_profile_event_handler returns ESP_GATT_CONGESTED and ESP_GATT_INTERNAL_ERROR

Postby Prasad » Wed Nov 20, 2019 1:17 pm

Hi All,

In my application it calls "esp_ble_gatts_send_indicate" in every 20 milliseconds and there are 3 similar parallel calls for 3 different characteristics. Now i believe this error throws because there are so many indicate calls within short time of period. This works around for 10 - 15 mins and then it stops indicating the characteristics. See below logs,

Code: Select all

uint8_t indicate_data[4];
inttolitend(value, indicate_data);
esp_ble_gatts_send_indicate(gatts_if_for_indicate, 0, myapp_handle_table[IDX_CHAR_VAL_C],
                                sizeof(indicate_data), indicate_data, false);

Code: Select all

Connected
SENDING VALUE 144838
I (1003513) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1003513) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1003520) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1003527) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144838
I (1003615) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1003615) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1003622) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1003629) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144838
I (1003717) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1003717) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1003724) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1003731) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144852
I (1003819) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1003819) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1003826) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1003833) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144852
I (1003921) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1003921) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1003928) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1003935) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144878
I (1004023) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1004023) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1004030) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1004037) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144865
I (1004125) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1004125) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1004132) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1004139) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144878
I (1004227) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1004227) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1004234) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1004241) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144852
I (1004329) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1004329) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1004336) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 46
I (1004343) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 48
Connected
SENDING VALUE 144878
I (1004431) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 42
I (1004431) MYAPP: ESP_GATTS_CONF_EVT, status = 0, attr_handle 44
I (1004438) MYAPP: ESP_GATTS_CONF_EVT, status = 143, attr_handle 46
I (1004445) MYAPP: ESP_GATTS_CONF_EVT, status = 129, attr_handle 48
Connected
SENDING VALUE 144865
Connected
SENDING VALUE 144865
Connected
SENDING VALUE 144852
See status changes from 0 (Which means ESP_GATT_OK = 0x0) to 143(0x8f) and 129(0x81). Which means 'ESP_GATT_CONGESTED = 0x8f' and 'ESP_GATT_INTERNAL_ERROR = 0x81' and then it stops working. What could be the possible solution for this problem?

Thanks for the support in advance guys!

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

Re: gatts_profile_event_handler returns ESP_GATT_CONGESTED and ESP_GATT_INTERNAL_ERROR

Postby chegewara » Wed Nov 20, 2019 6:08 pm

Just like you said, congest error means that peer device cant handle so many read/write/notify/indicate requests in short time.
You can try to change connect parameter after connection:
https://docs.espressif.com/projects/esp ... e_params_t
or decrease indications rate.

Prasad
Posts: 48
Joined: Sun Jul 23, 2017 5:26 pm

Re: gatts_profile_event_handler returns ESP_GATT_CONGESTED and ESP_GATT_INTERNAL_ERROR

Postby Prasad » Mon Nov 25, 2019 4:18 am

Thanks @chegewara, I sort of figured that out, but i'm trying to fix the problem from my mobile app level as currently i cannot update firmware of the existing units. As the first thing I stopped subscribing for all the characteristics from the android app and the result is still the same.

Who is online

Users browsing this forum: Bing [Bot], dzungpv, jimmy98035@gmail.com and 97 guests