Hello,
Flash erase is not working for me with the MPC5777M.
I am using an example from MPC5748G-Flash_RW-SSD_GHS614 that I found on the forums. None of the following steps fail with an error and pFlashCheckStatus is returning with C55_DONE. However, it does not erase anything. I am trying to erase memory sector 0x09640000.
This is my code:
#define C55_REG_BASE 0xFFFE0000
#define MAIN_ARRAY_BASE 0x00404000
#define UTEST_ARRAY_BASE 0x00400000
#define C55_PROGRAMMABLE_SIZE 0x80
SSD_CONFIG ssdConfig = {
C55_REG_BASE, /* C55 control register base */
MAIN_ARRAY_BASE, /* base of main array */
{ 0, 0, 0 }, /* blocks info of low address space */
{ 0, 0, 0 }, /* blocks info of mid address space */
{ 0, 0, 0 }, /* blocks info of high address space */
0, /* number of blocks in 256K address space */
UTEST_ARRAY_BASE, /* base of UTEST array */
TRUE, /* interface flag indicate main or alternate interface */
C55_PROGRAMMABLE_SIZE,/* programmable size */
FALSE /* debug mode selection */
};
void func()
{
uint32_t returnCode = 0; /* Return code from each SSD function. */
uint32_t result = 0;
uint32_t lowBlockSelect, midBlockSelect, highBlockSelect;
CONTEXT_DATA CtxData;
N256K_BLOCK_SEL n256KBlockSelect;
// Flash Init
returnCode = pFlashInit(&ssdConfig);
if (C55_OK != returnCode)
{
return;
}
returnCode = pSetLock(&ssdConfig, C55_BLOCK_256K_FIRST, 0xFDFFFFFF);
if (C55_OK != returnCode)
{
return;
}
//erase the mid block
lowBlockSelect = 0x00000000;
midBlockSelect = 0x00000000;
highBlockSelect = 0x00000000;
n256KBlockSelect.first256KBlockSelect = 0x02000000;
n256KBlockSelect.second256KBlockSelect = 0x00000000;
returnCode = pFlashErase(&ssdConfig,
C55_ERASE_MAIN,
lowBlockSelect,
midBlockSelect,
highBlockSelect,
n256KBlockSelect);
if (C55_OK != returnCode)
{
return;
}
while(1)
{
returnCode = pFlashCheckStatus(&ssdConfig, C55_MODE_OP_ERASE,&result, &CtxData);
if(returnCode != C55_INPROGRESS)
{
break;
}
}
}
I have also done it in the following way after searching for information on the forums with similar results:
C55FMC.LOCK2.R = 0b11111101111111111111111111111111;
C55FMC.MCR.B.ERS = 1;
C55FMC.SEL2.R = 0b00000010000000000000000000000000;
*(unsigned int*)0x09640000 = 0xFFFFFFFF; //interlock write
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.ERS = 0;
Hi, I am afraid the address 0x09640000 is not specified within Flash memory map.