-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Windows BLE reconnection not working after update to v4.4.6 (IDFGH-11531) #12656
Comments
Also attaching our sdkconfigs: |
Based on your description, one potential reason could be that one end has the LTK while the other does not. To verify this, you need to print the bond list on the ESP side. Check if Windows is present in the bond list using the following code:
Additionally, try clearing the LTK on both ends. The removal process is as follows:
Verify if the system works correctly after clearing the bond. |
1--Do you have a packet capture tool available? If so, could you please capture the data packets for analysis? 2--To facilitate analysis, kindly utilize the provided patch to display HCI data. If feasible, provide me with comprehensive logs for both normal and problematic scenarios. 0001-fix-bt-Display-hci-data-including-up-and-down (3).patch 3--Could you employ the bisect command to pinpoint the specific commit causing the issue? Here are the steps: Initiate the bisect process:
Mark the current version as bad:
Mark a known good version, for example:
... I will attempt to replicate your issue on my end and eagerly await further feedback from you. |
Thanks @zhp0406 we will start look into this. We have a BLE sniffer that we hopefully can use to capture some more details. |
@zhp0406 , Log file 1: This shows expected behavior when paring/bonding with v4.4.5. We are also using a Wifi/BLE coexist patch that we have got from Espressif: https://glab.espressif.cn/technical_support/husqvarnagroup/esp-idf-patch/commit/3144578169766e79180d99a689eb769d6f28c768. |
In log file 4, there is an error on frame 109. |
Same problem without the Wifi/BLE coexist patch, so that is not the problem. |
@zhp0406 , I have now done the bisect exercise as you recommended and got the following result:
I did however need to patch gatt_attr.c when testing this version as GATTS_ROBUST_CACHING_ENABLED was not defined. I assumed it to be always "ENABLED" when compiling. Do you still require HCI data logs (number 2) or is our BLE sniffer logs together with the bisect result enough to pin-point the problem? |
@zhp0406 : I have now tested with |
ok,I need more time to investigate the reasons.If you have any new discoveries, please let me know. |
@zhp0406, hard to say how much you would need to do to be able to reproduce. Definitely use our sdkconfig. We support two incoming connections and one outgoing (meaning that we restart advertising after connection) at the same time as we do Wifi communication. We have one attribute that we use for simulating a comport on which we do all communication once the connection is set up. We set MTU and connection parameters. We use an external crystal as BT clock source. Let me know if there are any more tests that we can do in our end. |
1-I am currently trying to reproduce your issue using alternative methods. For example, I used the example (esp-idf/examples/bluetooth/bluedroid/ble/gatt_security_server) and connected with Windows. I observed that Windows actively initiated the disconnection (currently unclear why Windows is disconnecting). However, the connection from an Android device to the same example is normal. |
Hi @zhp0406 , The patch seems to work :-). I am not able to reproduce the error after applying it, at least not as easy as before. Is the patch in a deployable state or do you want to do additional work on it before it is "production ready"? |
In your patch, two main actions were taken. Firstly, there was a fix for the issue where gatts did not respond correctly when reading the service change characteristic descriptor. We have already addressed this problem in the latest master version, and the corresponding commit is c73d7c0. Secondly, the reboost feature was disabled, as it is relatively new and may lead to compatibility issues. However, I'm unsure which specific problem caused this. I can provide you with separate patches for each fix, allowing you to test and identify the root cause. For the final version you'll be using, I recommend applying both patches simultaneously. Additionally, I will synchronize the code to the release branch and the master branch in the form of configuration options. |
Hi @zhp0406 , |
@ztefanjo |
According to the user the issue is now fixed, if there will be any other problems feel free to reopen or create a new issue. Cheers. |
Answers checklist.
IDF version.
v4.4.6
Espressif SoC revision.
ESP32-S3
Operating System used.
Windows
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
CMD
Development Kit.
Custom Board
Power Supply used.
Battery
What is the expected behavior?
Using the ESP as BLE peripheral and windows as BLE central:
This was working with v4.4.5.
In some cases, Windows anyway kept the connection open (as windows very much like to keep connections open), but it was still possible to reconnect with our Windows tool.
What is the actual behavior?
Some different strange behaviors, see steps to reproduce for more details:
or
Steps to reproduce.
This state is also happening in v4.4.6 but I don't know yet how to reproduce.
Debug Logs.
More Information.
Three example logs in "more Information" that contain much proprietary logging and no ESP logs:
v4.4.6 - Windows not disconnecting.txt (corresponding to step 6 above)
to be compared with:
v4.4.5 - Windows disconnecting.txt
where it works
v4.4.6 - Windows connecting but immediately disconnecting.txt (corresponding to step 3 above)
The text was updated successfully, but these errors were encountered: