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

fds can't read what I've stored

Hello,

I am trying to use the FDS module with the Softdevices and Peer manager.

I can store some data and I am able to read the header of the record, but when I try to see the data I find some data different from what I have written

            record.data.p_data       = p_rec ;
            record.data.length_words = 4;   /* one word is four bytes. */
            //record.key += i;
             
            memset(&flash_record, 0, sizeof(fds_flash_record_t ));   
            memset(&desc, 0, sizeof(fds_record_desc_t));   
            memset(&ftok, 0x00, sizeof(fds_find_token_t));
            err_code = fds_record_find(FILE_ID, RECORD_KEY_1, &record_desc, &ftok);
            printf("ftok =%#010x\n ", ftok.p_addr);
            if (err_code == NRF_SUCCESS){

                fds_record_open(&record_desc, &flash_record);

                //memcpy(&rec_cgms, flash_record.p_data, sizeof(ble_cgms_rec_t));

                rec_cgms = (ble_cgms_rec_t*)flash_record.p_data;
                err_code = fds_record_close(&record_desc);
                APP_ERROR_CHECK(err_code);
                err_code = fds_record_update(&record_desc, &record);
                APP_ERROR_CHECK(err_code);

            }
            else {
                err_code = fds_record_write(&record_desc, &record);
                APP_ERROR_CHECK(err_code);
                m_database[i].record_desc =  record_desc;
                //memcpy(&m_database[i].record_desc, record_desc, sizeof(fds_record_desc_t));

            }

I am checking with the watch option of the debugger on the SES.

The 4 words that I am writting are on the address 0x2000fea4

Then reading the record descriptor after calling the open function:

I can see the header stored as it should be, but the data part is totally different from what I expected.

Also the flash_record structure:

Can anyone help me understand what I am doing wrong on the reading or writing of the FDS module?

Thanks

Parents Reply Children
No Data
Related