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

Peer manager and FDS, new records at each connection.

Hi,

I am working with a NRF52840 with the SDK16 and I am facing field issues with the peer manager flash usage. At each connection the app subscribes to characteristic and the local data base of the MCU is updated (write to the flash). The main problem is since the app subscribe to multiple services at connection, MCU peer data are updated multiple time (644bytes) at each connection.

[00000015] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Peer rank, action: Update, no change
[00000015] <info> BLEDriver: Connected to a previously bonded device.
[00000015] <info> SecurityService: Bonded, not yet secured.
[00000015] <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
[00000015] <info> BLEDriver: Connected.
[00000015] <info> SecurityService: Bonded, not yet secured.
[00000015] <info> BLEDriver: Encryption started.
[00000015] <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Encryption
[00000015] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Peer rank, action: Update, no change
[00000015] <info> BLEDriver: Connection secured: role: peripheral, conn_handle: 0x0, procedure: 0.
[00000015] <info> SecurityService: Secured.
[00000015] <debug> nrf_ble_gatt: ATT MTU updated to 185 bytes on connection 0x0 (response).
[00000015] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Local database, action: Update
[00000015] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Local database, action: Update
[00000015] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Local database, action: Update
[00000015] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Local database, action: Update
[00000015] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Local database, action: Update
[00000015] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Local database, action: Update
[00000016] <info> peer_manager_handler: Peer data updated in flash: peer_id: 1, data_id: Local database, action: Update

Since our device could be used multiple time per day (connection in background when in range) and support multiple peers, the flash memory is really stressed and do a lot of Garbage collection and lead to various issue.

We found a workaround on Android where the phone first check their local data base at connection and subscribe only if the characteristic descriptor is not up to date. It works well and we don't experience issue. 

However, on iOS, it seems that the OS clears its cached value of the Client Characteristic Configuration descriptor (0x2902) after each disconnection. I checked in the iOS NRF connect app and after a reconnection, the previous characteristic state is overwritten to false. I already look at other post without having a clear solution eg : https://devzone.nordicsemi.com/f/nordic-q-a/59866/new-fds-record-on-each-connection.

What could be a short term solution on iOS or in the device firmware ? 

Thanks,

Florian

Related