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.

Can not write the data on same address in information memory(flash)

Other Parts Discussed in Thread: MSP430F2370

I am not able to write data 2 times on the same address,

I am trying to write 0x05 and 0x07 one after another on 0x1042.

But at the end data i found on 0x1042 is 0x05,instead of 0x07.

I am trying this code on MSP430F2370.

Code:


    WDTCTL = WDTPW + WDTHOLD;            // stop watchdog timer

    Flash_ptr = (unsigned char *) 0x1042;


    BCSCTL1 = CALBC1_1MHZ;                    // Set DCO to 1MHz
    DCOCTL = CALDCO_1MHZ;
    FCTL2 = FWKEY + FSSEL0 + FN1;             // MCLK/3 for Flash Timing Generator


    while(FCTL3 & 0x0001 == BUSY);

    FCTL3 = FWKEY;                            // Clear Lock bit
    FCTL1 = FWKEY + WRT;                      // Set WRT bit for write operation

    *Flash_ptr = 0x05;                   // Write value to flash

    while(FCTL3 & 0x0001 == BUSY);
    FCTL1 = FWKEY;                            // Clear WRT bit
    FCTL3 = FWKEY + LOCK;

    _delay_cycles(9000000);

    while(FCTL3 & 0x0001 == BUSY);

    FCTL3 = FWKEY;                            // Clear Lock bit
    FCTL1 = FWKEY + WRT;                      // Set WRT bit for write operation

    *Flash_ptr = 0x07;                   // Write value to flash

    while(FCTL3 & 0x0001 == BUSY);
    FCTL1 = FWKEY;                            // Clear WRT bit
    FCTL3 = FWKEY + LOCK;

     while(1);

**Attention** This is a public forum