How to configure a FlexNVM as Eeprom

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

How to configure a FlexNVM as Eeprom

816 Views
e_marcesini
Contributor I

Good morning,
I am using a MK64FX512VLQ12 with MCUXpresso IDE.I should set the FlexNVM as EEprom. I wrote the following code:

ftfx_config_t flex_conf;
flexnvm_config_t nvm_conf;
ftfx_partition_flexram_load_opt_t flexram_load_op;
ftfx_flexram_func_opt_t flexram_fun_op;

int main(void) {
   /* Init board hardware. */

 uint8_t dati_scrittura;
 status_t r_write;
 uint8_t da;
 uint32_t k;
 uint8_t dati_read [10];
 ftfx_read_resource_opt_t read_res;

    BOARD_InitBootPins();
    BOARD_InitBootClocks();
    BOARD_InitBootPeripherals();

    r_write = FLEXNVM_Init (&nvm_conf);
    if (r_write != kStatus_FTFx_Success)
        printf ("Errore Init: %d\n\r", r_write);
    else
    {
     printf ("Ok Init\n\r");

     printf ("Block base: 0x%04X\n\r", nvm_conf.ftfxConfig.flexramBlockBase);
     printf ("Total size: %d\n\r", nvm_conf.ftfxConfig.flexramTotalSize);
     printf ("Eeprom Total size: %d\n\r", nvm_conf.ftfxConfig.eepromTotalSize);
    }

flexram_fun_op = kFTFx_FlexramFuncOptAvailableForEeprom;
    r_write = FLEXNVM_SetFlexramFunction (&nvm_conf, flexram_fun_op);
    if (r_write != kStatus_FTFx_Success)
  printf ("Errore Flexram function: %d\n\r", r_write);
 else
  printf ("Ok Flexram function\n\r");

while (1);
}

The Init function is performed successfully. The FLEXNVM_SetFlexramFunction returns error 103 i.e. Access Error. I also tried to use other functions such as Erase All or FLEXNVM_ProgramPartition and they all return the usual error. How should I do to set the Flexnvm as Eeprom?

0 Kudos
Reply
1 Reply

793 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

 

I suggest you check the security status of the FlexNVM with "FLEXNVM_GetSecurityState()". The state must be unsecured.

Also, I suggest you refer to this Application Note: https://www.nxp.com/docs/en/application-note/AN4282.pdf, this app note discusses the use of FlexMemory as enhanced EEPROM.

 

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

Best regards,

Omar

0 Kudos
Reply