AnsweredAssumed Answered

Need to confirm whether the password is erased or not?

Question asked by Chandrasekar Krishnan on Oct 29, 2017
Latest reply on May 26, 2018 by oloo oloo

The below program only i dumped in MPC5644A Evaluation Kit. Here i not  used the address of password .*(unsigned int*)0xFFFDD8 = 0xFEEDFACE;    // write data within 128bit programming page
    *(unsigned int*)0xFFFDDC = 0xCAFEBEEF;    // write data within 128bit programming page

Then how it can be erased?

David Tosenovjan

void Flash_Program(void)
{
    unsigned int i;        

 

    //unlock shadow block
    FLASH_A.LMLR.R = 0xA1A11111;    //unlock register
    FLASH_A.LMLR.R = 0x000303FF;    //unlock shadow flash
    
    FLASH_A.SLMLR.R = 0xC3C33333;    //unlock register
    FLASH_A.SLMLR.R = 0x000303FF;    //unlock shadow flash
    
    //erase shadow flash
    FLASH_A.MCR.B.ERS = 1;
    *(unsigned int*)0x00FFC000 = 0xFFFFFFFF;    //interlock write - write any address in shadow block
    FLASH_A.MCR.B.EHV = 1;
    while(FLASH_A.MCR.B.DONE == 0){};
    FLASH_A.MCR.B.EHV = 0;
    FLASH_A.MCR.B.ERS = 0;    
    
    //confirm the shadow flash is erased
    for(i=0x00FFC000;i<0x00FFFFFF; i=i+4)
    {
        if(*(unsigned int*)i != 0xFFFFFFFF)
            while(1){};    //shadow flash not erased!
    }                
    
    //program shadow flash (restore default password and censoring information)
    FLASH_A.MCR.B.PGM = 1;    
    //program first 128bit page
    *(unsigned int*)0x00004000 = 10;    // write data within 128bit programming page
//    *(unsigned int*)0x00FFC002 = 12;    // write data within 128bit programming page
    FLASH_A.MCR.B.EHV = 1;                    // program page (words that were not written above will have default value 0xFFFF)
    while(FLASH_A.MCR.B.DONE == 0){};
    FLASH_A.MCR.B.EHV = 0;
    //program second 128bit page
    //*(unsigned int*)0xFFFDE0 = 0x55AA55AA;    // this uncensores the device
//    *(unsigned int*)0xFFFDE0 = 0xBABABABA;    // this censores the device    
//    FLASH_A.MCR.B.EHV = 1;                    // program page (words that were not written above will have default value 0xFFFF)
//    while(FLASH_A.MCR.B.DONE == 0){};
//    FLASH_A.MCR.B.EHV = 0;
    //end of program sequence
    FLASH_A.MCR.B.PGM = 0;
}

Outcomes