no eeprom - how to save some variables on LPC1768?

18 Apr 2012

I have some variables, logs, configuration data that I want to keep after reset/power failure (around 4K Bytes of data)...

How to do it on LPC1768 without EEPROM? I was thinking of using FLASH. But only first 16 sectors are 4K long, and the program would probably use more than 64KB of FLASH... So, the first issue is to reserve lets say 2 sectors in first 16 sectors of FLASH... How to say to the compiler/linker to avoid using them? Or how to pre-load this sectors with some user data on compile stage?

The second issue is modifying this 4KB sector... So this data is byte related, and it would change regularly (not all of 4KB, but some bytes)... How to keep the written data in FLASH up-to-date? I was thinking using 2 4KB sectors, and alternately use one and the other sector with time stamp (to know witch one is newer so I could erase older one with new data)...

The third issue is writing on flash. While writing, reading flash is impossible. How to manage interrupt routines, or how to transfer those routines to RAM?

18 Apr 2012

Why dont you use the mbed localfile system that would also allow you to access it from your PC when needed. Alternatively, you could use an SD card connected via SPI. Example code is in cookbook. Probably easier and safer than messing with the lpc1768 flash memory.

19 Apr 2012

Yes you are right, but the mbed is just the prototype platform, I must think of production time when the localsystem is not there any more...

So, yes, sdcard, but it is an option... I got the craziest idea ever... As the system is using GPRS (SIM900), it also has SIMCARD, that is pure EEPROM... I would use it for storing some variables that change frequently, and maybe 4K of flash for variables that are more permanent without many changes...

Any idea how to set some user/custom strings in FLASH at precise sector?