In a MSP430 with internal FRAM, I am storing a long variable in FRAM with the following code.
#pragma PERSISTENT(x)
unsigned long x = 0;
//FRAM write
SYSCFG0 = DFWP; //unlock fram
x++;
SYSCFG0 = PFWP | DFWP; //lock fram
Given this is a 32 bit value and it is a 16 bit microcontroller, if a power loss were to occur during the write, could data be corrupted? Do additional mitigations have to be taken such as having 3 variables so that the state of 2 is the correct value?