This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Proximity profile on nRF51822 with iOS app. Failed to connect.

I've just flashed the softdevice 5.2.1 and BLE Proximity sample app to my nRF51822. I presume any previous bond state on the device should have been wiped by doing this.

If I now start the nRF Proximity iOS app and try to connect to the device, I get the following error:

Failed to connect The app couldn't connect to Nordic_Prox This usually indicates a previous bond. Go to the settings and clear it before you try again.

Which settings does this error refer to? If I go to the Bluetooth settings in iOS, the device is either not listed at all, or is flickering between two states (not connected and pairing, I think).

  • It does refer to iOS's Bluetooth settings. I'd recommend you to turn off the advertising device, and then go back into the settings following this procedure. Even though this is shown for iOS 5.1 and nRF8002, the procedure is the same also for later iOS versions and nRF51822.

  • Fine, but with the advertising device (the dev kit) off, there are no devices listed in the iOS Bluetooth settings at all.

  • I just tested this with an iPhone running iOS 7.0.4, and I don't see any problems; the device comes up in the list and then the question from iOS whether you want to pair comes up. Accepting this, things seems to work.

    However, on another phone, running iOS 7.1 beta, I do see this error popping up several times, but in between them the pairing question also comes. When accepting this, things also seems to work correctly. I will however try to get this bug fixed for a future version.

    Which iOS version are you using? Do you not see this pairing question at all?

  • I haven't figured out how I'm able to get the device into this state, but my dev kit now flickers between two states on an interval of about a second:

    1. LEDs 0 and 6 on, all others off. Bluetooth settings on iOS device show "Not connected"
    2. LEDs 1 and 5 on, all others off. Bluetooth settings on iOS device show "Connected"

    You cannot forget the device from the iOS Bluetooth settings in this state, because you can't click on it. However, you can use the nRF Proximity app to pair with the device and it will settle into the second state. From there, you can use the trash can button in the app to forget the device and it will go back to advertising, correctly.

    How does the device get into this state? How do I avoid that in my own iOS app code?

  • It's a little unclear to me exactly what you're seeing, and you don't state whether or not you get the pairing question from iOS. If you do, you should be able to tap the device in Bluetooth settings, and delete bond information. Note that you must tap the small i, not just on the row of the device.

    Also note that removing a device from nRF Proximity itself does not remove bonding information, since that is impossible for the app both to know and do anything about; removing it from the app will only make nRF Proximity not initiate any further connections to it.

    In general, you should be able to avoid this kind of problems by making sure you don't delete bond information unless you really want to. It will often make sense to only delete the bond information for the old Central once you have successfully bonded again with a new Central, or it might make sense to keep bonding information for all devices. If so, you need to make a decision on what to do if your user bonds with too many devices. Either way, I'd recommend you to pass an event handler in the bond_manager_init() function and use those events to behave appropriately.

    Also, you should also consider whether you actually need bonding at all. If you can, you make some things easier by just using an open link.

    For general information on what bonding is and how it works, this guide may be useful.

Related