What about a non-volatile on chip or on-board memory?

I need the equivalent of the well known EEPROM to store several parameters.
#include <eeprom.h> gives file not found.

What else?

Once again thanks for the help

It seems SAMD21 didn't have any internal eeprom but you can configure some area from samd21 flash to emulate eeprom.

I'm not sure do hey have libraries for this chip (SAMD21).

mmm ... how to do with flash?

It is really a bad thing.

Yes, I can add a chip somewhere but ...

Here's a library for writing to the internal flash of the SAMD21:

It's written by one of the Arduino lead developers. It actually offers the option of EEPROM library API emulation, similar to how ESP8266 does it.

Be sure to note the warning:

Flash memory has a limited amount of write cycles. Typical flash memory can perform about 10000 writes cycles to the same flash block before starting to "wear out" and begin to lose the ability to retain data.

So BEWARE: IMPROPER USE OF THIS LIBRARY CAN QUICKLY AND PERMANENTLY DESTROY THE FLASH MEMORY OF YOUR MICRO, in particular you should avoid to call the write() function too often and make sure that in the entire life of the micro the number of calls to write stay well below the above limit of 10000 (it's a good rule-of-thumb to keep that number in mind even if the manufacturer of the micro guarantees a bigger number of cycles).

The same caution must be taken if you're using the EEPROM API emulation (see below) with the EEPROM.commit() function.

Thanks pert.

I read:

"Question: The content of the FlashStorage is erased each time a new sketch is uploaded?
Answer: Yes, every time you upload a new sketch, the previous content of the FlashStorage is erased."

If this is true I definitively need an esternal EEPROM chip.


I suppose you could consider that to not be fully "non-volatile".

I need to update N times the program leaving untouched the data,
avoiding to download them before and re-upload them after each software update.

Thanks again for your help.

Little bit more complicated is to use unused part of FPGA configuration flash as non-volatile storage. Atleast FPGA golden image is untouched and it may only erase used area.

There should be about 1MB of free flash there.

It is a treasure hunt?


we have to add some feature to allow using the 1MB left of the FPGA Flash. we are thinking to implement a file system of some kind... unfortunately this is not something firmly on the roadmap for now.