How to use MPC5748G Secure data flash

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use MPC5748G Secure data flash

504 Views
yuehedeng
Contributor III

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.

0 Kudos
3 Replies

65 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

pastedImage_1.png

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;

pastedImage_2.png

Regards,

Lukas

0 Kudos

65 Views
yuehedeng
Contributor III

So if configured as yours, then I can operate it as EEPROM? For example, multi-write same address without erase whole 16KB block?

0 Kudos

65 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

MPC5xxx does not have "true" EEPROM, we should not program non-erased double word.

pastedImage_1.png

EEPROM Emulation means this (this information seems to be missing in MPC5748G RM, so I copied it from MPC5604B RM):

pastedImage_2.png

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

0 Kudos