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

Bonding Information not stored in Flash memory

I am using nrf52 with SDK 14.2.0 and SD is S132.

The issue I am facing is that after Central is paired with one peripheral and bonding is done, the bonding information is not stored by central and so the next time when the already bonded peripheral tries to connect with the Central, it follows pairing and bonding procedure. Below are the peer manager events that I am getting:

1. PM_EVT_CONN_SEC_PARAMS_REQ

2. PM_EVT_CONN_SEC_SUCCEEDED

3. PM_EVT_CONN_SEC_PARAMS_REQ

4. PM_EVT_CONN_SEC_SUCCEEDED

The above events are coming for new device as well as already paired device.

Also, one issue I think is I am never getting PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event even after bonding is done. Also one more strange behavior is that my system event handler, which I registered using NRF_SDH_SOC_OBSERVER, is never called.

Can you please help me to resolve this issue?

  • FDS depends on being able to observe events and registers an event handler using NRF_SDH_SOC_OBSERVER.  If the observers aren't working correctly as you've eluded to in your question, then pairing data will not be stored correctly as FDS will not be receiving all expected events.  If you're using the nRF5 SDK make system and linker scripts, use of NRF_SDH_SOC_OBSERVER and friends should just work.  The linker scripts did change between SDK versions so check that all the appropriate sections are present in the linker scripts.  I had a similar issue to this with a custom make system where I compiled the SDK to a library (.a) and then attempted to link this library to a final executable with a main.c.  Linking .a files containing the SDK does not work correctly in the presence of NRF_SDH_SOC_OBSERVER usage in all cases, because when linking, only object files that have referenced symbols are included in the link.  If I remember correctly, for FDS there are no directly referenced symbols from the file in which NRF_SDH_SOC_OBSERVER is used and so the FDS event handler and friends do not appear in the final binary.  This is a silent failure which you can only really detect easily be looking in the disassembly of the output file to ensure that all the expected number of event observers have been registered in the observer link sections. 

  • Yes I was doing same. I had my own make system which didn't work. We need to use SDK's make system. Still knowing the exact root cause is to be done. I will debug it further to know the exact root cause and post here for others knowledge!

  • Would a simple diff do if we are just talking about Makefiles?

  • I did the same. There were two differences:

    1. I used static library (.a) for SDK files. The sample application compiles the files and links objects directly. I had compiled every files necessary for my application. ( SDK file list is same for my application and Sample App.)

    2. I did not include Makefile.common in my application. 

  • I had the same problem.

    Did you include /components/softdevice/common/nrf_sdh_soc.c?

    This solved the issue for me.

    For some reason neither the compiler nor the linker are complaining if it is missing.

    Also it can happen, that the optimizer can remove it, as mentioned here:

    devzone.nordicsemi.com/.../fds-not-able-to-write-in-sdk-14

Related