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

Ndef library: multiple records update issue

Hello,

I have multiple records that I want to update during the runtime of the program.

What is working:

1. I can write in memory for the first time initial values.

2. I can update all records and it works.

3. I can load all records and it works.

Problem:

When I update for the first time one of the records. All other records points the same "default" location, like they are de-referenced.

However if I update each record one time, it work fine forever.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#define FILE_ID 0x1111
#define REC_KEY 0x1908
#define TOTAL_RECORDS 3
static fds_record_desc_t m_record_desc[TOTAL_RECORDS];
static fds_record_t m_record[TOTAL_RECORDS];
ret_code_t ndef_file_load(uint8_t * p_buff, uint32_t size, uint8_t id)
{
ret_code_t err_code;
fds_find_token_t ftok;
fds_flash_record_t flash_record;
// Always clear token before running new file/record search.
memset(&ftok, 0x00, sizeof(fds_find_token_t));
// Search for NDEF message in FLASH.
err_code = fds_record_find(FILE_ID, REC_KEY+id, &m_record_desc[id], &ftok);
// If there is no record with given key and file ID,
// create default message and store in FLASH.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Records are stored in a static fds_record_t array and they got their own individual key.

Any idea on the direction to explore ?

Thanks