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: Writing data to flash memory

Part Number: MSP430I2041
Other Parts Discussed in Thread: MSP430FR2000

Hello ,

As we are trying to write data into flash memory at location 0xF800(i.e. Segment 1) .

As our requirement to write the live data to same location periodically to same location(0xF800),but 1st time only correct data is write & after that data is not correctly write that location.

So my question is that Is it required to erase the memory every time before writing the data to memory? n if yes then how we can erase single segment?

Thanks,

Ashwini

  • Hi Ashwini,

    As we are trying to write data into flash memory at location 0xF800(i.e. Segment 1) .

    Make sure this location has been specified as a data section (not a code section) in your linker file. You definitely don't want to store data there and overwrite your code.

    As our requirement to write the live data to same location periodically to same location(0xF800),but 1st time only correct data is write & after that data is not correctly write that location.

    Due to the limited number of Flash read/write (typically 10^5) cycles, you'll want to implement a memory wear balancing algorithm. This may depend on how often you are reading/writing to the memory. Our FRAM devices support many more read/write cycles, so you could always add one like the MSP430FR2000 to your design for data logging purposes if needed.

    So my question is that Is it required to erase the memory every time before writing the data to memory? n if yes then how we can erase single segment?

    Yes, each bit can be programmed from 1 to 0 individually but to reprogram from 0 to 1 requires an erase cycle. Any erase is initiated by a dummy write into the address range to be erased. The dummy write starts the flash timing generator and the erase operation. More details about this process can be found in the Erasing Flash Memory section in the MSP430i20xx Family User's Guide.

    Other helpful resources include the MSP430 Flash Memory Characteristics app note and following thread.

    CCS/MSP430I2041: How to erase flash memory

  • Hello James,
    Thanks for your reply it solved our problem.
    There is another query from us as we want to detect power failure condition .
    For that we are monitoring VMONIFG flag but we are using it with internal DVCC voltage reference to compare .
    As there is example of external voltage m (VMONIN Pin)reference is available ,but there is no example on how to use DVCC .
    Can you please guide us how we can use it?
    Thanks & Regards,
    Ashwini Jadhav
  • Hello,

    I'll address your latest question in the other thread you created. Please mark this thread resolved.

    MSP430I2041: How to monitor DVCC for power failure

**Attention** This is a public forum