How to avoid from permanent lock of kinetis devices during Flash programming.

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

How to avoid from permanent lock of kinetis devices during Flash programming.

910 Views
muhammadbilal
Contributor I

HI,

I have FRDM-K64F device and I wrote Flash algorithm for flash programming.

During flash programming, it seems that my device becomes permanent lock.

as Jlink commander tools give following error. (IIUC, my device become useless?)

J-Link>unlock kinetis
Found SWD-DP with ID 0x2BA01477
Unlocking device...Unlock via debug port is disabled. Unlock failed.
Timeout while unlocking device.
J-Link>

My question is that, How can I avoid from such situation in future.

Could you please share with me a exact flash algorithm in some programing language to avoid permanent lock/secure board?

Thanks,

-Bilal

0 Kudos
1 Reply

525 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Muhammad bilal

First, as you are using the Jlink commander, could you try to send a "erase" command in the same tool, to see if this can mass erase the content in the flash, then if this method works, try the unlock kinetis. This is to see if your device has become irrecoverable.

Your flash algorithm shouldn't be the problem, the problem is what you are loading in the flash configuration field, in the address 0x0_040C (FSEC). I recommend you to check this links:

https://mcuoneclipse.com/2012/11/04/how-not-to-secure-my-microcontroller/ 

http://cache.nxp.com/files/microcontrollers/doc/app_note/AN4507.pdf 

Both of them describes good practices when you program kinetis devices and tell you how to avoid the security lock.


Have a great day,
Jorge Alcala

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

0 Kudos