K70 flash swap and erase

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

K70 flash swap and erase

ソリューションへジャンプ
1,592件の閲覧回数
xxofeval
Contributor I

We have an application using a Kinetis K70 that requires a refresh of all flash storage. This refresh is executed every 10 years in a maintenance mode without the main application running. The flash refresh includes a bootloader area.  We were considering using duplicate copies of the bootloader and the flash swap capability to protect the device during maintenance.  Our application requires much more than half the flash size so we cannot simply dedicate blocks.  We were hoping to just maintain a bootloader at 0x0000 offset of both block halves.  The bootloader would detect a block swapped boot which would indicate a problem and do a targeted rewrite of its own image to the alternate block.  Can we erase and then write the non-active block sector by sector without a full block erase when swapped? 

0 件の賞賛
返信
1 解決策
1,384件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello d verdello:

I see how that statement could be confusing.

Actually it just means that before writing to the nonactive block, any spaces to be written must be in "erased state" (all 1's). See this note from the Reference Manual:

pastedImage_1.png

So the text in the appnote does not mean that you need to erase the entire block. But for the swap to work as expected, it is mandatory to erase at least the sector with the flash swap indicator.

:smileyinfo: The K70 uses phrase programming (8 bytes at a time), so you need to consider flash memory location as a phrase (8-bytes space).

I hope this clarifies. Let me know if you have questions.

Regards!

Jorge Gonzalez

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,384件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello d verdello:

I did not fully understand your design or use case, but in regards of your question, after sending the SWAP command to set the system in UPDATE state, then you have the choice to erase only part of the nonactive block, but it is strictly required that you erase at least the sector that contains the SWAP indicator. See the next text from application note AN4533:

pastedImage_1.png

In case you are not familiar with all the SWAP mechanism, then I recommend you to read the whole application note AN4533.

If I misunderstood your question or you need further clarification please let me know.


Regards!,
Jorge Gonzalez

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

0 件の賞賛
返信
1,384件の閲覧回数
xxofeval
Contributor I

Thanks for the response Jorge

We're looking for clarification on targeted sector erase and rewrite of the nonactive block.  Our application looks to erase and rewrite specific sectors leaving the remainder of the nonactive block intact.

From 4.2 of the appnote:

"You can use block erase or sector erases. It is only specifically required to erase the flash swap indicator sector in the

nonactive block. However, to update the software in the nonactive block, you must first erase it."

This could imply that the entire nonactive block needs to be erased if you wish to rewrite in the nonactive block before the swap.  This would not fit our needs.  It is clear we can execute a targeted sector erase and then swap.  What is not clear is if we can erase only a few sectors including the flash swap indicator and then rewrite some of those non swap indicator sectors before executing a swap.

All examples we've found show a full block erase prior to writing.

0 件の賞賛
返信
1,385件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello d verdello:

I see how that statement could be confusing.

Actually it just means that before writing to the nonactive block, any spaces to be written must be in "erased state" (all 1's). See this note from the Reference Manual:

pastedImage_1.png

So the text in the appnote does not mean that you need to erase the entire block. But for the swap to work as expected, it is mandatory to erase at least the sector with the flash swap indicator.

:smileyinfo: The K70 uses phrase programming (8 bytes at a time), so you need to consider flash memory location as a phrase (8-bytes space).

I hope this clarifies. Let me know if you have questions.

Regards!

Jorge Gonzalez

0 件の賞賛
返信