-
Notifications
You must be signed in to change notification settings - Fork 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
Bluetooth disconnects after about 12 hours #2252
Comments
Do you have the issue on the develop branch? We have fixed some timer issues on there. |
I am using main branch but I have changes in time_adapter.h from dev branch applied (I was one from those which reported problems with repeating timer plus If I remember right there was also another fix done there in dev). I really have spent a lot of time trying to get the root of the problem and timers was the first thing I was looking for. I've found nothing. So it seems like the problem lies inside the firmware of the CYW module? |
Are you using async poll or background thread safe? Do you have any logging enabled that might reveal the problem? Does a debugger show the code is stuck somewhere? Blaming the firmware with little evidence is unwise. |
I am using async poll, logging just shows that HCI_EVENT_DISCONNECTION_COMPLETE is received with reason 8, Debugger shows nothing unusual. I suppose that HCI_EVENT_DISCONNECTION_COMPLETE is emitted by the BT module itself, it is always after 12 hours of connection. I am not blaming the firmware it is most probably feature rather than a bug (a feature I am not aware of). I just wanted to tell that the disconnection is not invoked by our software nor the software of the client site.. |
I've had this example running on two Pico W's for 14 hours /~https://github.com/raspberrypi/pico-examples/tree/master/pico_w/bt/standalone. It sends the temp from one device to another, and I modified it to send the temp every 1s. So I can't reproduce this on develop. I'll retest with Pico 2 W in polling mode. |
Thank you. I have used following service and characteristics: Now I tried to set ones as per the temperature reading sample you mentioned: |
Are you running debug or release? i.e. What's you cmake command line? |
I am using Release MinSizeRel configuration (optimized for minimal image size) using copy_to_ram image, however I tried also without copy_to_ram (run from flash) with the same result. |
Some more info: Pico2w overclocked to 200Mhz, I am sending the data (about 90Bytes) 25 times per second.. |
These are quite important things that might have been relevant in your original report! |
I modified the example to run at 200MHz and send the temp every 40ms. It's still running 24 hours later. |
Thank you you are still paying attention to this problem. OK, I've made some experiments between while: However today I've found something. A small recapitulation first:
I found following:
I've restarted the pico server and modified the code to set that dataset length to 84 bytes. And waiting for the evening to see if that makes some difference :-) |
Some random unhelpful thoughts... I wonder if it's worth enabling the btstack traces. It will generate a lot of data over 12 hours but it might reveal something if you keep the last x MB of data. Maybe something to try next. |
Yes, I will try to keep on. I am still using patched master version, usage of dev could be the next iteration. I am also planing try to build a test case (a minimalist code but as close as mine in the term of bluetooth functionality). If not successful I will try to enable the tracing.. |
Some update: I've found that the problem happens when I am sending data of following lengths only: |
..the lengths above are payload lengths (so no packet lengths). |
Next update: My clocks initialization (not sure if related to problem):
|
I have a LE attribute server implemented on Pico2W plus ESP32 based GATT client. Everything runs correctly and reliably but for about 12 hours only. After 12 hours, I receive HCI_EVENT_DISCONNECTION_COMPLETE event on both sides (with reason set to 8 (CONNECTION_TIMEOUT)). After I restart the ESP32 client, I am getting the next connection but for few seconds only (client is able to read few attributes during that time) and then it disconnects again. Here if I restart the client again, I am getting the connection but again just for few seconds only..
To get things "fixed", I need to restart the Pico server site (restart from the debugger is enough) and everything works perfectly. But for next 12 hours only!
I've already spent quite lot of time debugging the code on both sites, but haven't found a root of the problem. "HCI_EVENT_DISCONNECTION_COMPLETE" hci event seems to be not sent by the software of any of both sites!
I know that this is not much info provided from my site, I apologize. However maybe somebody will immediately know the reason? Could the problem be on the CYW controller site? Here I've attempted to implement "on the fly" restart of the controller (after disconnection) however I was not able to maintain continuity yet (to initialize the controller correctly to be able to continue)..
The text was updated successfully, but these errors were encountered: