Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Connection and bonding failure for subsequent devices

I have a new Bluetooth remote product in development that has a bluetooth stack that will incorporate HID, BAS, NUS, ANCS, and buttonless DFU services.  I have the HID and DFU services in place and working but I'm having issues with the ability to have more than one central device capable of connect to my peripheral and to be clear I'm don't mean having more than one simultaneous connections.

For example, I can connect my iPhone to my device right after a fresh firmware upload but when I disconnect and remove the pairing from my iPhone and try to connect from a different iPhone or computer it doesn't work.  I'm using SDK 16 and based my bluetooth stack from the blue_app_hids_keyboard_pca10056_s140 example and can reproduce the same issue with the SDK example.  

The device in development is a new Bluetooth remote.  When in production I expect the device to be able to connect to an iPhone or iPad but at any time be able to remove the device from one iPhone or iPad and connect it to another phone.  The current SDK examples provided doesn't allow that.  I believe the issue is around whitelisting and bonding but I'm so deep into the different aspects of this firmware and the accompanying modules that I need assistance solving this issue.  I replicated the SDK examples provided into my own code.  I'm willing to share my project privately if it helps speed up resolution.  It's a self contained project out side the SDK directory targeted for the nRF52840 DK so there should be no to very little issues running it.

Questions that may be relative to resolution of issue

1.) How do I go about enabling the ability for more than one phone to connect to my remote? (Not Simultaneous Connections)

1.) Is there a way to have just bonding enabled with no whitelisting as I believe I want any device to connect? (Going of other support questions)

2.) In the real world when the peer manager can only store say 8 peer bond information and there isn't a way for users to manually delete bonds, what is a way to mange this?  Does there need to be some type of ring storage where the oldest information is removed so the new can come in?  Should I just work to incorporate some type of reset button into the product that deletes the bonds and all stored information?

If I wasn't clear enough with my questions please let me know.

Thanks

- Matt Wilson

Parents
  • Hi Matt,

    1.) How do I go about enabling the ability for more than one phone to connect to my remote? (Not Simultaneous Connections)

    I agree that it seems that the issue is related to whitelisting. Specifically that the BLE HID keyboard example use whitelisting, and you do not want that. You can verify this by testing the example and pressing and holding Button 2 to turn off the whitelist. That should allow you to connect and bond with a second device. Subsequently both devices would be whitelisted.

    1.) Is there a way to have just bonding enabled with no whitelisting as I believe I want any device to connect? (Going of other support questions)

    If you want to disable the whitelist altogether you should set  init.config.ble_adv_whitelist_enabled to false in advertising_init() in main.c. This is enough, but you should of course also remove all other whitelisting related code as it is no longer used.

    2.) In the real world when the peer manager can only store say 8 peer bond information and there isn't a way for users to manually delete bonds, what is a way to mange this?  Does there need to be some type of ring storage where the oldest information is removed so the new can come in?  Should I just work to incorporate some type of reset button into the product that deletes the bonds and all stored information?

    The number 8 is the maximum number of peers that can be whitelisted, but there is no upper limit of the amount of bonds you can have (other than limitation of the available flash). For most products there is no need to handle bond management, but you could instead have a method where you delete the oldest bond if the number of bonds exceeds a limit (pick a number suitable for your product). The peer manager has a peer rank which will let you know which peers have not connected in a while, or you can delete all but the most recent as suggested here - that is all up to what you prefer.

    Einar

  • Einar,

    Thanks for the great feedback.  With the clarification you provided I was able to get my solution working by removing whitelist.

    - Matt Wilson

Reply Children
No Data
Related