Does someone have the example of the program operation in Flash of MPC5675K ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does someone have the example of the program operation in Flash of MPC5675K ?

581 Views
小兜麦
Contributor II

Hello!

     Does someone have the example of the program operation in Flash of MPC5675K ?

     I want to do the unlock and the erase operation,and then I will do program operation to write some data to the specified address.How can I do this?

I hope you can give me some examples about this!

    Thank you !

 

 

 

   Xiaodou Mai

Labels (1)
0 Kudos
2 Replies

453 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I found this piece of code in my repository:

/* unlock all blocks in bank 0 (0x0000_0000 - 0x0017_FFFF) */

  CFLASH_0.LML.R = 0xA1A11111; /* write password */

  CFLASH_0.LML.R = 0x00100000; /* unlock low and mid blocks primary */

  CFLASH_0.SLL.R = 0xC3C33333; /* write password */

  CFLASH_0.SLL.R = 0x00100000; /* unlock low and mid blocks secondary */

    CFLASH_0.HBL.R = 0xB2B22222; /* write password */

    CFLASH_0.HBL.R = 0x00000000;  /* unlock high blocks */

    

    /* erase block B0F3 (0x0001_0000 - 0x0001_7FFF) */

    CFLASH_0.MCR.B.ERS = 1;

    CFLASH_0.LMS.R = 0x00000008; /* select B0F3 */

    *(unsigned int *)0x00010000 = 0xFFFFFFFF; /* interlock write - write to any address in selected memory */

    CFLASH_0.MCR.B.EHV = 1;

    while(CFLASH_0.MCR.B.DONE == 0);

    CFLASH_0.MCR.B.EHV = 0;

    CFLASH_0.MCR.B.ERS = 0;

    

    /* program double word to B0F3 */

    CFLASH_0.MCR.B.PGM = 1;

    *(unsigned int *)0x00010000 = 0xAAAABBBB; /* interlock write */

    *(unsigned int *)0x00010004 = 0xCCCCDDDD; /* program data write */

    CFLASH_0.MCR.B.EHV = 1;

    while(CFLASH_0.MCR.B.DONE == 0);

    CFLASH_0.MCR.B.EHV = 0;

    CFLASH_0.MCR.B.PGM = 0;

Regards,

Lukas

0 Kudos

453 Views
小兜麦
Contributor II

Hi,lukaszadrapa

thank you ! Do you know the difference between Lock-step mode and Decouple core mode?why can not I operate my codes in Lock-step mode instead of suceeding in doing this in Decouple Parallel mode?

0 Kudos