Hello,
I am using nrf52832, having SDK 15.3.0 in Segger Studio IDE. Win10
I am using fds_test_find_and_delete() function, to find and delete particular record from flash.
But i am doing so, my peer manager is throwing error as PM_EVT_PEER_DATA_UPDATE_FAILED and connection is getting lost.
I am aware of that peer manager is also using FDS library to store the bond data. But i dont know why it is getting erase.?
Kindly find the attached function for deleting the record.
/*flash data storage delete*/
ret_code_t fds_test_find_and_delete (uint16_t FILE_ID, uint16_t RES_KEY)
{
fds_record_desc_t record_desc;
fds_find_token_t ftok;
ftok.page=0;
ftok.p_addr=NULL;
// Loop and find records with same ID and rec key and mark them as deleted.
while (fds_record_find(FILE_ID, RES_KEY, &record_desc, &ftok) == FDS_SUCCESS)
{
fds_record_delete(&record_desc);
NRF_LOG_INFO("Deleted record ID: %d \r\n",record_desc.record_id);
}
// call the garbage collector to empty them, don't need to do this all the time, this is just for demonstration
ret_code_t ret = fds_gc();
if (ret != FDS_SUCCESS)
{
return ret;
}
return NRF_SUCCESS;
}
/**/
Below is the Section placement macros:
FLASH_PH_START=0x0 FLASH_PH_SIZE=0x80000 RAM_PH_START=0x20000000 RAM_PH_SIZE=0x10000 FLASH_START=0x26000 FLASH_SIZE=0x5a000 RAM_START=0x20002640 RAM_SIZE=0xd9c0
I have used the below FILE_ID and REC_KEY in my code to store the record:
#define FILE_ID_RES (0xf010) #define REC_KEY_RES (0x7010) #define FILE_ID_WEIGHT (0xf070) #define REC_KEY_WEIGHT (0x7070) #define FILE_ID_DEVICE (0xf0A0) #define REC_KEY_DEVICE (0x70A0)
Kindly provide the solution for the same..