2018-12-19 04:06 AM
Hi.
I want to read the EEPROM but i don't see any function for this. i write my data in eeprom by hal_flashex_dataeeprom_program() function and i want transmit eeprom's data with uart to pc. how can i do this?
2018-12-19 06:24 AM
You just read it as if any other const data array in the flash memory. If you want a function then you could write something like this to read from it:
int read_from_eeprom(uint8_t *destination, unsigned int position, unsigned int len)
{
const unsigned int eeprom_length = DATA_EEPROM_END - DATA_EEPROM_BASE + 1;
unsigned int i;
if (position + len > eeprom_length) {
return -1;
}
for (i = 0; i < len; i++) {
destination[i] = *((volatile uint8_t *)(DATA_EEPROM_BASE + position + i));
}
return 0;
}
2019-02-05 12:34 AM
Thank you @After Forever