Where is bonding information stored in flash?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AnWa_1259496
Level 4
Level 4
Welcome! 50 replies posted 25 replies posted

The API call CyBle_StoreBondingData states in the description:

   

"This function writes the new bonding data from RAM to the dedicated Flash 
 location as defined by the component".

   

But where does it write it to? This is important from the point of view of bootloader checksum verification of the application and also flash protection settings.

0 Likes
1 Solution
Anonymous
Not applicable

Aha, I found something:    CYBLE_API_RESULT_T CyBle_GapGetBondedDevicesByRank (CYBLE_GAP_DEVICE_ADDR_LIST_T
*bondedDevList)

   

Sounds promising.

   

It claims to return a list of the bonded addresses into the pointer passed into the call. I'll see if I can get a working test of this going.

View solution in original post

0 Likes
5 Replies
Anonymous
Not applicable

I does not write to any specific location determined by us.

0 Likes
Anonymous
Not applicable

Does anyone know how we can read the stored bonding data out of the memory?

   

I am looking to build an application that behaves differently depending on the stored bonding data.

   

E.G: If the board has a bond, connect to that bond, otherwise advertise as being "open"

   

I've been looking through the documentation/datasheet, but it only mentions writing and clearing the "currently connected" device into the bonding data flash.

0 Likes
AnWa_1259496
Level 4
Level 4
Welcome! 50 replies posted 25 replies posted

After not getting any helpful reply I investigated this and found the only way to access this was to get the address from the map file and access it directly by address. This is not good practice of course but I could not find any other way.

   

I actually used the value from the ELF file but thats specific to bootloadable code. The map file should have it.

   

To erase all bonding data:

   

   uint32 flashaddr = 0x14380;     // value of "p_sp_flash_storage" from parsed ELF
    CyBLE_Nvram_Erase((uint8*)flashaddr, 0x80);

0 Likes
Anonymous
Not applicable

Hmmmmm, you're right that it does sound "hacky" 😛

   

Specifically I really only want to be able to compare the incoming connection request BDAddr with the stored bond BDAddr to verify that I've already connected to it previously, but I'm thinking I'll check out the whitelist-side of the stack before I dig into custom flash reading.

   

(Thanks for the info btw :))

0 Likes
Anonymous
Not applicable

Aha, I found something:    CYBLE_API_RESULT_T CyBle_GapGetBondedDevicesByRank (CYBLE_GAP_DEVICE_ADDR_LIST_T
*bondedDevList)

   

Sounds promising.

   

It claims to return a list of the bonded addresses into the pointer passed into the call. I'll see if I can get a working test of this going.

0 Likes