-
Notifications
You must be signed in to change notification settings - Fork 864
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
RPI3 Disconnects #465
Comments
What's the value of the From the HCI dump the connection is failing:
Also, can you run with |
I'm experiencing an issue on a Raspberry Pi 3 as well. When connecting to a peripheral about 50% of the time the device connects and then immediately disconnect. The other 50% the connection success with no problems. I'm running the exact same code on my Mac (OS X 10.11.4) and the connections succeed 100% When the connection fails:
When the connection succeeds:
|
Sorry for not answering with the full log.. i digged a lot into this issue and my findings points towards node-bluetooth-hci-socket issues... When using gattool everything works as expected 100% of the time. I played around the Hci.prototype.setSocketFilter that is executed, and this made things work a little bit in terms of connection, whenever i removed some of the masks used. Another finding that i made, about behaviour, is that on MacOS if i lose connection of the bluetooth peripheral (because of range) and then the peripheral get in range again, i can listen to this and reconnect again. On the other hand, in raspberry, if i lose connection i will never receive callback for that peripheral again. The only option is to stop and start scanning again. Its seems that this project, although all the credits and kudos for the work done, have really underterministic behaviours depending on the system it executes. I moved away to python bindings for now.. |
@ddxtreme which bindings did you use? Are they working? And are you still using the Noble library and using custom bindings? |
@cscholze i stop using noble, i went using bluepy for python. As i didnt depend on nodejs and after several hours trying to understand the problem i switched as soon as my findings points towards node-bluetooth-hci-socket malfunction with RP3. As there isnt any other library for node for bluetooth, i switched. Now i already overcome that issue with bluepy |
Can you please try out noble/node-bluetooth-hci-socket#39 and provide your feedback?
Then try your noble app ... |
I've run into probably the same issue. Here is what iot-sensor-tag/publish/sensor-tag.js outputs with the patches branch:
Sorry, I have very little Linux / Node / Raspberry knowledge - just wanted to push a bunch of humidity data in the cloud for analysis... P.S.: it looks like hcidump is missing from my bluez installation? |
@sandeepmistry Thanks, I'll try this out later this week. In the mean time, I noticed that all of the issues went away when switching to ethernet, instead of wifi and turning off wifi with:
|
Hi, I am experiencing the same problems referenced in this issue (and #453, #474, #480) as well. This causes the next hci call to produce the following hci error requiring a
After a lot of debugging i've not come much closer to finding a fix. I tried to only call noble function sequentially and add a delay of 100ms between all calls that go to noble. This did not fix the issue but did cause less I've got a hcidump but it is an .cap file so you will need to open it in wireshark. The problem occurs at 183 sec of the dump. The calls that were done at that time were:
I tested my code on linux kernel 4.1 and 4.7 and this did not resolve the issue. I am using a BCM4330 based sdio module and used the wifi and bluetooth firmware that shipped with the hummingboard. I suspect this problem is firmware related since the raspberry pi 3 uses a similar module (BCM43430). Regards, Edit: I tried disabling wlan0 but this did not fix the issue for me. |
@TheCbac you said that using a wired connection got rid of the disconnect issue. Is that still the case? I tried it and it worked for a little bit, but then started disconnected again. |
@cscholze Since I switched to a wired connection I haven't experienced the issue at all. This is on multiple Pi's and over 10's of hours. The wired connection uses a static IP and wlan0 down. |
yes i am experiencing the same problem. I am using the Intel Edison. about 50% of the time, when i connect, it immediately disconnects. And after i try about 2-5 times, it eventually connects. However this is causing some lag because of the retries.
|
I had an 100% reproducible immediate disconnect with the Jessie - supplied bluez 5.23 and Ti Sensortag |
For what it is worth I've got the debug log of when this issue occures:
|
@sandeepmistry We are using RPI3 for central and iOS devices for the peripherals. I still have not tested thoroughly with gatttool and will update you as soon as I do. Should be in the next day or two. |
Hi, small update. Things I did to try to improve stability: Stop scanning before calling Added timeout logic to all noble calls, also moved the registering of the callback listener to my code because then I can remove the listener when a timeout occurs (before this would result in Removing device from noble cache when Added logic to retry a call after it timed out (this does rarely fix the problem after the other fixes so I will probably remove this) Use the kernel workarounds branch of node-bluetooth-hci-socket (https://github.com/sandeepmistry/node-bluetooth-hci-socket/tree/rework-kernel-workarounds). Although I do not have much test data to support it I do think this increased the stability for me. Maybe I can provide you with more definite data for this soon. The problems I worked around are: After connecting to a device sometimes a disconnect would immediately be called. I am currently testing the stability and fixing some bugs in my own code. My test setup consists of 2 Mipow Milight devices (one bulb and one candle) which I turn on and off in different intervals disconnecting and reconnecting between each write that has an interval higher than 3000 ms. After 10 minutes the program will disconnect and pause for 5 minutes and after that continue the loop. The longest stable test I've done till now (due to a bug in my code) was 8.5 hours and I am pretty confident that the noble part is stable. I do not use subscribe/unsubscribe since I think this will break when I do a hci reset so this is something I will need to test. |
Hi Great update. I created #487 as I am receiving disconnect supervisory timeouts. Could you explain to me how you were able to increase the timeout value. I having been trying to debug this over weekend without any joy as I am not getting or I don't think I am getting errors but the devices seem to be gracefully disconnecting due to the supervisory timeout value. This is strange as I getting this on two different devices at random intervals. Would like to try and increase the supervisory timeout and test to see if this gives me more stable results. |
hmm so is there any resolution for this? |
@benjaminhon could you please try #514? |
Hello Sandeep, |
Not sure if this already known here, but RPi3 BL & Wifi are on the same chip. Using BL when connected to Wifi will interfere with Wifi, causing disconnects and eventually hangups. To solve this disable Wifi and go with a wired solution, or get an external BL adapter. |
Hi, I'm also dealing with many of the issues @BasKiers explained. I'm using a wifi dongle so that the RPi 3's wifi/bluetooth chip doesn't experience interference between the two services as per @cryptocake's most recent comment. I have a crude workaround for this using @BasKiers solution to set a timeout that checks for an immediate disconnect. If this has happened, I manually force the peripheral to disconnect again. Can anyone explain what exactly is happening under the hood? The problem seems to occur more often when I advertise 10+ BLE signals from device B while device A holds a connection with the RPi3. I have also noticed this immediate 'disconnect' is not a disconnect at all (this is why I force a |
I wish I read this thread weeks ago... not only random disconnects (both on Rpi3 and Rpi4) but there is data loss on notifications (on Rpi3, did not experience it on Rpi4) as well when I try to receive bulk data from a device. |
I am having the same issue on Ubuntu 18.04 |
I tested a simple simple to connect to a BLE device, but i almost all the times receive a disconnect before connecting... Cant figure out why.
The same script on MacOS works as expected.
Here the output of hcidump:
The text was updated successfully, but these errors were encountered: