Can´t read/write to/from flash

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

Can´t read/write to/from flash

Jump to solution
1,157 Views
Oliveira
Contributor III

Hi,

 

I am testing two MCUs on the same board, MK64FN1M0VLL12 and MK64FX512VLL12

 

KSDK1.3 and KDS and PE here (older project, can´t help to update) SW has this simple routine (from KSDK examples folder) to write and check some bytes in flash for sensor update: Can´t read/write to/from flash with MK64FX512 only works with MK64FN1M0:

void memoriaFlashLer(void) {
result = FlashInit(&flashSSDConfig);
g_FlashLaunchCommand = (pFLASHCOMMANDSEQUENCE)RelocateFunction((uint32_t)ramFunc , LAUNCH_CMD_SIZE ,(uint32_t)FlashCommandSequence);
destAdrss = flashSSDConfig.PFlashBase + (flashSSDConfig.PFlashSize - 6*FTFx_PSECTOR_SIZE);
//result = FlashEraseSector(&flashSSDConfig, destAdrss, FTFx_PSECTOR_SIZE, g_FlashLaunchCommand);
number = FTFx_PSECTOR_SIZE/FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT;
for(marginReadLevel = 0; marginReadLevel <=0x2; marginReadLevel++)
{
result = FlashVerifySection(&flashSSDConfig, destAdrss, number, marginReadLevel, g_FlashLaunchCommand);
}
destAdrss = flashSSDConfig.PFlashBase + (flashSSDConfig.PFlashSize - 6*FTFx_PSECTOR_SIZE);
bufferFreqInv2[0] = *((uint8_t *)destAdrss);
}
//
void memoriaFlashEscrever(uint8_t valor) {
result = FlashInit(&flashSSDConfig);
g_FlashLaunchCommand = (pFLASHCOMMANDSEQUENCE)RelocateFunction((uint32_t)ramFunc , LAUNCH_CMD_SIZE ,(uint32_t)FlashCommandSequence);
destAdrss = flashSSDConfig.PFlashBase + (flashSSDConfig.PFlashSize - 6*FTFx_PSECTOR_SIZE);
result = FlashEraseSector(&flashSSDConfig, destAdrss, FTFx_PSECTOR_SIZE, g_FlashLaunchCommand);
number = FTFx_PSECTOR_SIZE/FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT;
for(marginReadLevel = 0; marginReadLevel <=0x2; marginReadLevel++)
{
result = FlashVerifySection(&flashSSDConfig, destAdrss, number, marginReadLevel, g_FlashLaunchCommand);
}
bufferFreqInv2[0] = valor;
destAdrss = flashSSDConfig.PFlashBase + (flashSSDConfig.PFlashSize - 6*FTFx_PSECTOR_SIZE);
result = FlashProgram(&flashSSDConfig, destAdrss, BUFFER_SIZE_FREQ_INV2, bufferFreqInv2, g_FlashLaunchCommand);
}

 

I have created for both MCUs independent projects with PE so headers must be correct, right?

Is there any difference between MK64FN1M0 and MK64FX512 other than flash size? I mean, I read somewhere else that MK64FX512 does not have EEPROM and MK64FN1M0 has (or otherwise, I could misunderstood it)... Does that have anything to do with this read/write problem or there is something left to tweek into KDS/PE/code?

 

Marco

 

0 Kudos
Reply
1 Solution
1,144 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Oliveira,

  Your mentioned SDK1.3.0 and the KDS is really very old now, if you are using the K64 SDK, I highly suggest you use our newest SDK which can be downloaded from this link:

https://mcuxpresso.nxp.com/

   About the IDE, KDS is not updated now, and we are using MCUXpresso IDE to replace it, and the SDK is mainly based on the MCUXpresso IDE, IAR, MDK, etc.

   You can download the MCUXpressso IDE from this link:

https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-i...

   So, please use the newest SDK, and the K64 SDK already have the flash project, you can test it directly, please don't use the old SDK 1.3.0 and the KDS.

  About the PE, you also can use the MCUXPresso CFG tool to replace it, PE is also not updated anymore.

  Now answer your other questions:

Is there any difference between MK64FN1M0 and MK64FX512 other than flash size? I mean, I read somewhere else that MK64FX512 does not have EEPROM and MK64FN1M0 has (or otherwise, I could misunderstood it)... Does that have anything to do with this read/write problem or there is something left to tweek into KDS/PE/code?

Answer: K64FX has the flexNVM, flexRAM, which can be used as EEPROM, but K64FN, don't have flexNVM, can't use the EEPROM. Please use the newest SDK code:

SDK_2.9.0_FRDM-K64F\boards\frdmk64f\driver_examples\flash\pflash

If you use MK64FX512, you also can download that SDK, then you can find the related driver in this SDK folder:SDK_2.9.0_FRDM-K64F\devices

 

Wish it helps you!

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

Best Regards,

Kerry

 

 

View solution in original post

0 Kudos
Reply
1 Reply
1,145 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Oliveira,

  Your mentioned SDK1.3.0 and the KDS is really very old now, if you are using the K64 SDK, I highly suggest you use our newest SDK which can be downloaded from this link:

https://mcuxpresso.nxp.com/

   About the IDE, KDS is not updated now, and we are using MCUXpresso IDE to replace it, and the SDK is mainly based on the MCUXpresso IDE, IAR, MDK, etc.

   You can download the MCUXpressso IDE from this link:

https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-i...

   So, please use the newest SDK, and the K64 SDK already have the flash project, you can test it directly, please don't use the old SDK 1.3.0 and the KDS.

  About the PE, you also can use the MCUXPresso CFG tool to replace it, PE is also not updated anymore.

  Now answer your other questions:

Is there any difference between MK64FN1M0 and MK64FX512 other than flash size? I mean, I read somewhere else that MK64FX512 does not have EEPROM and MK64FN1M0 has (or otherwise, I could misunderstood it)... Does that have anything to do with this read/write problem or there is something left to tweek into KDS/PE/code?

Answer: K64FX has the flexNVM, flexRAM, which can be used as EEPROM, but K64FN, don't have flexNVM, can't use the EEPROM. Please use the newest SDK code:

SDK_2.9.0_FRDM-K64F\boards\frdmk64f\driver_examples\flash\pflash

If you use MK64FX512, you also can download that SDK, then you can find the related driver in this SDK folder:SDK_2.9.0_FRDM-K64F\devices

 

Wish it helps you!

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

Best Regards,

Kerry

 

 

0 Kudos
Reply