I can't set EHV when erase flash area

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

I can't set EHV when erase flash area

504 Views
jaejynshin
Contributor III

Hello experts

I have strange situation during erasing flash area

The EHV register was not set in the below code in the FlashErase.c

175915_175915.pngpastedImage_3.png

 

I saw below comments in the MPC5777C Reference Manual

175914_175914.pngpastedImage_2.png

 

All registers were correctly set, but I can not set the EHV register after like them.

175913_175913.pngpastedImage_1.png

 

 

 

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

Labels (1)
0 Kudos
1 Reply

391 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

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

0 Kudos