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.

Data store in FRAM of RF430FRL152H

Other Parts Discussed in Thread: RF430FRL152H

Hi,

I'd like to store the non-volatil password data in FRAM or possible another areas of RF430FRL152H by custom command.

Would it be possible to use this?

If yes, please provide the sample code how to adapt it?

Thanks.

  • To declare a variable in FRAM or in RAM the following code is needed using CCS:

    #define PASSWORD_ADDRESS 0xF8B0 // define of the address of the array, this defines the address of the variable
    #pragma RETAIN(password_register); // prevent compiler optimization out if not referenced, maybe optional
    #pragma location = PASSWORD_ADDRESS; // set the the location of the address
    const u16_t password_register; // the actual variable, can be made smaller or larger as needed

    Then in the custom command function, to store the password simply set it:
    password_register = 0xAAAA;

    As to the location of the password I would recommend to check the .txt and .map file to find free memory and then use it.
  • Alex,
    Thank your for your answer!

    Could you be more specific?
    I have no idea how to read/write the defined PASSWORD_ADDRESS.
  • You need to include the four firmware lines in your .c file. The PASSWORD_ADDRESS is a constant defining the location that the variable is located (example given as 0xF8B0, which you can change but it can stay the same).

    To be able to read and write to this address simply read and write to the "password_register" variable as needed. The result will be stored in the chosen address.
  • Alex,

    When the "password_register" was declared by "const u16_t password_register", there was a compile error happened like "#138-D expression must be a modifiable lvalue" So I couldn't test.

    When the "password_register" was declared by "u16_t password_register", there was no compile error. But the "password_register" value was '0' after power off and on.

    What do I miss?

  • Yes the const should have not been included.

    However to make a variable not be initialized on startup, use this pragma directive:

    #pragma NOINIT( password_register);

    Include it somewhere before you declare the password register.

  • Alex,

    It is working well after inserting "#pragma NOINIT( password_register);"

    Thanks a lot!