Use all of FlexNVM as DataFlash on K65/K66

cancel
Showing results for 
Search instead for 
Did you mean: 

Use all of FlexNVM as DataFlash on K65/K66

597 Views
unknowncoder
Contributor III

What I want to do?

  • I am trying to understand how to setup the FlexNVM to be used as data flash. 

What I want to do this?

  • I plan to use all the data flash with a proprietary file system, and I would like to use all 256KByte of Data flash that available to the MK65FX.

Environment 

  • I am using the MCUExpresso SDK 2.6.0 with a standalone GCC compiler. I would like to the the ftfx_flexnvm driver that came with the SDK to do this. 
  • MK65FX.

My Questions

  1. Does anyone have any example code on how to setup the FlexNVM to use all data flash? 
  2. While digging around in the ftfx_flexnvm and ftfx_controller modules I notice the flex NVM is initialized by reading data flash IFR which is a 1KB non volatile area. How would I write to this area the correct configuration that are needed to set up the flexNVM for data flash operation only?
    1. I am assuming I can use write a linker script with the correct memory map. But what do I need to put in that area?

By the way I tagged K66 here because it's pretty much identical to the K65.

Labels (1)
Tags (4)
3 Replies

426 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi,

The SDK has a driver specified for this (fsl_ftfx_flexnvm) that could be useful, in this file there's the following function that can be use to partition the memory:

status_t FLEXNVM_ProgramPartition(flexnvm_config_t *config, ftfx_partition_flexram_load_opt_t option, uint32_t eepromDataSizeCode, uint32_t flexnvmPartitionCode)

To enable this function you will need to change the following defines MK65F18/MK66F18_features.h if this are not enabled:

#define FSL_FEATURE_FLASH_HAS_FLEX_NVM (1)

#define FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD (1)‍‍‍

I hope this helps you.

Best Regards,

Alexis Andalon

426 Views
unknowncoder
Contributor III

The `FLEXNVM_ProgramPartition()` seems like the right way to go. Can you see my question below with regards to partitioning the DFlash.

  1. Before performing a `FLEXNVM_ProgramPartition()` do I need to erase DFLASH first?
  2. After performing a `FLEXNVM_ProgramPartition()` do I need to reboot?

It looks like a reboot is required so the FlexNVM can be correctly configured by reading the DataFlash0 IFR, can you confirm?

Thanks

0 Kudos

426 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi,

1.- Yes,  you will need to erase to erase the flash before executing this command.

2.- I don't think this is need it, in the description of the command is not mention and it only need to finish the command.

Best Regards,

Alexis Andalon

0 Kudos