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.

MSP-EXP430FR5994: FRAM problem

Part Number: MSP-EXP430FR5994

Hello, I testing our evaluation board MSP-EXP430FR5994. I have problem with save variable into FRAM memory.

I used pragmas "#pragma NOINIT(x)" and "#pragma PERSISTENT(x)" and value is save to memory and when is devices reset or power off variable stay in memory. But when I debugging or upgrade the firmware, value is disappear. I need this for save config of device. With PERSISTEN is set tu default value (in my example to 10) and for NOINIT is set to 0xFFFF. Is any solution save any value to FRAM memory and stay value same before upgrade FW or debug? 

#pragma NOINIT(rstCount)
#pragma LOCATION(rstCount, 0x004400)
uint16_t rstCount;

#pragma PERSISTENT(rstCount2)
#pragma RETAIN(rstCount2)
uint16_t rstCount2 = 10;

uint16_t firstInit  = 1;

int main(void) {

  WDT_A_hold();    

    //Here is any clock init, wdg init, clock init and so on

    

    firstInit = 1;

    while(1){ 

      if(firstInit){

       firstInit = 0;

       rstCount++; 
       rstCount2++;

       //Posle data po UART0 
      EUSCI_A_UART0_transmitData(rstCount);

     }

  }

}

  • I tried to save my variable to "Information Memory" (Info A/B/C/D to address 001800h to 0019FFh)  and there is value is not disappear after power up, debugging and upgrade FW. But this part memory have only 4 x 128B size...

  • A PERSISTENT variable is required to have an initializer, and this value is always loaded when code is loaded. (It is stored as a loadable section, not unlike .text.)

    It sounds like what you want is NOINIT. The points of interest here:

    1) You need to make sure the downloader/debugger doesn't do a Mass Erase. In CCS, you need to set "Properties->Debug->MSP430 Flash Settings" to "Erase and download necessary sections" [or maybe it's "Replace written memory locations", I keep forgetting].

    2) Since it's NOINIT, you need a mechanism for detecting the first-time (or corruption, as far as that goes). In cases like this, I usually use a CRC.

    [Edit:

    3) For PERSISTENT, the linker sets up the MPU for you. For NOINIT, it (usually) doesn't. You may have to fiddle with the linker .cmd and/or the MPU Editor ("Build Settings->General->MPU" [tab]

    ]

  • Hello Bruce, thank you very much for your quick response.

    Yes, point 1 is jackpot :) And now it is working well. CRC is good mechanism for detection first-time inicialization. 

    Thank you again. Tomas. 

**Attention** This is a public forum