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

Number of paired BLE devices

Hi,

We are looking into developing a device based on 52832 platform.

How many devices (phones) can be paired with our device?

In other words: How many pairing keys can be saved in 52832?

Read this post: https://devzone.nordicsemi.com/f/nordic-q-a/27034/how-many-devices-can-i-paired-using-smart-ble

But it does not answer how many keys that can be saved.

Best regards,

  Henrik

  • Hi,

    The number of keys is limited by the amount of flash set aside for storing peer data, and the amount of peer data for each peer.

    You get some indication of the required flash space for peer data by looking at the pm_peer_data_bonding_t data structure, which is 78 bytes. This is the structure holding keys related to the bond. It is stored to flash through Peer Manager, which uses Flash Data Storage to store the structure as a data record. In flash the record consists of a 12 byte header followed by the data, which means the full entry ends up as 90 bytes in flash.

    There is also data for ranking the peers, which is a 4 byte integer that can be used, for instance, to keep track of which peer is the one that was most or least recently connected to. There is one such FDS record for each stored peer, 16 bytes including header.

    In addition to the bonding data there are structures for caching the remote and local GATT databases (pm_peer_data_local_gatt_db_t for the GATT client, ble_gatt_db_srv_t for the GATT server.) The size of those structures depend on the size of the GATT tables, the number of CCCDs, etc.

    There is the option to add custom application data connected to the peer, whose size is entirely up to the application. Our default examples does not use this functionality, it is purely optional, but depending on your application you might want to store some data this way, and then that storage should be accounted for as well.

    What all of this boils down to, is that for each 4 kB flash page you reserve for FDS in addition to the page for garbage collection, you end up with an absolute maximum of thirty-some peers. Then take into account the GATT tables and CCCD entries and the number gets smaller. If I remember correctly then a rule of thumb is approximately 8 peers per flash page, but your mileage may vary.

    The only way to know for sure is to make a test application, where you have the full GATT table, the full set of application data connected to the peers (if applicable), then connect to a number of peers and inspect the flash to see how much space is used for that particular use case. It simply depends on too many variables for giving a quick and easy answer.

    Regards,
    Terje

Related