K65 EEPROM Clarification and API for using it

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

K65 EEPROM Clarification and API for using it

478 Views
unknowncoder
Contributor III

Hello, 

I have read through the user guide for the MK65FX1M0VMI18 and I having a hard time understanding the EEPROM subsystem. I see the EEPROM uses both the FlexRAM(4KB max) and FlexNVM (256KB max). 
What is the maximum storage capacity of the EEPROM subsystem? As far as I understand it's the size of the FlexNVM which is 256KB.

 

Is there an easy access API to using the EEPROM, I downloaded the SDK for the K65 but I see no API for using the EEPROM. The only method I see is `FLEXNVM_EepromWrite()`. How do I read data from the EEPROM? Can you provide a thorough example for read/writing from/to the EEPROM, including all the setup code?

Does the built in EEPROM subsystem within the MCU provide wear leavering? The method `FLEXNVM_EepromWrite()` required the caller to pass in a flash address to write to. I am guessing this is the address of FlexNVM that I want to write to. Does it constantly write to that address or does the EEPROM automatically figure out it should write to another address to provide wear leavering? 

Thus the address isn't the real address, isn't a virtual address.

Can you confirm this please?

Thanks

Labels (1)
Tags (2)
0 Kudos
1 Reply

366 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi unknowncoder,

   Thank you for your interest in NXP kinetis product, I would like to provide service for you.

   Answer your several questions:

1. What is the maximum storage capacity of the EEPROM subsystem? As far as I understand it's the size of the FlexNVM which is 256KB.

    The maximum storage capacity of the eeprom is just the flexRAM size, it is 4KB, FlexNVM is just the eeprom backup memory, you don't need to care about it.

   Actually, the reference manual also mentioned it:

pastedImage_1.png

2. Is there an easy access API to using the EEPROM

At first, you need to do the eeprom partition, then you can do the eeprom write and read operation, If you want to write the eeprom, you just need to use the FLEXNVM_EepromWrite().

 About the EEPROM read, that's very easy, the eeprom address it he flexRAM address, you just need to read that address data is OK.

Take an example:

#define LONGWORD_COUNTER_ADDR 0x14000040
#define WORD_COUNTER_ADDR 0x14000044
#define BYTE_COUNTER_ADDR 0x14000046

                  printf("\nlongword counter = 0x%08X", *(uint32 *)(LONGWORD_COUNTER_ADDR));
                  printf("\nword counter = 0x%04X", *(uint16 *)(WORD_COUNTER_ADDR));
                  printf("\nbyte counter = 0x%02X", *(uint8 *)(BYTE_COUNTER_ADDR));

About the write, I also have the k series EEPROM register control code, please check the attached .c file.

3. When you write, you also need to give the flexRAM address which already simulated to the EEPROM function.

Wish it helps you!

If you still have question about it, please kindly let me know.


Have a great day,
Kerry

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

0 Kudos