Hi,
We have an interesting but troubling situation. MSP430 is used to control a small motor. Normally we keep track of any settings in RAM. But when power is lost, those settings are stored in the info memory. At powerup, we recover the data and continue operation, as if power was ok. The board has circuitry to indicate the ShutDown (at P2.4 of the micro) and provide sufficient power to allow for a write operation to flash. We're using MSP430F2252 micro, running at 8MHz and 3.3V. The voltage is sustained and stable for at least 600ms after ShutDown is triggered, which generates an interrupt. The ISR halts all operations and proceeds to save the data.
Most of the time, this scheme works. However, occasionally, when power is switched on, the settings are not properly restored, so the algorithm loads default values. My investigation so far shows that when the memory is read back, it is blank, as if it was never programmed, or it was erased, at some point, before being read. Needless to say, that a normal erase function is always called after data is recovered. Again, most of the time, the system works fine. The probability of this error is much less than one percent.
Has anyone else seen such behavior? Any ideas what could go wrong or what could cause this? Any conditions that could make the flash vulnerable?
Here's some of my initialization code:
BCSCTL1 = XTS + DIVA_1 + XT2OFF + 0x0D;
DCOCTL = DCO2; //internal oscilator, just in case
BCSCTL2 = SELM_3+SELS; //switch to the crystal, main clock 8 MHz
BCSCTL3 = LFXT1S1 + XT2S1; //switch to the crystal, main clock 8 MHz
IFG1 &= ~OFIFG;
FCTL1 = FWKEY+WRT;
FCTL2 = FWKEY + FSSEL_0 + FN4 + FN2;
FCTL3 = FWKEY+LOCK;
I'm still troubleshooting this, and will post any relevant updates. Currently, I'm suspecting it may be related to another, perhaps more serious flash related issue I found, while testing this one. (I'll post that one separately.)