FLEXNVM_Init()==kStatus_FTFx_PartitionStatusUpdateFailure on KE1xF

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

FLEXNVM_Init()==kStatus_FTFx_PartitionStatusUpdateFailure on KE1xF

Jump to solution
700 Views
omalay
Contributor I

Hello,

Is there anywhere an example of how to use the FSL SDK library for FlexNVM access?

I've tried just to call FLEXNVM_Init() on my MKE1xF but it returns kStatus_FTFx_PartitionStatusUpdateFailure. It's failing inside ftfx_command_sequence() on kStatus_FTFx_AccessError. If I comment out FTFx_FSTAT_ACCERR_MASK, then FLEXNVM_Init() kinda works (returns kStatus_FTFx_Success), but then FLEXNVM_DflashProgram() doesn't seem to write anything (returns kStatus_FTFx_Success, though), and the memory is just filled with 0xff...

My pseudo-code is something like this:

flexnvm_config_t flashCfg;

memset(&flashCfg, 0, sizeof(flashCfg));

status_t status = FLEXNVM_Init(&flashCfg);

status = FLEXNVM_DflashErase(&flashCfg, 0x10000000, 2048, kFTFx_ApiEraseKey);

status = FLEXNVM_DflashProgram(&flashCfg, 0x10000000, buffer, 2048);

Also,

FLEXNVM_GetSecurityState() = kFTFx_SecurityStateNotSecure

FLEXNVM_DflashGetProtection() = 0xff (non-protected)

What's wrong with it and how to do it right?

0 Kudos
1 Solution
606 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Basil Omalay,

   Thanks a lot for your updated information.

   Yes, the HSRUN mode is the root problem, just as the reference manual wrote.

   You need to change the clock mode to RUN mode.

   About the RUN mode configuration, you can refer to the SDK sample code:

pastedImage_1.png

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 "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
606 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Basil Omalay,

   Please tell me which SDK project you are using in the :SDK_2.5.0_TWR-KE18F\boards\twrke18f\driver_examples\flash

  You also can try do the mass erase at first before your run the flash code.

  About the mass erase, you can use the JLINK commander with JLINK debugger, input: unlock kinetis

  Just do the mass erase at first.

Wish it helps you!

Any updated information from your side, please kindly let me know.


Have a great day,
Kerry

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

606 Views
omalay
Contributor I

kerryzhou wrote:

   Please tell me which SDK project you are using in the :SDK_2.5.0_TWR-KE18F\boards\twrke18f\driver_examples\flash

  You also can try do the mass erase at first before your run the flash code.

  About the mass erase, you can use the JLINK commander with JLINK debugger, input: unlock kinetis

  Just do the mass erase at first.

 

Thank you for your answer! I have my own custom project & board based on files from SDK_2.5.0_TWR-KE18F.

I suspect that the problem is that I'm using HSRUN mode. It's mentioned in the manual:

The user has no access to the Flash command set when the MCU is in HSRUN mode.

...

Attempts to launch an FTFE command in HSRUN mode will be trapped with the ACCERR flag being set.

Is it true that I cannot write to FlashNVM at full-speed 168 MHz? Should I first switch to the RUN mode @ 120 MHz, then write to the nvm-flash and then switch back to HSRUN?

Does the SDK have some high-level handy code or examples to easily swich on-the-fly between clock configurations?

0 Kudos
607 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Basil Omalay,

   Thanks a lot for your updated information.

   Yes, the HSRUN mode is the root problem, just as the reference manual wrote.

   You need to change the clock mode to RUN mode.

   About the RUN mode configuration, you can refer to the SDK sample code:

pastedImage_1.png

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 "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos