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.

CCS/MSP430G2553: Store DATA in Flash memory without erase user program

Part Number: MSP430G2553
Other Parts Discussed in Thread: MSP430WARE

Tool/software: Code Composer Studio

HI

I need to store data ( 3 or 4 words maxi ) in non volatile memory of the MSP430G. When some parameters change on my application I need to store them with the user program. (then read them after a power on )

How can do that and to be sure to write these data and to be sure to not over write my user program ? (assume my user program don't use all the range of flash memory)

Regards

Olivier

  • Hi Olivier,
    you need to define a dedicated section in your linker command file where the compile is not allowed to place code.
    This address space is than used for the pointer you use for erase and programming. Ideally you define a dedicated segment for it to only erase this segment before your write.
    Example for flash writing is in msp430ware example "msp430g2xx3_flashwrite_01.c"
  • Information memory is a good place for this.  It's separate from the MAIN memory block.  INFOA is used for calibration data, but you can individually erase and write to INFOB, INFOC and INFOD, which are 64 bytes each.  Instead of erasing each time you change parameters, you can write successive sets of paramters without erasing after finding where the last set was written, which is just before the 0xFF erased bytes.  Then you only need to erase and start over when INFOB is nearly filled up.  However, INFOB-INFOD is typically erased when you flash new firmware to MAIN memory, so in that case the previous session parameters would be lost.

  • If I understand correctly, the user program is not written in INFOB until INFOD ?
  • I would say that user code is not typically written for INFOB-D. It is possible to put code there, but I believe the great majority of coders do not do that. And I think TI's intended use of INFO memory is the one you described - storing values between runs.
  • I agree to the proposal from Geroge Info D- B is mainly intended to be used to store calibration data or serial numbers and is often used by customers for the purpose you want to use it.

    However you have to take care on Info D segment where TI is programming a production record which indicates the was tested correclty. Therefore I recommend always a segment ERASE before your program data to a segment.

    Does the guidance in this thread helped to solve you problems? IF yes please mark it as resolved so that this thread can be closed.

**Attention** This is a public forum