MKL04Z8XXX4 Custom board lock/brick

cancel
Showing results for 
Search instead for 
Did you mean: 

MKL04Z8XXX4 Custom board lock/brick

902 Views
tomazlov
Contributor II

I have custom MKL04Z8XXX4 board and suddenly can not connect to the board using my standard routine. Based on some references I have read (How to unlock bricked MCU with J-Link?, Unsecuring the KL25Z Freedom BoardBricked Eval Board after "erase" (NXP Kinetis MK20), Unlocking and Erasing FLASH with Segger J-Link, etc.) there seems to be locking or bricking issue. Using Jlink commander v6.40 none of the suggestions ("unlock kinetis", manually selecting CPU, setting lower SWD speed, e.g. 4kHz: im using ~1m SWD wires!) were useful; below is copy-paste of the sequence:

SEGGER J-Link Commander V6.40 (Compiled Oct 26 2018 15:06:29)
DLL version V6.40, compiled Oct 26 2018 15:06:02

Connecting to J-Link via USB...O.K.

VTref=2.982V

Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: MKL04Z8XXX4
Type '?' for selection dialog
Device>
Please specify target interface:
J) JTAG (Default)
S) SWD
T) cJTAG
TIF>S
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>4
Device "MKL04Z8XXX4" selected.


Connecting to target via SWD
InitTarget()
Device will be unsecured now.
Timeout while unsecuring device. Erase never starts.
Found SW-DP with ID 0x0BC11477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x04770031)
AP[1]: JTAG-AP (IDR: 0x001C0020)
Iterating through AP map to find AHB-AP to use
AP[0]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
AP[1]: Skipped. Not an AHB-AP
InitTarget()
Device will be unsecured now.
Timeout while unsecuring device. Erase never starts.
Found SW-DP with ID 0x0BC11477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x04770031)
AP[1]: JTAG-AP (IDR: 0x001C0020)
Iterating through AP map to find AHB-AP to use
AP[0]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
AP[1]: Skipped. Not an AHB-AP

****** Error: Could not find core in Coresight setup
InitTarget()
Device will be unsecured now.
Timeout while unsecuring device. Erase never starts.
Found SW-DP with ID 0x0BC11477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x04770031)
AP[1]: JTAG-AP (IDR: 0x001C0020)
Iterating through AP map to find AHB-AP to use
AP[0]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
AP[1]: Skipped. Not an AHB-AP
InitTarget()
Device will be unsecured now.
Timeout while unsecuring device. Erase never starts.
Found SW-DP with ID 0x0BC11477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x04770031)
AP[1]: JTAG-AP (IDR: 0x001C0020)
Iterating through AP map to find AHB-AP to use
AP[0]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
AP[1]: Skipped. Not an AHB-AP
Cannot connect to target.
J-Link>unlock Kinetis
Found SWD-DP with ID 0x0BC11477
Unlocking device...Timeout while unlocking device.
J-Link>device MKL04Z8XXX4
J-Link>unlock kinetis
Found SWD-DP with ID 0x0BC11477
Unlocking device...Timeout while unlocking device.
J-Link>erase
Target connection not established yet but required for command.
Device "MKL04Z8XXX4" selected.

1) Is my board bricked? If YES: is there any other way to unbrick the IC (using other dedicated HW or interface)?

2) Since I am always working from MCU Expresso IDE (v10.2.0) is there some settings (flags/operation/flash overwrite on specific addresses?) to be careful about during programing/erasing to avoid this situation?

0 Kudos
2 Replies

164 Views
nxf46838
NXP TechSupport
NXP TechSupport

Hello,

 

1.-

If you did set the disable mass erase bit and the protection bit at the same time in the flash security register, if you did unfortunately there is no way to unlock it.

2.-

Yes it is please take a look to this application note [AN4835], also you can check this out to know more about the protection and security bits https://mcuoneclipse.com/2012/11/04/how-not-to-secure-my-microcontroller/

 

Hope this helps,

Regards,
Aldo.

-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------

164 Views
tomazlov
Contributor II

Not sure what was the right reason (noise? sync issue? to short timeout constraint even at lower speed I've been using?), but it was the long wires (even some more then 1m long with no extra shielding whatsoever) that trigger this behaviour: when I shortened the wires to ~20cm everything goes flawlessly.

0 Kudos