Hello
Regards.
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.
Hello
Regards.
I have a question with FRAM writing.
Now I am executing the following program. Since I set a segment and write is prohibited, I think that I can not write it, but if I do it, I can write to the FRAM area. I think that the Write Enable bit is 0 so it is write-protected. I do not know where is wrong. I'm sorry but please tell me.
# pragma RETAIN (Tname)
# pragma DATA_SECTION (Tname, ". infoD");
const char Tname [8] = "trout";
# pragma RETAIN (Udata)
# pragma DATA_SECTION (Udata, ". infoD");
# pragma LOCATION (Udata, 0x4400)
int Udata [64] [8] = {,};
main ()
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
MPUCTL 0 = MPUPW; // Write PWD to access MPU registers
MPUSEGB 1 = 0 × 1000; // B 1 = 0 × 10000; B 2 = 0 × 1 A 000
MPUSEGB 2 = 0 × 1 A 00; // Borders are assigned to segments
MPUSAM = MPUSEG 1 RE | MPUSEG 1 XE | MPUSEG 1 WE |
MPUSEG 2 RE | MPUSEG 2 XE | MPUSEG 2 WE |
MPUSEG3RE | MPUSEG3XE |
MPUSEGIRE | MPUSEGIWE | MPUSEGIXE;
MPUSAM & = ~ MPUSEG1 WE; // Write disable
MPUSAM & = ~ MPUSEG 2 WE; // Write disable
When this is done, data is written from 0x4400.
Is this correct?
Regards.
Hello,
You need to set the MPUENA bit to enable protection:
MPUCTL0 = MPUPW | MPUENA;
Best regards
Lukas
**Attention** This is a public forum