在对MPC5642A芯片FLASH中的L6和L7块擦除后,查看s19文件,对应的区域全是0,不是1,请论坛里的大神不吝赐教呀
擦除代码如下
void FlashEraseAll()
{
/*********Init********/
/* write the passwords*/
FLASH_A.LMLR.R=0xA1A11111;
FLASH_A.SLMLR.R=0xC3C33333;
FLASH_A.HLR.R=0xB2B22222;
/* unlock blosks we want to erash. FLASH_A:L6,L7*/
FLASH_A.LMLR.R=0x8013033F;
FLASH_A.SLMLR.R=0x8013033F;
/*Clear MCR*/
FLASH_A.MCR.R=0;
/*********Erash********/
/**Erash FLASH_A**/
/* Set MCR ERS bit */
FLASH_A.MCR.B.ERS = 1;
/* FLASH_A:L6,L7 are selected for erase */
FLASH_A.LMSR.R=0x000000C0;
/* Interlock write */
*(uint32*)(0x00018000) = 0xFFFFFFFF;
*(uint32*)(0x0001C000) = 0xFFFFFFFF;
/* Set MCR EHV bit */
FLASH_A.MCR.B.EHV=1;
while(FLASH_A.MCR.B.DONE==0){
}
if(FLASH_A.MCR.B.PEG==1)
{
FLASH_A.MCR.B.ERS=0;
FLASH_A.MCR.B.EHV=0;
}
while(1)
{
}
} |