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.

Erasing INFO memory when code is executing out of Flash

Other Parts Discussed in Thread: MSP430F5438A

Hello E2E,

I am after confirmation on what is the correct source of information with regards to erasing INFO memory.

I am using a MSP430F5438A and want to maintain a variable across an firmware upgrade. I plan to use INFO memory because I will be using the BSL to mass erase and program code memory.

According to slau208m, section 7.3, "The flash memory allows execution of a program from flash while a different flash bank is erased" and according to table 7-1, you can only "Bank Erase" when executing from flash. Also, in section 7.3.1.3, it says "The information memory A to D and the BSL segments A to D can only be erased in segment erase mode."

I assume this means that you cannot erase INFO memory while executing from Flash.

However, when looking at your sample code in slac375d, both msp430x54xA_flashwrite_01.c and msp430x54xA_flashwrite_02.c does this.

Which is the recommended way to erase INFO memory?

Regards,

Pak

  • Pak Woon said:
    I assume this means that you cannot erase INFO memory while executing from Flash.

    That is a wrong assumption. It can be done, I am doing it on the MSP4305438 (non-A) device.

    Pak Woon said:
    Which is the recommended way to erase INFO memory?

    I use something like this....

    ATOMIC_FUNCTION void flashOverwriteInfoSegment(
        UINT16_FAR_POINTER flashInfoSegPtr,
        unsigned char * data)
    {
      // erase the sector
      FCTL3 = FWKEY; // Clear the lock
      FCTL1 = FWKEY + ERASE; // Enable the segment erase
      *flashInfoSegPtr = 0xffff;
      while ((FCTL3 & BUSY) != 0)
        ;
      FCTL3 = FWKEY + LOCK; // Set the lock

      // write the new sector
      flashWrite(flashInfoSegPtr, (unsigned*)data, 128);

    }
  • Pak Woon said:
    I assume this means that you cannot erase INFO memory while executing from Flash.

    More or less. 'executing from flash' actually means 'the CPU can continue with its work whiel hte erase is in progress'. This is new. (and won't work on some MSPs, see the device errata sheet)

    Normally, while an erase or write operation is performed, teh CPU will fetch a dummy 'JMP $' operation from flash, 'jumping on place' until the write/erase is complete. However, teh code that starts the erase/write may well be in flash. (exception: block write mode, since the FLASH won't be accessible until block write ends, and it won't end if the CPU doesn't continue writing the block)

**Attention** This is a public forum