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

FDS: Unable to update fds records with new record

hi,

i am working on FDS. here i am able to write number of records and also able to read them back.

but while updating i deleted one of the old record and writing new record at same record key.

problem is i am able to delete the existing old record. but unable to write back new record at same key.

here is my update record function.

////update Fds_ record
static ret_code_t fds_update_record(uint8_t update_record_number)
{

    fds_record_t        record;
    fds_record_desc_t   record_desc;
    fds_record_chunk_t  record_chunk;

    // Set up data.
    record_chunk.p_data         = update_array;
    record_chunk.length_words   = sizeof(update_array)/sizeof(update_array[0][0]);
    
    // Set up record.
    record.file_id              = FILE_ID;

    record.key                      = REC_KEY+update_record_number;
    record.data.p_chunks       = &record_chunk;
    record.data.num_chunks   = 1;

    ret_code_t ret = fds_record_write(&record_desc, &record);
    if (ret != FDS_SUCCESS)
    {
       return ret;
    }
    NRF_LOG_PRINTF("Writing Record ID = %d writing record:%x record:%d\r\n",record_desc.record_id,REC_KEY+update_record_number,update_record_number);
    return NRF_SUCCESS;
}

how to update new record to existing record.

here FILE_ID is 0X1111 and REC_KEY is 0X2222

thank you

Parents Reply Children
No Data
Related