Hello,
I am using msp430f5418 with IAR EW 5.10.
I have a code fragment like this,
char value = '0';
int i = 0;
char * Flash_ptr = (char *)0xf140;
__disable_interrupt();
while ((FCTL3 & BUSY) == BUSY);
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY+ERASE; // Set Erase bit
*Flash_ptr = 0; // Dummy write to erase Flash seg
while ((FCTL3 & BUSY) == BUSY);
FCTL1 = FWKEY+WRT; // Set WRT bit for write operation
for (i = 0; i < 128; i++)
{
*Flash_ptr++ = value++; // Write value to flash
}
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY+LOCK; // Set LOCK bit
__enable_interrupt();
It is executing correctly while running independently.
But when I added it into my real project, after the Dummy write to erase Flash seg the program is resetting.
I checked the value of SYSRSTIV Register, but it is zero.
I dont know what is wrong with it,
can anybody tell me what the reason is.....
Thanks