K64 Flash Swap remain in unreliable state

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

K64 Flash Swap remain in unreliable state

Jump to solution
819 Views
francescosalvat
Contributor II

Hi everyone,

i'm developing an OTA updater using Flash Swap feature. I successfully implemented flash swap but when i encounter an error in downloaded firmware (i use CRC to test integrity of the file) i abort the flashing and my flash remain in UPDATE_ERASED state so when i reset and retry to flash i obtain FTFx_ERR_ACCERR.

I tried to perform a flash eraser before reset after a CRC error but i don't find any examples on how return in READY state (or another reliable state) to restart flashing from initial point.

Now i perform an erase of swap indicator sector in that way:

ret = FlashEraseSector(&flashSSDConfig, PSWAP_INDICATOR_ADDR + (P_FLASH_SIZE/2), P_SECTOR_SIZE, g_FlashLaunchCommand);
if(ret != FTFx_OK)
{
return ret;
}
ret = PFlashSwapCtl(&flashSSDConfig, PSWAP_INDICATOR_ADDR, FTFx_SWAP_SET_INDICATOR_ADDR, &currentSwapMode, &currentSwapBlock, &nextSwapBlock, g_FlashLaunchCommand);
if ((FTFx_OK != ret))
{
return ret;
}

I erase the swap indicator in upper flash section and then set swap indicators in active flash section.

Is it correct?

Labels (1)
Tags (2)
1 Solution
601 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Francesco Salvatore,

I think you are facing a similar issue as the one discussed in the next thread:

MK22FN1M0VLQ12 SWAP: Return from UpErs to Ready 

The SWAP system uses a sequential state machine, not intended to move backwards (e.g. from UPDATE-ERASED to READY state).

You can stay in UPDATE-ERASED state, erase the corrupted firmware and start flashing again the correct firmware.

Please let me know if I misunderstood your situation or use-case.

Best Regards!,
Jorge Gonzalez

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

View solution in original post

2 Replies
602 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Francesco Salvatore,

I think you are facing a similar issue as the one discussed in the next thread:

MK22FN1M0VLQ12 SWAP: Return from UpErs to Ready 

The SWAP system uses a sequential state machine, not intended to move backwards (e.g. from UPDATE-ERASED to READY state).

You can stay in UPDATE-ERASED state, erase the corrupted firmware and start flashing again the correct firmware.

Please let me know if I misunderstood your situation or use-case.

Best Regards!,
Jorge Gonzalez

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

601 Views
francescosalvat
Contributor II

Hi, the situation was those and i resolved doing exactly what you wrote!  Thank you!

0 Kudos