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.

MSP430FR2355: Writing to the FRAM does not work.

Part Number: MSP430FR2355

I want to save some variables for the program start. I put the following code:

    SYSCFG0 = FRWPPW | DFWP;
    myCharVariableInFRAM = 123;
    SYSCFG0 = FRWPPW | PFWP | DFWP;

In the debugger you can see how the SYSCFG0 register is changed. But the content on the address of the variable remains unchanged. It can also not be changed with the debugger in the "Memory Browser".

Can someone write which conditions must still be fulfilled for writing?
Thanks a lot for the support.

  • Hi Hardy,

    I would recommend looking at this example code to get the full example and requirements to unlock and write.

    What memory address are you trying to write to? You are locking the data information section so the main section would be unlocked to write too. The program memory is from 0x8000 - 0xFFFF.

    Regards,

    Luke

  • Hi Luke,

    thank you for your thought.
    To me it looks like the same code is used in the example as I use. One could think that it is because of the address range. The linker has set the variable to 0x8000. By the way, I have already tried SYSCFG0 = FRWPPW; for unlocking. Then, according to the description, the whole FRAM should be unlocked. However, a write was not possible by program or debugger. Are there any other requirements for writing than the SYSCFG0 register? Is it easier if one uses the information memory?
    Many greetings
    Hardy

  • Hi Hardy,

    It depends on your application, most often if you want to save calibration or some specific data I would recommend the information memory. The program memory will also contain your main so you have to be careful of the address of your variable or you can get unexpected results.

    Writing to the memory from the debugger can also be tricky as the unlock needs to be written in 1 step, and reading the FRWPPW register will always read 0x96. You would need to write 0xA500 to the whole SYSCFG0 register or 0xA5 to the FRWPPW field to unlock the whole thing.

    I suggest using the example code and change the code to write to where you want to in your application then compare what the example is doing to your code.

    It looks to me that the variable "myCharVariableInFRAM" is just a normal variable. You would want a pointer variable to be a specific location in memory then dereference the pointer to assign the value of 123 so it gets stored in the address. Similar to FRAM_write_ptr and how it is operating in the FRAMWrite function. 

    Regards,

    Luke

  • Unfortunately, the behavior does not change even with the sample code. There must be other dependencies.

  • The problem was the ACCTEIFG bit was set. I have revised the configuration of the clock generation. Now also the writing into the FRAM works.
    Many thanks to luke.

**Attention** This is a public forum