Part Number: MSP430F6720
Hi Experts,
we're using the MSP430F6720 processor in a device we use in industrial control systems. We're experiencing data loss in the information memory where we store the device's parameters, for reasons we can't pinpoint. We're using the following code as the write routine to Flash. Do you have any suggestions for resolving this issue?
void Write()
{
WDTCTL=WDTPW+WDTHOLD+WDTTMSEL;
int *Flash_ptr=(int *) 0x1800; // Flash pointer
unsigned int i;
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + ERASE; // Set Erase bit
*Flash_ptr = 0; // Dummy write to erase Flash segment
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
for (i=1; i<MenuSon; i++)
{
*Flash_ptr++ = *(Menu[i].Address); // Write value to flash
}
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
WDTCTL=WDT_ADLY_1000;
}
Regards,
Marvin
