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

Bond information not stored in Flash

Hi, I was in a process of developing a central device with nrf51422 in PCA10028 board with NUS service client.I use SDK v12.2.0.We have an example code in the library which I modified for multiple devices support.The device connects based on NUS Service UUID in the advertisement packet.I have added peer manager based on a guide to add bonding and intends to bond with the device using static passkey.After the discovery of existing services in the server I call pm_conn_secure() function to bond two devices.

Following the same method I added peer manager and a static passkey in NUS example(peripheral).

The problem I face here is connection is ok and I could get notifications from peripheral to central device successfully but only for the first time.After a disconnection I could not reconnect both devices.I need to clear bonds in central to have a connection again.Investigating more into the issue I found that bond info is stored successfully in Central device as I could see PM_EVT-PM_EVT_PEER_DATA_UPDATE_SUCCEEDED getting called multiple times in the central,but in peripheral it is not stored as I got only a single call of PM_EVT-PM_EVT_PEER_DATA_UPDATE_SUCCEEDED in peripheral and that too without any flash operation as I checked flash_changed flag.

As far as I know the storage of bonds in flash is automatically handled by peer_manager.Could someone shine some light into this issue. ble_app_uart - Copy.zip

Parents
  • I can't see that you are doing this:

    Fstorage
    
    First, we will set up the underlying flash storage module. Device Manager relied on pstorage, while Peer Manager uses the newer fstorage. In sys_evt_dispatch(), remove the call to pstorage_sys_event_handler() and add a call to fs_sys_event_handler() at the same location:
    
    // Forward Softdevice events to the fstorage module
    fs_sys_event_handler(sys_evt);
    

    anywhere?

    You also need to set the system event handler with softdevice_sys_evt_handler_set().

    You can see how this is done in ble_app_hrs for example.

Reply
  • I can't see that you are doing this:

    Fstorage
    
    First, we will set up the underlying flash storage module. Device Manager relied on pstorage, while Peer Manager uses the newer fstorage. In sys_evt_dispatch(), remove the call to pstorage_sys_event_handler() and add a call to fs_sys_event_handler() at the same location:
    
    // Forward Softdevice events to the fstorage module
    fs_sys_event_handler(sys_evt);
    

    anywhere?

    You also need to set the system event handler with softdevice_sys_evt_handler_set().

    You can see how this is done in ble_app_hrs for example.

Children
Related