Hi,
We are using MSP4305437A where we write a set of logs in the main memory bank 30000-3fff. I am trying to write and erase a set of logs into this location within an ISR routine. Everytime the interrupt comes I write few bytes into this bank 30000 and then erase it and again repeat the same. I am using the code below for erase and write. This interrupt comes every 16ms when I am writing and erasing the logs. I run this code for several hours and after that when I try to read the data in the location 30000-3fff, I expect it to be all FF's since I erase it, but I see that it holds data other than FF like BF, F7 etc in some of the locations.
I am wondering if the erase is failing since I have been writing and erasing so many number of times or is there anything wrong in the way I am trying to do the erase and write.
Also all the code is being executed from the flash memory- 0x5C00 to 0xFFFF
Flash erase:
//Disable interrupt
//Disable watchdog
flashPtr = (unsigned char*)0x30000; //flashPtr is of time unsigned char *
//wait while busy is set in FCTL3
FCTL3 = FWKEY;
FCTL1 = FWKEY+MERAS_L;
*flashPtr = 0;
// wait while busy is set in FCTL3
FCTL1 = FWKEY; // Lock flash
FCTL3 = FWKEY+LOCK_L;
//enable interrupts
Regards
Lakshmi