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.

MSP430FR2311: FRAM variable writes

Part Number: MSP430FR2311

I've been reading through the documentation and out of box example code for FRAM, but there are still a few things that are not clear.

I know that if I want a variable to be stored in FRAM i need to add the following for each variable:

#pragma PERSISTENT(variable_name)

Then whenever I write to that variable I need to disable the memory protection temporarily.

    //Get previous write protection setting
uint8_t state = HWREG8(SYS_BASE + OFS_SYSCFG0_L);
#ifdef DFWP
    uint8_t wp = DFWP | PFWP;
#else
    uint8_t wp = PFWP;
#endif

#ifdef FRWPPW
    HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | (state & ~wp);
#else
    HWREG8(SYS_BASE + OFS_SYSCFG0_L) &= ~wp;
#endif

variable_name = 1;

    //Restore previous write protection setting
#ifdef FRWPPW
    HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | state;
#else
    HWREG8(SYS_BASE + OFS_SYSCFG0_L) = state;
#endif

What remains unclear is supposedly you can see if memory protection is enable in CCS by going to Properties -> General.  However, I don't see it there.  I just want to be able to verify that the memory protection is turned on.  Please correct me if any of the previous steps or assumptions are incorrect.

Thanks

**Attention** This is a public forum