Bluetooth peripheral failed to connect with status=702

Hello, I'm troubleshooting why my custom Bluetooth peripheral won't connect to my iPad. My Bluetooth peripheral is named "0471". I installed the Bluetooth profile and exported the system diagnostic logs from the iPad to troubleshoot the connection. Here are the relevant system logs from my iPad.

  1. 0471 connecting:
default	2024-08-05 13:28:53.664196 -0500	bluetoothd	Device connecting - {cbuuid: 0BB0FBE0-F708-23DD-B310-E487518668BE, devicename: Reader 0471, result: 0, adv-addr: 4C:5B:B3:85:CD:D6-Public, resolved-addr: }
  1. 0471 failure to connect:
default	2024-08-05 13:28:53.987319 -0500	bluetoothd	handleConnectionCompleteCallback address=Public 4C:5B:B3:85:CD:D6 handle=0x0 status=702 connectionIsActive=0, wakeupEvent=0
default	2024-08-05 13:28:59.673271 -0500	bluetoothd	handleConnectionCompleteCallback address=Public 4C:5B:B3:85:CD:D6 handle=0x0 status=702 connectionIsActive=0, wakeupEvent=0
default	2024-08-05 13:29:08.684653 -0500	bluetoothd	handleConnectionCompleteCallback address=Public 4C:5B:B3:85:CD:D6 handle=0x0 status=702 connectionIsActive=0, wakeupEvent=0
  1. Another connecetion attempt to 0471
default	2024-08-05 13:29:18.985399 -0500	bluetoothd	Device connecting - {cbuuid: 0BB0FBE0-F708-23DD-B310-E487518668BE, devicename: Reader 0471, result: 0, adv-addr: 4C:5B:B3:85:CD:D6-Public, resolved-addr: }
  1. 0471 failed to connect again
default	2024-08-05 13:29:24.993122 -0500	bluetoothd	handleConnectionCompleteCallback address=Public 4C:5B:B3:85:CD:D6 handle=0x0 status=702 connectionIsActive=0, wakeupEvent=0
default	2024-08-05 13:29:27.449115 -0500	bluetoothd	handleConnectionCompleteCallback address=Public 4C:5B:B3:85:CD:D6 handle=0x0 status=702 connectionIsActive=0, wakeupEvent=0
default	2024-08-05 13:29:33.992337 -0500	bluetoothd	handleConnectionCompleteCallback address=Public 4C:5B:B3:85:CD:D6 handle=0x0 status=702 connectionIsActive=0, wakeupEvent=0
  1. State dump of 0471
default	2024-08-05 13:30:52.056771 -0500	bluetoothd	statedump:    0BB0FBE0-F708-23DD-B310-E487518668BE → Public 4C:5B:B3:85:CD:D6, Adv.Name: "Reader 0471", LastSeen: 71.12s ago, CoexPriority: 2, DIS:Unavailable, EstablishedFastLeConnection:N, linkReadyDuration:0ms (added to WL 0.000 ago) disableDisconnect:0 useCase:23 scanDutyCycle screenON:0 screenOFF:3 pendingDelete:0 type:Other FindMy:
default	2024-08-05 13:30:52.073019 -0500	bluetoothd	statedump: 0BB0FBE0-F708-23DD-B310-E487518668BE → Public 4C:5B:B3:85:CD:D6, Adv.Name: "", LastSeen: 22881591

What does handleConnectionCompleteCallback's status 702 mean? Any leads on why the connection failed?

Answered by Engineer in 799842022

status=702 corresponds to HCI Error 0x02: Unknown Connection Identifier

This is usually caused by the connection being dropped/failed while the handshake is still going on. You will want to check a packet log to see exactly at what point things have failed.

If you don't have a packet logger, on iOS side the sysdiagnose also includes a packet log. You can find it within the sysdiagnose folder -> Logs -> Bluetooth

You can open that file with the PacketLogger app, which you can obtain from https://developer.apple.com/download/all/ and in the package Additional Tools for Xcode ... which corresponds to the version of Xcode you are running.

Additionally you would want to use any debugging tools you have for the custom peripheral, as the problem is going to be very likely there. Perhaps and unexpected timeout, or the peripheral rejecting the connection because iOS did not respond with the requested parameters (we see that a lot)


Argun Tekant /  DTS Engineer / Core Technologies

status=702 corresponds to HCI Error 0x02: Unknown Connection Identifier

This is usually caused by the connection being dropped/failed while the handshake is still going on. You will want to check a packet log to see exactly at what point things have failed.

If you don't have a packet logger, on iOS side the sysdiagnose also includes a packet log. You can find it within the sysdiagnose folder -> Logs -> Bluetooth

You can open that file with the PacketLogger app, which you can obtain from https://developer.apple.com/download/all/ and in the package Additional Tools for Xcode ... which corresponds to the version of Xcode you are running.

Additionally you would want to use any debugging tools you have for the custom peripheral, as the problem is going to be very likely there. Perhaps and unexpected timeout, or the peripheral rejecting the connection because iOS did not respond with the requested parameters (we see that a lot)


Argun Tekant /  DTS Engineer / Core Technologies

Hi Argun, thanks for your thorough answer!

The BLE HCI logs looks like this:

The highlighted portions are the relevant logs. The connection complete event also shows Unknown Connection Identifier!

A few question:

  1. Do the parameters to the LE Create Connection command look good?
  2. Do you know why I'm seeing "Disconnect Complete - Connection failed to be Established?" The HCI logs immediately shows the disconnection after the create connection command without more context. Could an error be happening at a lower level? Is there a way I could get more detailed logs to understand this disconnect?

The LE Create Connection definitely does not look good.

For starters, the address is 00:00:00:00:00:00 which is not correct.

Then I am looking at the connection parameters, which are also incorrect.

As stated in the Accessory Design Guidelines for Apple Devices

Connection parameter requests may be rejected if they do not meet the guidelines in this section. General connection parameter request guidelines:

  • Peripheral Latency ≤ 30 connection intervals.
  • Supervision Timeout from 6 seconds to 18 seconds.
  • Interval Min ≥ 15 ms.
  • Interval Min ≤ 2 seconds.
  • Interval Min is a multiple of 15 ms.
  • One of the following:
    • Interval Max at least 15 ms greater than Interval Min.
    • Interval Max and Interval Min are both 15 ms.
  • Interval Max * (Peripheral Latency + 1) of 6 seconds or less.
  • Supervision Timeout greater than Interval Max * (Peripheral Latency + 1) * 3.

Normally iOS would respond with an alternative set of connection parameters, so there could be something fundamentally wrong with the request. Perhaps it is the address, I can't be sure.

In any case this sounds like something you need to debug and take care of at your peripheral's side.

There are no lower level logging available from the iOS side. You might be able to find some more details with a Bluetooth sniffer, but I am not sure if you actually need to go any lower than this. What we see here is enough to show the problems. Once you refer to the guidelines above and make sure the BLE protocol is also correctly implemented, things should work better.


Argun Tekant /  DTS Engineer / Core Technologies

Hi again Argun,

Thank you so much! This is a huge lead, will dig further on my end. I can't thank you enough. :-)

Bluetooth peripheral failed to connect with status=702
 
 
Q