MK22FN1M0 make flexram as EEPROM

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

MK22FN1M0 make flexram as EEPROM

Jump to solution
1,004 Views
kent_gu
Contributor III


Hi,

Now I am using MK22FN1M0, want to use internal flexram  as EERPROM to storage several configuration variable. Don't know how to start the code? Anyway have simple example or how to do it?

Best Regards,
Kent

Labels (1)
Tags (2)
1 Solution
777 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Kent,

    Please don't worry,  any question, just feel free and let me know!

   Please check the reference manual K22P64M120SF5RM.pdf, page 93, you will find this description:

pastedImage_1.png

   If the chip don't have the FlexNVM, it doesn't have the EEPROM function, because EERPOM need to use FlexRAM and FlexNVM together, FlexNVM is used as the EEPROM backup memory.

  Now, please go to reference manual page 634:

pastedImage_2.png

   When do EEPROM partition, the EEPROM backup size must be at leat 16 times the EEPROM partition size in FlexRAM, EEPROM is also the hardware character, the chip doesn't have  the FLexNVM module, it also doesn't have EERPOM.

   Now, to your chip, just two way if you want to use the eeprom function: 1. change chip to MK22FX512VLH12, this chip have FlexNVM, 2, use flash to emulate the EEPROM function, actually it is using flash to store data.

 Wish it helps you!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

8 Replies
777 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Kent,

    MK22FN1M0 don't contain EEPROM module, because it doesn't have the FlexNVM.

    If you want to store the data, you can store it in the flash.

    About the sample code, please go to this link:

Welcome to Kinetis Expert | Kinetis Expert

  Choose "Build an SDK", then choose you chip and generate the KSDK2.0 sample code, you will find the flash example code in folder:

SDK_2.0_MK22FN1M0xxx12\boards\twrk21f120m\driver_examples\flash

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
777 Views
kent_gu
Contributor III

Jingjing,

I understand it.

So if I want to realize the function, #1, FW samples data in real time, #2, storage data, #3, I still can get the storage data after re-power up board? The way" If you want to store the data, you can store it in the flash." can realize it?

0 Kudos
777 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Kent,

  Yes, you can use the flash realize your function.

  But take care, when you want to write the data to flash, you must erase the flash sector at first, I suggest you use one sector do as the your own data storage area, before you erase the sector, you need to read it to the RAM at first, then after erased, then write the new data back to the flash sector.

  Besides, please take care the flash cycling endurance, you can't do it very frequently, otherwise, the flash will out of the endurance.

Wish it helps you!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
777 Views
kent_gu
Contributor III

Hi Jingjing,

May it is stupid question, but I still want to know. You know, MK22FN1M0a has a  4KB FlexRAM, it can be for enhanced EEPROM even without FlexNVM? 

Best Regards,

Kent

0 Kudos
778 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Kent,

    Please don't worry,  any question, just feel free and let me know!

   Please check the reference manual K22P64M120SF5RM.pdf, page 93, you will find this description:

pastedImage_1.png

   If the chip don't have the FlexNVM, it doesn't have the EEPROM function, because EERPOM need to use FlexRAM and FlexNVM together, FlexNVM is used as the EEPROM backup memory.

  Now, please go to reference manual page 634:

pastedImage_2.png

   When do EEPROM partition, the EEPROM backup size must be at leat 16 times the EEPROM partition size in FlexRAM, EEPROM is also the hardware character, the chip doesn't have  the FLexNVM module, it also doesn't have EERPOM.

   Now, to your chip, just two way if you want to use the eeprom function: 1. change chip to MK22FX512VLH12, this chip have FlexNVM, 2, use flash to emulate the EEPROM function, actually it is using flash to store data.

 Wish it helps you!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

777 Views
kent_gu
Contributor III

Jingjing,

Your reply is great!

I absolutely understand about EEPROM for our MK22FN1M0A., I think I will keep use MK22FN1M0A because I need to use its CAN bus function. I will try to use flash to store data. Now I have downloaded the example, study a little,

Now question is?

#1, How to make the program don't use the special flash sector for EEPROM function? It means that how to arrange special sector for EEPROM fucntion? We can define it in KDS?

#2, How to call the data in virtual EEPROM(flash)? In the example, there are erase special sector function,, write special sector function, no how to read special sector?

#3, How about the flash endurance? Don't have any idea about it. If don't erase and write virtual EEPROM(flash), just read it when power up the board, it will don't affect flash endurance. It means that there is just several times of configuration change, and then several time virtual EEPROM operation, the virtually EEPROM should work well?

Best Regards,

Kent

0 Kudos
777 Views
kent_gu
Contributor III

FlexNVM.jpg

Jingjing,

Thanks a lot for your quick response, but I found the datasheet say that MK22FN1M0VLH12 have 256K FlexNVM as above picture, also "

Using Kinetis® FlexMemory as enhanced EEPROM

" describe the EEPROM using with Flexmemory.

I am confused?

Best Regards,
Kent

777 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Kent,

  You are misunderstanding it.

pastedImage_0.png

  Please see the FlexNVM item, it's none, all the kinetis K series chip with FN doesn't contain FlexNVM, just FX has the FlexNVM module, you can find K22FX512VLH12 have 128KB FlexNVM.

  So, if you really want to use EEPROM, please choose the chip have FX which contains FLexNVM module.

Wish it helps you!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------