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

Peer manager returns invalid peer id

In our testing we encounter some devices (Centrals with nrf52832), where the peer manager event PM_EVT_BONDED_PEER_CONNECTED contains a invalid peer id 0x4000 (allowed values are between 0..255). This seems to be caused by a wrong FDS-record. The function "pds_peer_data_iterate" scans for all fds records with the record key PM_PEER_DATA_ID_BONDING (0xC007) and hereby finds a record that looks like this in flash:

image description

What's strange about this record is that it matches the gap-address of the connecting peer, but the file id (marked in yellow) is 0x0000. Which will be reported as peer id 0x4000 (see function "file_id_to_peer_id" in peer_data_storage.c).

Looking into the peer_manager code, I haven't found a way how it could happen that it writes a file id of 0x0000. What do you think? Is this a software bug or a hardware issue. Maybe a reset happens while the file id is written by FDS in the function "record_header_write_finalize". But this also seems quite unlikely and we have seen this issue with multiple devices.

This is on SDK12.2

Related