Bluetooth connection times out

Viewed 3844

I have a Linux device, with a standard bluetooth adapter over HCI. After installing BlueZ, I can connect to BLE devices with gatttool:

# gatttool -b OTHERWORKINGDEVICE --characteristics
handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
...

However there is one device which times out 90 times of 100:

# 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 Linux tries to connect:

enter image description here

Some legend:

  • Orange-filled box is the "faulty" device (BLE Peripherial)
  • Red-filled box is the Linux (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 Linux during the connection and it is simply not showing these MTU Requests. It seems Linux send 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):

< 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

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

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

1 Answers

What Bluetooth chips do your two devices use? The one in your computer seems buggy, since it responds with a Command Complete for the LE Read Remote Used Features command, which is not valid.

Anyway, it seems the Bluetooth chip in your computer does not correctly receive the signals from the remote device, since it requests re-send of the packets all the time. After some time, it times out due to it didn't get the packet successfully. In few situations this can also happen also if the USB or UART link from the Bluetooth chip to the computer has stalled.

It's not uncommon that a specific combination of Bluetooth transmitters and receivers work worse than another combination. Usually the root cause is for example that the crystals are trimmed outside the allowed range, causing the radio frequency to be slightly off the limits. Some receiving devices have better tolerance than the spec requires, maybe your phone is such a one.

Related