Programming the flash config field after a SWD mass erase.

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming the flash config field after a SWD mass erase.

Jump to solution
478 Views
andrewparlane2
Contributor III

I'm looking specifically at a K66F.

When you use the MDM-AP to mass erase the chip. It erases flash to all 1s, except for the security bit in the flash config field. This is what I see in practice, and what I read in the Production Flash Programming Best Practices for Kinetis K- and L-series MCUs PDF here: http://cache.nxp.com/assets/documents/data/en/application-notes/AN4835.pdf 

However in the K66 reference manual in 32.4.12.8 "Program Section command", it states:

CAUTION
A flash memory location must be in the erased state before
being programmed. Cumulative programming of bits (back-to-
back program operations without an intervening erase) within a
flash memory location is not allowed. Re-programming of
existing 0s to 0 is not allowed as this overstresses the device.

So how does this work for the flash config field where the security bit is set to 0 during a mass erase.

Do I just ignore this caution for this bit, and issue a program section command as normal? Or is it better to run a sector erase first to actually erase that bit?

When it says reprogramming of existing 0s to 0 is not allowed. Does that mean the program section command will fail (it doesn't in the FCF case, and I haven't tried it in any other cases).

Thanks.

Labels (1)
0 Kudos
1 Solution
87 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Andrew Parlane,

    The CAUTION is correct, it is not only the MCU feature, it is the flash feature.

    If you want to program the flash, you must erase it at first. If the flash is programmed before, and you don't do the flash erase, just program it directly, your program won't be success.

   The flash configuration filed also meet this requirement. If you want to modify the data, you also need to erase it at first, then write the flash to the data which you want.

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Kerry

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

View solution in original post

1 Reply
88 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Andrew Parlane,

    The CAUTION is correct, it is not only the MCU feature, it is the flash feature.

    If you want to program the flash, you must erase it at first. If the flash is programmed before, and you don't do the flash erase, just program it directly, your program won't be success.

   The flash configuration filed also meet this requirement. If you want to modify the data, you also need to erase it at first, then write the flash to the data which you want.

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Kerry

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

View solution in original post