Hello experts
I have strange situation during erasing flash area
The EHV register was not set in the below code in the FlashErase.c
I saw below comments in the MPC5777C Reference Manual
All registers were correctly set, but I can not set the EHV register after like them.
My question is...
Why I can't set the EHV ?
Is there another pre-condition to set the EHV register ?
Or is there anything to prevent set the register ?
Thank you
Hi,
what about piece of simple code like this? Is this working?
//unlock block 0x00FC_0000 - 0x00FF_FFFF
C55FMC.LOCK2.R &= 0x7FFFFFFF;
//erase the block
C55FMC.MCR.B.ERS = 1;
C55FMC.SEL0.R = 0x80000000; //select the block
*(unsigned int*)0x00FC0000 = 0xFFFFFFFF; //interlock write
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.ERS = 0;
//program one page in the block
C55FMC.MCR.B.PGM = 1;
*(unsigned int*)0x00FC0000 = 0x11111111;
*(unsigned int*)0x00FC0004 = 0x22222222;
*(unsigned int*)0x00FC0008 = 0x33333333;
*(unsigned int*)0x00FC000C = 0x44444444;
*(unsigned int*)0x00FC0010 = 0x55555555;
*(unsigned int*)0x00FC0014 = 0x66666666;
*(unsigned int*)0x00FC0018 = 0x77777777;
*(unsigned int*)0x00FC001C = 0x88888888;
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.PGM = 0;
Regards,
Lukas