Save variables in memory

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Save variables in memory

988 Views
Nadia
Contributor III

Good afternoon,
I am using the MCU LCP55S14, and it doesn't have an EEPROM memory, would anyone know if I can use some other memory to store variables externally? And if so, how should I do it?

Thank you very much.
Best regards.

0 Kudos
4 Replies

982 Views
frank_m
Senior Contributor III

The following options come to my mind, if you need persistent storage.

1. battery powered RAM

2. external Flash memory, e.g. SD or MMC card

3. external MRAM (fast, but not really cheap)

4. internal Flash, i.e. reserving a Flash sector for an EEPROM "emulation"

 

0 Kudos

978 Views
Nadia
Contributor III

@frank_m 

Thank you for your response.
How could I do to use an internal Flash, i.e. reserve a Flash sector for an EEPROM "emulation"?

Forgive my questions, but I've always used an internal EEPROM on the microcontroller itself and I can't find much information on how to do what you're telling me.

Thank you very much.
Best regards.

0 Kudos

972 Views
frank_m
Senior Contributor III

Message got eaten by the forum, so I try again ...

EEPROM simulation usually goes under the term IAP (In-Application Programming). Perhaps there are SDK examples or application notes for your MCU.

First, you would need to reserve a Flash sector of appropriate size, or else the linker would use it for code or variables. This means removing it from the linker script. The most upper sectors are usually preferred, for obvious reasons.

But IAP has it's downsides.
First, Flash can only be erased as whole sectors, not single entries (bytes/words). Writing is usually done in word or longword unit, though.

Second problem is timing. Most MCUs have only single-bank Flash, i.e. all Flash sectors share one erase/program logic and voltage generator. This means, no code execution is possible during erase/write, your application will stall. This might get you into trouble with externally driven interrupts or realtime tasks.

Third issue is endurance. Most vendors guarantee 10k or 100k erase/program cycle for their Flash.
This number is valid for the worst-case temperature. If you erase/write rarely (less than once per hour), this will probably not be an issue.

I have no specific experience with the LPC55Sxx MCUs itself, though.

First step would be to check the datasheet and user manual for the Flash memory map, and Flash parameters.

IMHO, adding a serial EEPROM or MRAM device would be much quicker, and less troublesome.

0 Kudos

960 Views
Nadia
Contributor III

@frank_m 

OK, thank you very much for your help.

Best regards.

0 Kudos