This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Unexpected reset while flash erase

Expert 1175 points
Other Parts Discussed in Thread: MSP430F5418

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

**Attention** This is a public forum