Are operations on a MSP430's FRAM Atomic
If power loss occur in the middle of any atomic or non-atomic operation than data corruption is highly probable.
&quot;having 3 variables so that the state of 2 is the correct value?&quot;
This is a good idea but the 3 writings should be done in three distant moments in time separated by at least 1 second.
In fact, the power supply fall off may last many milliseconds.
There's another approach that was used by the Journaling Flash File System years ago.
Basically, each data structure write is done in 2 different moments in time.
The first time you write the actual structure.
The second time, you calculate the structure's digest or CRC and then write the digest.
When you read the structure you verify that the digest you calculate is equal to the one that was written in memory.
In this case there's no need for data duplication.