I use MK60FX512VLQ15
I want to set partition that data 448K, eeprom 8K.
So, I did cording like it.But it has error.
How can I solve this problem?
Ah. EEPROM start at 0x14000000 right?
When I read or write data into EEPROM range, mcu is freesing.
main()
{
...
InitFlexMem ();
...
}
void InitFlexMem (void)
{
//FTFE_erase_all_block(); DFLASH_SIZE_448 0x04, #define EEPROM_8K_8K 0x30
EEP_init = DEFlashPartition(EEPROM_8K_8K,DFLASH_SIZE_448); // EEPROM Data size : 16Kbyte , Data Flash size : 448Kbyte , EEP_init=0 :already partition,EEP_init=1 :no partition
}
byte DEFlashPartition(byte EEPDataSizeCode,byte DEPartitionCode)
{
byte alreadypartition;
if ((SIM_FCFG1 & SIM_FCFG1_DEPART(0xF)) != 0x00000F00)
{
alreadypartition=0;
printf("\nDevice is already partitioned.\n");
}
else
{
FTFE_FCCOB0 = PROGRAM_PARTITION;
FTFE_FCCOB1 = 0x00;
FTFE_FCCOB2 = 0x00;
FTFE_FCCOB3 = 0x00;
// FCCOB4 is written with the code for the subsystem sizes (eeprom_size define)
FTFE_FCCOB4 = EEPDataSizeCode; //EEPROM 2K : 2K = 4Kbyte
// FFCOB5 is written with the code for the Dflash size (dflash_size define)
FTFE_FCCOB5 = DEPartitionCode; //Data flash Size : 448K, EEPROM-backup Size :64K
// All required FCCOBx registers are written, so launch the command
FTFE_FSTAT = FTFE_FSTAT_CCIF_MASK; //->this line is occured ACCERR
// Wait for the command to complete
while(!(FTFE_FSTAT & FTFE_FSTAT_CCIF_MASK));
//FTFE_FSTAT = 0xFF;
alreadypartition=1;
}
// All required FCCOBx registers are written, so launch the command
FTFE_FSTAT |= FTFE_FSTAT_CCIF_MASK;
// Wait for the command to complete
while(!(FTFE_FSTAT & FTFE_FSTAT_CCIF_MASK));
//FTFE_FSTAT = 0xFF;
return alreadypartition;
}
Hi Kwon,
Thank you for your interest in our kinetis products!
If you want to set partition that data 448K, eeprom 8K.
You should choose EEPROM_8K_8K = 0x31, DFLASH_SIZE_448= 0x04.
I have a project based on CW, you can refer to it, please find in the attachment.
You should do a mass erase at first, then run my code from the RAM.
But you should keep in mind, your EEPROM backup size is too much small, our reference manual says: The EEPROM backup size must be at least 16 times the EEPROM partition size in FlexRAM.
So, you need to enlarge your eeprom backup size.
Wish my answer will help you!
If you still have quesiton, please let me know!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Jingjing,
What reference manual are you using? Is there an update in the works that isn't on the public website yet? I have been looking at
Document Number: K60P144M150SF3RM
Rev. 3, November 2014
for info about MK60FX512VLQ15.
The table it shows there is different and therefore confusing. I looked on the website to get the newest version, but I still end up getting the same file when I download it. What you posted makes more sense.
Hi dmitryic,
You should refer to K60P144M150SF3RM.pdf, Rev. 3, November 2014, this is the newest.
The picture which I post is from Rev. 2, Dec 2011, that is the old document(at that time, the rev3 is not launched), it have bugs, so now, you should refer to rev3.
Regards,
Jingjing
Hi Jingjing,
That chip has 512K of FlexNVM. The newer document only describes allocating between 0 and 256K. Processor Expert allocates 512K as described in the older document, see screenshot. Which is why I say that what you posted from the older document seems to make more sense. If i'm missing something and the newer document is correct, please explain. If the allocation is per-block, then that raises a lot of other questions.
I have a recent version of Codewarrior, here's the info for reference in case that matters.
Hi dmitriyc,
Sorry for my misleading, the newest reference manual (rev3) is not correct in the Valid FlexNVM Partition Codes table.
The rev2 is correct, so please refer to rev2, I already attached it.
About this document error, our document department will fix it.
Sorry for the inconvenience bring you.
Regards,
Jingjing