S32K144 bricking, causes and prevention.

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

S32K144 bricking, causes and prevention.

602 Views
vrad
Contributor I

Hello,

I am working on S32K144 on a bootloaderupdater and, during my attempts, I have managed to brick 2 targets. I get this when trying to connect with J-Flash:

Connecting ...
 - Connecting via USB to probe/ programmer device 0
 - Probe/ Programmer firmware: J-Link V11 compiled Dec  9 2021 14:14:49
 - Device "S32K144" selected.
 - Target interface speed: 4000 kHz (Fixed)
 - VTarget = 4.982V
 - InitTarget() start
 - InitTarget()
 - Protection bytes in flash at addr. 0x400 - 0x40F indicate that readout protection is set.
For debugger connection the device needs to be unsecured.
Note: Unsecuring will trigger a mass erase of the internal flash.

 - Executing default behavior previously saved in the registry.
 - Device will be unsecured now.
 - Timeout while unsecuring device. Erase never stops.
 - InitTarget() end
 - Found SW-DP with ID 0x2BA01477
 - DPIDR: 0x2BA01477
 - 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: 0x24770011)
 - AP[1]: JTAG-AP (IDR: 0x001C0000)
 - Iterating through AP map to find AHB-AP to use
 - AP[0]: Skipped. Could not read CPUID register
 - AP[1]: Skipped. Not an AHB-AP
 - InitTarget() start
 - InitTarget()
 - Protection bytes in flash at addr. 0x400 - 0x40F indicate that readout protection is set.
For debugger connection the device needs to be unsecured.
Note: Unsecuring will trigger a mass erase of the internal flash.

 - Executing default behavior previously saved in the registry.
 - Device will be unsecured now.
 - Timeout while unsecuring device. Erase never stops.
 - InitTarget() end
 - Found SW-DP with ID 0x2BA01477
 - DPIDR: 0x2BA01477
 - 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: 0x24770011)
 - AP[1]: JTAG-AP (IDR: 0x001C0000)
 - Iterating through AP map to find AHB-AP to use
 - AP[0]: Skipped. Could not read CPUID register
 - AP[1]: Skipped. Not an AHB-AP
 - ERROR: Could not find core in Coresight setup
 - ERROR: Failed to connect.
Could not establish a connection to target.

 
This happened after I ran my attempt at a bootloader updater. Essentially, this deleted the original BL, copied the new bootloader payload and then reset. As long as I was hooked with the debugger from my side, I could still control it, (even across reset sessions) but as soon as I relinquished SWD control... my targets became inaccessible. Issue is, I dumped the flash with IAR after the supposed payload copy, and it looked fine... Including the option byte area. I just don't believe IAR was telling me the truth. It was lying to me including when I knew the BL was deleted... I saw the original data in the memory view although the original must have been deleted.

Now, my questions are...

1) Do I have _any_ chance of unbricking these 2 targets that I have? I tried this:

https://community.nxp.com/t5/S32K/Unbricking-S32K146/m-p/937227

with the exact same result. It seems the MCU is locked but Mass erase is enabled... it just never does it.


2) Since I can still control the target after this BLU does its magic.. what is the minimal set of elements I can check and change before the first reset in order to make sure I will not brick the target once I relinquish control? On the surface, the Option Bytes _looked_ fine with a memory view... but the targets are obviously NOT fine. It's untenable for me to just toast a target on each attempt I make for the BLU.

Thank you.

0 Kudos
1 Reply

578 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @vrad,

What do you read in the MDM-AP status register?

Do you use CSEc?

If so, and the MCUs have been partitioned already, it cannot be mass erased (unlocked) regardless of the MDM-AP Status bits.

Do you need to erased the first sector when the bootloader gets updated? Can you have the updater in the first sector?

Where is the updater located now?

Do you read all the error flags of the FTFC commands?

Since the debugger showed you that the flash was not erased, it could be that the erase operation (erase sector I assume) failed.

 

Regards,

Daniel

0 Kudos