Hello.
In MPC5748G memory, there are two secure data flash block. When I failed to write data into it. Is there any special configuration before access them? Could I use them as EEPROM? I will appreciate it if anyone can share information or reference documents to me.
Hi,
If the HSM exclusive access is not configured, the blocks can be used. I used this piece of code for test and I can see that it works as expected:
//unlock blocks 0x00F8_0000 - 0x00F8_7FFF
C55FMC.LOCK1.R &= 0xFFFC;
//erase the blocks
C55FMC.MCR.B.ERS = 1;
C55FMC.SEL1.R = 0x0003; //select the blocks
*(unsigned int*)0x00F80000 = 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 0xF8_0000-0xF8_3FFF
C55FMC.MCR.B.PGM = 1;
*(unsigned int*)0x00F80000 = 0x11111111;
*(unsigned int*)0x00F80004 = 0x22222222;
*(unsigned int*)0x00F80008 = 0x33333333;
*(unsigned int*)0x00F8000C = 0x44444444;
*(unsigned int*)0x00F80010 = 0x55555555;
*(unsigned int*)0x00F80014 = 0x66666666;
*(unsigned int*)0x00F80018 = 0x77777777;
*(unsigned int*)0x00F8001C = 0x88888888;
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.PGM = 0;
//program one page in the block 0xF8_4000-0xF8_7FFF
C55FMC.MCR.B.PGM = 1;
*(unsigned int*)0x00F84000 = 0x11111111;
*(unsigned int*)0x00F84004 = 0x22222222;
*(unsigned int*)0x00F84008 = 0x33333333;
*(unsigned int*)0x00F8400C = 0x44444444;
*(unsigned int*)0x00F84010 = 0x55555555;
*(unsigned int*)0x00F84014 = 0x66666666;
*(unsigned int*)0x00F84018 = 0x77777777;
*(unsigned int*)0x00F8401C = 0x88888888;
C55FMC.MCR.B.EHV = 1;
while(C55FMC.MCR.B.DONE == 0);
C55FMC.MCR.B.EHV = 0;
C55FMC.MCR.B.PGM = 0;
Regards,
Lukas
So if configured as yours, then I can operate it as EEPROM? For example, multi-write same address without erase whole 16KB block?
MPC5xxx does not have "true" EEPROM, we should not program non-erased double word.
EEPROM Emulation means this (this information seems to be missing in MPC5748G RM, so I copied it from MPC5604B RM):
To make it easier, we provide EEPROM Emulation driver:
http://www.nxp.com/assets/downloads/data/en/device-drivers/MPC5xxx_EEE_DRIVER.exe
Regards,
Lukas