Using FlexRAM as EEPROM in MK22FX512AVLQ12

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Using FlexRAM as EEPROM in MK22FX512AVLQ12

跳至解决方案
1,131 次查看
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 项奖励
回复
1 解答
1,123 次查看
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 项奖励
回复
5 回复数
1,124 次查看
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 项奖励
回复
1,112 次查看
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 项奖励
回复
1,073 次查看
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 项奖励
回复
1,064 次查看
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 项奖励
回复
1,053 次查看
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