8 years, 11 months ago.

how to read/write from/to flash memory in K64F

Hi all, I need to write and read some run time data from my mbed K64F. I know there is an EEPROM memory in it, but I need some piece of code to access it. Actually I need to read and write some IP address into mbed so that on every reboot I can read the previous data. I saw some techniques in freescale homesite but they are too complicated to implement. Can any one guide me how to access non-volatile memory in K64F

2 Answers

-deleted-
8 years, 11 months ago.

A similar question about EEPROM access: https://developer.mbed.org/questions/7980/EEPROM-for-FRDM-K64F/

8 years, 11 months ago.

This code does not support EEPROM, but it does support writing to flash memory: https://developer.mbed.org/users/Sissors/code/FreescaleIAP/

I have tried this code, is it non volatile ?? I mean will i be able to access my data after restarting the board??

posted by zain aftab 01 Jun 2015

Yes, it writes it to the flash. Only depending on the board reprogramming it might include a full chip erase

posted by Erik - 01 Jun 2015

thanks for your quick reply !! I am struggling to read the data.

  program_flash(address, (char*)&numbers, 40);  

Once I used the above function to write into memory, how can I access this data is there any specific function for it

posted by zain aftab 01 Jun 2015

Have a look at the example code at the library page. Reading flash does not require anything special, you just need the address where you wrote to and cast that to an integer pointer (or pointer to whatever type you stored there).

posted by Erik - 01 Jun 2015