Reset clears Flash on SAMD21

One of my projects uses a XIAO SAMD21.
I use the FlashStorage library to store permanently an integer in the Flash memory.
However, when I do a hardware reset using the RST pads, the content of that variable is lost but the code remains.
Why is it happening ?

Hi There,
You need to tell IDE not to clear it before upload , is all.
GL :-p PJ :santa: :v:

Great! But how to do it?

Happy Xmas :christmas_tree:

The Tools menu, and Google It’s Arduino Samd 101 :smile: :v:
GL :slight_smile: PJ :christmas_tree:

Nope, nothing like that in the Tools menu…

HI there,
Thats odd, What version IDE? and You have the correct chip selected?
should look like this…

GL :slight_smile: PJ

Ok, I see. I’m using an older version of the IDE.
Anyway, I found the issue. An EEPROM.commit() was missing.

Thanks !

1 Like