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

How to store ble bond information in RAM instead of flash?

This might be a naive question, as I am a novice in this field.

I am making something similar to ble_app_hids_keyboard in sdk11, it will be configured as a consumer device to control the volume buttons of a phone.

In my use case, there will be a large amount of different phones connect to the nrf51822 chip everyday, so the program will frequently erase the bonds stored in the flash in order to connect to new phones. 

This makes me worry about the life of the flash.

As I understand, ble_app_hids_keyboard is using flash to store bond information, and every time it delete the bond, it hurts the flash.

nfr51 flash can only be erased 10,000 times, so I would like to store the bond information in the RAM instead of the flash. I don't care the fact that RAM will 'forget' everything after a power reset.

1. Is this possible? How can I implement it?

------------------------------------------------------------------

When I was writing this post it just came into my mind, one more question:

2. In bluetooth communication, is it necessary to store bond information?

  • Hi,

    I think the second question is probably most important in this case, so I will start with that.

    2. In bluetooth communication, is it necessary to store bond information?

    Not necessarily. If you don't need an encrypted link, then there is no need to do pairing or bonding. If you need an encrypted link, but this should only be used once, then you can pair but not bond. This is essentially the same thing, but the difference is that the bonding information is kept in RAM and forgotten when the connection is terminated. You have not described exactly which behavior you want, but I suspect this is what you need?

    1. Is this possible? How can I implement it?

     The Peer manager library in SDK only support storing bonds in flash. I am sure you can modify it to store bonds in RAM, but I expect it will be some work. Also, it does not seem very useful (as described above).

  • Does this Peer manager sdk only contain all paring and bonding information?

    in peer manager which function contains all paring informations?

  • Hi,

    Can you clarify what you actually want to do (irrespective of method)? Getting that established first if usually a good idea, as if not one might dig down into details that are not relevant, or even may end up down the wrong path.

    0_velan_1 said:
    Does this Peer manager sdk only contain all paring and bonding information?

    The peer manager is a library that handles pairing and bonding for you. It also handles peer data, so for instance remembering if a bonded peer have enabled notifications so that it applies also to a subsequent connection. The actual data is stored in flash using FDS (handled internally in the peer manager).

    0_velan_1 said:
    in peer manager which function contains all paring informations?

    Yes, the peer manager handles everything related to pairing.

Related