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
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
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?