danergo
Posts: 11
Joined: Thu Oct 12, 2017 1:44 pm

RPi4 Bluetooth: connection timeouts 9 times of 10 to a specific peripherial

Tue Jun 23, 2020 2:55 pm

Hi,

I'm using RPi4 for communicating with a BLE peripherial devices via gatttool:

Code: Select all

# gatttool -b OTHERWORKINGDEVICE --characteristics
handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
...
I have at least 3 peripherial devices which I can query with gatttool.

But there is one device which timeouts 9 times of 10 during conneciton:

Code: Select all

# gatttool -b NOTWORKINGDEVICE --characteristics
connect error: Connection timed out (110)
Now I could consider the "notworkingdevice" faulty. But "unfortunately" it is working from other devices (phones, with nRF Connect application) without any issues.

So I have hooked up a Bluetooth Link Layer Sniffer and took some measurements during the Pi tries to connect:

Image

Some legend:
  • Orange-filled box is the "faulty" device (BLE Peripherial)
  • Red-filled box is the Pi (BLE Central)
  • Red rectangles: marks channel change
I believe those *Client Rx MTU" requests are coming from the Peripherial (based on their Signal dBm).

However I tried running btmon on the Pi during the connection and it is simply not showing these MTU Requests. It seems Pi sends out a "LE Read Remote Used Features" and timeouts while waiting for the answer (I also tried increasing the timeout, but it did not help):

Code: Select all

< HCI Command: LE Read Remote Used... (0x08|0x0016) plen 2  #11 [hci0] 7.477210
        Handle: 64
> HCI Event: Command Status (0x0f) plen 4                   #12 [hci0] 7.479342
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: Command Complete (0x0e) plen 14                #13 [hci0] 7.479357
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
        00 00 00 00 00 00 00 00 00 00                    ..........      
> HCI Event: LE Meta Event (0x3e) plen 12                   #14 [hci0] 7.993969
      LE Read Remote Used Features (0x04)
        Status: Connection Timeout (0x08)
        Handle: 64
        Features: 0x2d 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Data Packet Length Extension
My Pi's details:
RPi4 Model B 1.1 (1GB RAM), Q2 2019 (Mfg by Sony)
PRETTY_NAME=“Raspbian GNU/Linux 10 (buster)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“10”
VERSION=“10 (buster)”

I also tried to put the peripherial very close (<1.5m) to the Pi and nothing has changed.

Given the above facts, what are my options to further investigate what causes the problem?

Thank you.

sbence003
Posts: 1
Joined: Mon Oct 12, 2020 3:25 pm

Re: RPi4 Bluetooth: connection timeouts 9 times of 10 to a specific peripherial

Mon Oct 12, 2020 3:29 pm

Hello!

I encountered the very same issue with my setup.

Did you manage to solve this problem?

Best regards

danergo
Posts: 11
Joined: Thu Oct 12, 2017 1:44 pm

Re: RPi4 Bluetooth: connection timeouts 9 times of 10 to a specific peripherial

Tue Oct 13, 2020 3:08 pm

Sorry, no.

RPi4's BT is very unstable, and noone could help.

renice123
Posts: 291
Joined: Tue Oct 15, 2019 3:56 pm

Re: RPi4 Bluetooth: connection timeouts 9 times of 10 to a specific peripherial

Fri Oct 16, 2020 9:23 am

The second version of Bluetouch is extremely stable - I made a remote control for the remote device for about a month and never once did the blue tooth let me down
However, the BLE version (aka LE) does not work well - the reasons are known there. These are not very experienced BlueZ programmers and the lack of full BLE protocols, as well as not very high quality modules with BLE support
Also, many of the previous BlueZ programs were ugly "fixed" and now do not work (the most unpleasant story is when BlueZ programmers switched to pulseaudio and now some devices do not work without this badly written program)
Some experiments with BLE also allow me to conclude that the combined wi-fi + BT module is designed in such a way that when BLE + wi-fi works together, the computer simply stops working or "freezes".
I did not begin to understand these problems, but I think that this information will seem useful to someone. So if your computer refuses to work with BT5 (LE), most likely
there is nothing wrong with that. If you want stable performance, you will have to shave your bluetooth devices very carefully

Return to “Troubleshooting”