BLE Connection failure : Connection is refused due to unacceptable BD_ADDR

747 views Asked by At

My setup is as follows:

  1. BLE Peripheral in Raspberry Pi 3
  2. nRF tool in Android Phone
  3. My App in the same Android Phone (uses react-native-ble-manager)

When I connect to the Raspberry Pi using nRF tool, it connects successfully. But, when I connect using my own Android App it fails.

In the Raspberry Pi, I ran sudo btmon command to examine the failure log which is shown below:

> HCI Event: Connect Request (0x04) plen 10                                                                                                  [hci0] 143.774717
        Address: 88:A3:03:E7:18:EA (OUI 88-A3-03)
        Class: 0x5a020c
          Major class: Phone (cellular, cordless, payphone, modem)
          Minor class: Smart phone
          Networking (LAN, Ad hoc)
          Capturing (Scanner, Microphone)
          Object Transfer (v-Inbox, v-Folder)
          Telephony (Cordless telephony, Modem, Headset)
        Link type: ACL (0x01)
< HCI Command: Reject Connection Request (0x01|0x000a) plen 7                                                                                [hci0] 143.774802
        Address: 88:A3:03:E7:18:EA (OUI 88-A3-03)
        Reason: Connection Rejected due to Unacceptable BD_ADDR (0x0f)
> HCI Event: Command Status (0x0f) plen 4                                                                                                    [hci0] 143.775814
      Reject Connection Request (0x01|0x000a) ncmd 1
        Status: Success (0x00)
> HCI Event: Connect Complete (0x03) plen 11                                                                                                 [hci0] 143.897643
        Status: Connection Rejected due to Unacceptable BD_ADDR (0x0f)
        Handle: 0
        Address: 88:A3:03:E7:18:EA (OUI 88-A3-03)
        Link type: ACL (0x01)
        Encryption: Disabled (0x00)

The error as shown in the log is due to BD_ADDR. When using nRF tool the bd_addr is

Peer address type: Random (0x01)
Peer address: 58:B2:55:17:1A:92 (Resolvable)

Something weird that I cannot understand: Once I bond to the Raspberry Pi using nRF tool and then try to connect to the Raspberry Pi from my app, it connects.

How can I solve this issue?

1

There are 1 answers

3
Emil On BEST ANSWER

Your event log shows that you're connecting using Bluetooth Classic. If you want to use BLE, use a connectGatt variant where you can select LE as transport parameter.