Hello!
Why can`t I write 0x12345678 twice continuously to flash code memory? But I can do this in data memory!
Does someone know how to do this ?
Thank you !
Xiaodou Mai
Hi,
this is copied from reference manual (http://www.freescale.com/files/32bit/doc/ref_manual/MPC5675KRM.pdf):
“For the code flash memory module, word size is fixed at 64 bits. Each 64-bit doubleword is associated with 8 ECC bits that are programmed to enable a Single-bit Error Correction and a Double-bit Error Detection (SECDED).
For the data flash memory module, word size is fixed at 32 bits. Each 32-bit word is associated with 7 ECC bits that are programmed to enable SECDED.”
That means we are allowed to program doubleword only once per erase. In other words, we should not program double word which is not fully erased.
So, we should program the data in this way to code flash:
FLASH_A.MCR.B.PGM = 1;
*(unsigned int*)0x1000 = 0x12345678;
*(unsigned int*)0x1004 = 0x12345678;
FLASH_A.MCR.B.EHV = 1;
while(FLASH_A.MCR.B.DONE == 0){};
FLASH_A.MCR.B.EHV = 0;
FLASH_A.MCR.B.PGM = 0;
If the data are programmed in two steps then it leads to ECC error.
Regards,
Lukas
Hi,
Thank for your great answer!
I want to program doubleword continuously to Mid/High Address Space.And I have read the datasheet of 5675K and it said "The first (lower addresses) 16 bytes (128 bits) of every 32-byte aligned range are stored in CFM0 and the last 16 bytes
(128 bits) are stored in CFM1".What do I do to program more than 16 bytes to Mid/High Address Space in 5675K?
Can you give me the similar code example?
I wish your answer,sir.
Thank you!
Hi,
//CMF0
FLASH_A.MCR.B.PGM = 1;
*(unsigned int*)0x00080000 = 0x12345678;
*(unsigned int*)0x00080004 = 0x12345678;
FLASH_A.MCR.B.EHV = 1;
while(FLASH_A.MCR.B.DONE == 0){};
FLASH_A.MCR.B.EHV = 0;
FLASH_A.MCR.B.PGM = 0;
FLASH_A.MCR.B.PGM = 1;
*(unsigned int*)0x00080008 = 0x12345678;
*(unsigned int*)0x0008000C = 0x12345678;
FLASH_A.MCR.B.EHV = 1;
while(FLASH_A.MCR.B.DONE == 0){};
FLASH_A.MCR.B.EHV = 0;
FLASH_A.MCR.B.PGM = 0;
//CMF1
FLASH_B.MCR.B.PGM = 1;
*(unsigned int*)0x00080010 = 0x12345678;
*(unsigned int*)0x00080014 = 0x12345678;
FLASH_B.MCR.B.EHV = 1;
while(FLASH_B.MCR.B.DONE == 0){};
FLASH_B.MCR.B.EHV = 0;
FLASH_B.MCR.B.PGM = 0;
FLASH_B.MCR.B.PGM = 1;
*(unsigned int*)0x00080018 = 0x12345678;
*(unsigned int*)0x0008001C = 0x12345678;
FLASH_B.MCR.B.EHV = 1;
while(FLASH_B.MCR.B.DONE == 0){};
FLASH_B.MCR.B.EHV = 0;
FLASH_B.MCR.B.PGM = 0;
And then continue in the same way.
Next option is to use SSD flash drivers:
http://www.freescale.com/files/32bit/software/MPC567xK_C90LC_Flash_SSD.exe
When using the drivers, you do not need to take care about the blocks, everything is managed by the drivers.
Regards,
Lukas
Could you tell me how to use the c-array_driver as provided in Standard Software C90LC Driver v1.0.4. Besides, I want to use the driver in the S32DS IDE, where can I find the lib files?
Hi,
Thank you again!
I want to operate software system reset at the end of my program. I cant not make sure which register can generate a software system reset.Can you give me the example code?
Regards,
xiaodou Mai
Hi,
Yesterday I made the same question by myself, and David Tosenovjan replied here:
Does MPC5606B support software reset?
I hope it will be usefull for you too.
Regards,
Thank you very much!Your answer gave me much assistance!
Hi,
I'm trying to do a system reset at the end of my program too. Did ypu finally get it?
Thanks,