Hello,
I am currently working with the Virtual EEPROM Interface to store factory configuration data that I need to persist across firmware upgrades. The write operation appears to be functioning correctly, as it returns FSP_SUCCESS. However, I am encountering an issue when attempting to read the reference data, receiving an FSP_ERR_NOT_FOUND error.
FSP_SUCCESS
FSP_ERR_NOT_FOUND
The write function successfully writes the data and returns FSP_SUCCESS:
fsp_err_t vee_write_ref_data(uint8_t *buffer, size_t size) { uint16_t write_time_out = UINT16_MAX; if (size != REF_DATA_SIZE){ return FSP_ERR_INVALID_SIZE ; } fsp_err_t err = RM_VEE_FLASH_RefDataWrite(&g_vee0_ctrl, buffer); if (FSP_SUCCESS != err){ return err; } /* Wait for the Virtual EEPROM callback to indicate completion */ while (!g_write_flag && --write_time_out){ /* Timeout handling to avoid infinite loop */ if (RESET_VALUE == write_time_out){ return FSP_ERR_TIMEOUT; } } g_write_flag = false; return FSP_SUCCESS; }
fsp_err_t vee_get_ref_data_ptr(uint8_t **ref_data) { return RM_VEE_FLASH_RefDataPtrGet(&g_vee0_ctrl, ref_data); }
const rm_vee_cfg_t g_vee0_cfg = { .start_addr = BSP_FEATURE_FLASH_DATA_FLASH_START, .num_segments = 2, .total_size = BSP_DATA_FLASH_SIZE_BYTES, .ref_data_size = 256, .record_max_id = 16, .rec_offset = &g_vee0_record_offset[0], .p_callback = vee_callback, .p_context = NULL, .p_extend = &g_vee0_cfg_ext };
When you format VEE, did you include the reference data? Was it retrievable after format? What about after adding other data, is it still readable? Did it becomes un-readable after you write ref data for the 2nd time?
I thought reference data is written once, to identify that VEE and not to be updated again. You can always use other records to update data that changes over time. (my personal opinion)
Thank you for the reply CS Yep I want to write the hardware version and model number in the reference data section. and I only want to write it once before shipping it. and the idea is to make the firmware configure itself based on reference data, when we send an update/ flash again.I would greatly appreciate it if you could suggest any efficient or reliable methods to implement this approach.
Please find the attached example project on EK-RA6M4.
The returned pointer from RM_VEE_FLASH_RefDataPtrGet points to the start of reference data.
I hope it helps.
RA6M4_VEEPROM_REF_DATA.zip