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.

MSP430FR2433: Configuration Data store in flash or EEPROM

Part Number: MSP430FR2433


Hi

I am working with MSP430FR2433 device for the develop a small foot-print application which will control the Celling Fan with IR Remote. I have to store some value into the EEPROM or Flash Memory of the MCU to compare and take action with those value. Basically In IR Remote There are switch for 1, 2, 3, 4 Hour Sleep Mode, So I have to store this hour value into the memory so if MCU got reboot or power went off, I can retrieve those value and start the process. 

Can you suggest me how can I store this information into Flash Memory Or Any better option for this scenario. 

  • you can use eeprom to store the data. when the mcu starts recall that data before any execution

  • Hi, 

    Thank you for the reply.

    On-board there is no EEPROM option available, how to store the data into the MCU EEPROM

  • you can use external eeprom

  • Hi,

    Can we write the data to the FRAM ?

  • yes you can, but keep in mind about clock frequency, variable length and some of the bits to be set. i suggest you to go through the sample code

  • Hi.

    Can you share the sample code. I couldn't find anywhere so far for that.

    How we can select the memory address ?

  • Go through the device specific datasheet

  • If your config data can fit into 512 bytes, your best bet is to use Information ("Data") FRAM, since it's protected separately from Program (everything else) FRAM. The linker .cmd file defines a section ".infoA" which is placed there, so try something like:

    #pragma DATA_SECTION(config_data, ".infoA") // .infoA >INFOA from .cmd file
    unsigned config_data[512/2];
    

    To write to this area you need to turn off (then back on) Write Protection, something like:

        SYSCFG0 = FRWPPW | PFWP;    // DFWP=0 to write to Information (Data) FRAM
        config_data[0] = 0x8877;
        SYSCFG0 = FRWPPW | PFWP | DFWP; // DFWP=1

    You should probably check that your Erase settings ("Properties->Debug->MSP430 Flash Settings->Erase Options") are set to "main memory only". This is the default, but it's worth checking to be sure.

  • Hi,

    Thank you for your reply.

    It's very helpful information about the FRAM. 

    as I understood, I have added below code into main.c for the buffer and segment load into .cmd file but some point are not clear.

    #pragma DATA_SECTION(config_data, ".infoA") // .infoA >INFOA from .cmd file
    unsigned config_data[512/2];

    How about the memory starting address ?, Or It will store the sequency from the @config_data. i.e config_data[0],config_data[1] etc.

    How do I retrieve these information from the FRAM.

  • In your Project's lnk_msp430fr2433.cmd, you can see that the section ".infoA" is put into memory region "INFOA",

    >  .infoA (NOLOAD) : {} > INFOA /* MSP430 INFO FRAM Memory segments */

    which is defined (at the top of the file) to start at address 0x1800,

    >  INFOA : origin = 0x1800, length = 0x0200

    which is where Information FRAM is located [Ref data sheet (SLASE59D) Table 6-23]. 

    -----------

    Writing a variable in Information FRAM requires disabling the Write Protection, but you can read it just like any other variable, e.g.

    > unsigned first_config_word = config_data[0];

    Of course, I just invented the config_data[] array. It doesn't have to be an array, and it doesn't even have to be 512 bytes long. I do suggest (as a design thing) that you use a single struct or array to map all of your configuration data, so the data items don't move around as your program grows.

  • Hi,

    Alright I understood and it's working too. Thank you for your support and suggestion for the design.

    FRAM Have any special limitation or need to be take-care while writing or reading except for FRAM requires disabling the Write Protection option. ?

  • I can't think of any particular FRAM limitations beyond Write Protection (which is really more of a Feature than a Limitation). I'm pretty sure your Use Case is exactly what Information Memory was invented for.

    I'll mention here that (due to "(NOLOAD)" above) Information FRAM will not be changed by downloading new code (also a Feature in most cases), and thus will be in an unknown state (probably 0xFF-s, but no guarantees) the first time your program executes. It's up to you to detect this condition, though I'll point out that this is just a special case of (accidental) config-data corruption. detectable using a suitable checksum/CRC.

  • Hi.

    Thank you for your suggestion. it's help more on FRAM.

    I am marking this thread as resolved.

**Attention** This is a public forum