Using FlexRAM as EEPROM in MK22FX512AVLQ12

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

Using FlexRAM as EEPROM in MK22FX512AVLQ12

Jump to solution
1,049 Views
vaibhavi_padwal
Contributor II
Hi, I am using MK22FX512AVLQ12 controller for my custom board. As per the datasheet, there is FlexRAM of size 4K available on the controller which can be used as EEPROM. I would like to know what is the correct way partition/ configure the FlexRAM to use as EEPROM. As there are no SDK examples available for this controller, please provide a sample code if possible. Thanks & regards, Vaibhavi P
0 Kudos
1 Solution
1,041 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

Hope you are well. The Application Note AN4282 might be helpful: https://www.nxp.com/docs/en/application-note/AN4282.pdf

Regarding the example, I suggest you download the SDK from the FRDM-KE15Z board. There you can find the example "flexnvm_eeprom".
KE15Z and MK22 flash commands work similarly, the only difference is the FlexNVM and FlexRAM memory size.

Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar

View solution in original post

0 Kudos
5 Replies
1,042 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

Hope you are well. The Application Note AN4282 might be helpful: https://www.nxp.com/docs/en/application-note/AN4282.pdf

Regarding the example, I suggest you download the SDK from the FRDM-KE15Z board. There you can find the example "flexnvm_eeprom".
KE15Z and MK22 flash commands work similarly, the only difference is the FlexNVM and FlexRAM memory size.

Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar

0 Kudos
1,030 Views
vaibhavi_padwal
Contributor II

Hi,

Thank you for your suggestions. I tried the example you suggested and able use FlexRam as EEPROM. But I have one doubt regarding the partitioning command used. As per my understanding, if I have used Partitioning command once, it should remained partitioned like that for the rest of life of device.  But when I terminate and debug again, I get eepromTotalSize as 0 by following function.

FLASH_GetProperty(&g_st_flashDriver, kFLASH_PropertyEepromTotalSize, &eepromTotalSize);

Hence the program again executes the Partitioning command and also Data stored in EEPROM is lost.

My intention is to save important parameters in EEPROM which will not be erased even when the controller is turned OFF. I want to read those parameters when the controller is powered ON again.

Please suggest How can I ensure that partition and flexRAM configuration as EEPROM happens only once and remains the same for rest of the device life and also data saved in EEPROM is not lost during power OFF and ON of controller

Please help in resolving the doubt.

Thanks & Regards,

Vaibhavi P

0 Kudos
991 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

The partition command must be done only once. If the flash is re-partitioned for a different configuration, then recorded data is lost and you are not guaranteed to get the expected endurance.
The parameters of the partition are stored into a special location and they can be erased with a mass erase.It is important to mention that before launching the partition command the FlexNVM and D-Flash IFR must be in a erased state.

Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar

0 Kudos
982 Views
vaibhavi_padwal
Contributor II

I am using MCUXpresso IDE (v10.3.1) and P&E Multilink universal debugger.

I think what you are suggesting is that when I terminate and debug again, the debugger must be performing Mass erase before programming the controller. Because of this. the parameters of partitions are lost and I am getting eeprom size as 0. 

Please let me know if I have understood correctly.

Thanks & Regards,

Vaibhavi P

0 Kudos
971 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Yes, if the debugger is doing a mass erase then the partition configuration is lost.

If you have more questions do not hesitate to ask me.
Best regards,
Omar