AnsweredAssumed Answered

About S32R374 Flash in release mode can't wirte

Question asked by piao bht on Jul 1, 2019
Latest reply on Jul 10, 2019 by Lukas Zadrapa

there is a question about s32r274 flash wirte and read.

Now I can wirte and read in debug mode,but when i change it to release mode, I can't wirte data to flash.

There is my code, it can work in debug mode .but it can't work in release mode,can you help me find where is wrong?

C55FMC.LOCK0.R &= 0xFFFEFFFF;
C55FMC.MCR.B.ERS = 1;
C55FMC.SEL0.R = 0x00010000; //select the mid block
*(unsigned int*)0x00800000 = 0xFFFFFFFF; //interlock write
*(unsigned int*)0x00800008 = 0xFFFFFFFF; //interlock write
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.ERS = 0;
C55FMC.MCR.B.PGM = 1;
*(unsigned int*)0x00800000 = offsetID_high;
*(unsigned int*)0x00800008 = offsetID_low;
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.PGM = 0;

Outcomes