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.

MSP430I2041: Explain "A flash word (high and low byte) must not be written more than twice between erasures"?

Part Number: MSP430I2041

Support,

In the MSP430x2xx Family User's Guide, section 7.3.3, Writing Flash Memory, 2nd paragraph.  Can you explain what is meant by, "A Flash word (high and low Byte) must not be written more than twice between erasures"?

I was under the impression that any time you write to Flash, the block or segment must be read into RAM, modified, and written back.  Am I misunderstanding something?

What 

Regards,

Marc

  • Hi Marc,

    Your impression is correct, and the reason for it is that writing to flash multiple times without erasing it can cause damage. So, read the block or segment into flash, you need to erase the memory at that location in flash, modify it in RAM, and write it back. The User's Guide is simply stating that you could write to flash twice without erasing it before you cause any damage. It is of course better practice to erase the flash and follow the procedure you stated every time that you write to flash.

    Regards,
    Nathan
  • Some kinds of flash can be written multiple times (between erases), which allows techniques like writing successive bits to 0 (FE, FC,F8,...,00).

    The note is there to tell you that this is not that kind of flash.
  • Nathan,

    Does the MSP Flash API take care of this or do you need to make a custom, 'check' function to ensure you avoid the double write.

    If it is only possible to write a 1 --> 0, i could only see it used Bruce mentions. Some sort of 'flag' bit where the MSP toggles a bit from 1 to 0.

    Am i correct, that the safe way to implement is:
    * do not write individual byte/words to FLASH
    * always use typical method: read FLASH into RAM, modify, write back to FLASH using segment programming.
  • Hi Marc,

    Yes, the APIs should take care of this. And your assumption is correct, that will ensure that the data is not corrupted.

    Regards,
    Nathan

**Attention** This is a public forum