-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GATTC_Discover GATT_BUSY" issue with esp_ble_gattc_register_for_notify() (IDFGH-3405) #5371
Comments
Just dont call it from gattc callback. When you call it from callback you are blocking bluedroid. |
Thanks for the speedy response. I am kind of new to this. What would be the recommended way to fix what I need to do? |
Also, the things I do in the callbacks are very similar to what the examples do. I am not sure I understand what I did is different. |
chegewara, can you provide further comments? Is it the call to esp_ble_gattc_read_char() that caused this error? |
i believe @Campou can help you more about that |
BTW, in some other instances, I am getting this:
|
Found a temporary fix. The crash happens during the ESP_GATTC_REG_FOR_NOTIFY_EVT event when it tries to call esp_ble_gattc_write_char_descr(). I suspect that because of the LESC encryption that , the bluedroid stack is somehow not ready to allow writing of char descr. The temp fix is simply adding a 2 second delay before calling esp_ble_gattc_write_char_descr(). Just added:
This is not really proper fix. But it seems stable after the change. I hope you guys can provide a better fix. |
@joehui For example, after calling esp_ble_gattc_register_for_notify(), You need to wait for ESP_GATTC_REG_FOR_NOTIFY_EVT to trigger before you can continue calling the next function esp_ble_gattc_write_char_descr (). You can refer to our examples gattc_client and gatts_server |
Environment
Development Kit: ESP32-Wrover-Kit
IDF version: v4.0
Build System: idf.py
Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2019r2) 8.2.0
Operating System: MacOS (This shouldn't matter as I have seen the same behavior even if build on a PC)
Power Supply: USB
Problem Description
Randomly gets "GATTC_Discover GATT_BUSY" abort message during esp_ble_gattc_register_for_notify().
Expected Behavior
Firmware runs smoothly without interruption.
Actual Behavior
Randomly gets "GATTC_Discover GATT_BUSY" abort message during esp_ble_gattc_register_for_notify().
Steps to reproduce
In our setup, the ESP32 is the client connect to an nRF52 device that is a BLE server.
During the ESP_GATTC_SEARCH_CMPL_EVT, our code calls:
We use LESC pairing, the esp_ble_gattc_read_char() with ESP_GATT_AUTH_REQ_SIGNED_MITM to force the LESC pairing to happen.
During the ESP_GATTC_REG_FOR_NOTIFY_EVT, we call these functions:
Code to reproduce this issue
See above.
Debug Logs
During development stage, we have a good number of LOG lines everywhere. Everything works fine. The problem is that when we disabled all the LOG lines, we are starting to get these errors like these:
Other items if possible
This leads us to believe that GATTC read or write calls are conflicting with GATTC_Discover process. Could our issue be related to this old issue:
#888
It seems that adding vTaskDelay(); calls with appropriate timing before esp_ble_gattc_register_for_notify() and esp_ble_gattc_read_char() would temporarily hide the issue. It doesn’t seem like a proper fix though.
I am wondering if you are aware of such behaviour and if there is a better way to address this.
The text was updated successfully, but these errors were encountered: