About S32R374 Flash in release mode can't wirte

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About S32R374 Flash in release mode can't wirte

765 Views
bhtybyb
Contributor II

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;
0 Kudos
2 Replies

660 Views
shaileshagrahar
Contributor III

Hello Lukas,

I am facing the same issue with s32r274 flash write, as Piao Bht asked.

I mean to say "I can erase in debug mode(I am debugging step by step), but when i change it to release mode (free run GO in debugger), I can't erase data to flash and getting exception MachineCheck.

Note: I just have to erase only (I mean mean I want corrupt data).Is this fine I do not want write back any data.
C55FMC.LOCK2.R &= 0xFFFFFFFB;

 C55FMC.MCR.B.ERS = 1;
 C55FMC.SEL2.R |= 0x00000004;

 (*(uint32*) 0x010BFFC8) = 0xFFFFFFFF;
 
C55FMC.MCR.B.EHV = 1;
 while(C55FMC.MCR.B.DONE == 0);
 C55FMC.MCR.B.EHV = 0;
 C55FMC.MCR.B.ERS = 0;

Please help it is urgent ..

Thanks!

0 Kudos

660 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

which IDE and which version do you use?

I did quick test in S32 Design Studio v2017.R1 with latest update 11 installed and it works in both debug and release mode. I just copied your code to new empty project with no other changes.

Regards,

Lukas

0 Kudos