Hello,
I'm working on bringing up a prototype board which has S32K322 device. After writing some image to the flash memory using J-Link Flash via SWD, I'm unable to re-flash the target again. This was probably 30th time I flashed the device, before that I was able to connect, flash, erase and debug.
I've reached out to NXP for assistance, but this did not yield any results yet: https://community.nxp.com/t5/S32K/Can-t-…22/td-p/2035700
Brief summary of the issue:
-MCU was operational, I was able to flash the target using JFlash tool.
-I've "managed" to brick the device by just flashing with a software image which did not do much, it was supposed to initialize the external oscillator and start some simple queries over the I2C bus.
-"Bricked" MCU does not look like it is executing code, the external oscillator is not enabled, although it was until the MCU stopped working.
-If the reset pin is set to low(MCU is in reset), JLink is able to read something, but fails to connect:
J-Link>connect
Device "S32K322_M7_0" selected.
Connecting to target via SWD
ConfigTargetSettings() start
ConfigTargetSettings() end - Took 11us
InitTarget() start
SDA_AP detected
Checking if debug access is already enabled...
Debug access is not enabled yet. Performing enable debug access sequence...
Debug access enabled
Checking if HSE firmware is installed...
HSE firmware not installed
Checking if Cortex-M7_0 and Cortex-M7_1 are operating in lockstep mode
Lock step mode enabled
InitTarget() end - Took 27.5ms
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
AP map detection skipped. Manually configured AP map found.
AP[0]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[1]: APB-AP (IDR: Not set, ADDR: 0x00000000)
AP[2]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[3]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
AP[4]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
AP[5]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
AP[6]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[7]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[4]: Skipped ROMBASE read. CoreBaseAddr manually set by user
AP[4]: Core found
ConfigTargetSettings() start
ConfigTargetSettings() end - Took 36us
InitTarget() start
SDA_AP detected
Checking if debug access is already enabled...
Core already enabled
Checking if HSE firmware is installed...
HSE firmware not installed
Checking if Cortex-M7_0 and Cortex-M7_1 are operating in lockstep mode
Lock step mode enabled
InitTarget() end - Took 9.54ms
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
AP map detection skipped. Manually configured AP map found.
AP[0]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[1]: APB-AP (IDR: Not set, ADDR: 0x00000000)
AP[2]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[3]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
AP[4]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
AP[5]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
AP[6]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[7]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
AP[4]: Skipped ROMBASE read. CoreBaseAddr manually set by user
AP[4]: Core found
****** Error: DAP error while reading AIRCR.
Error occurred: Could not connect to the target device.
For troubleshooting steps visit: https://wiki.segger.com/J-Link_Troubleshooting
Display More
-If the reset pin is set to high, JLink is not able to read anything:
Connecting to target via SWD
ConfigTargetSettings() start
ConfigTargetSettings() end - Took 12us
InitTarget() start
Unknown SDA AP Id detected: 0xFFFFFFFF
InitTarget() end - Took 105ms
Connect failed. Resetting via Reset pin and trying again.
ConfigTargetSettings() start
ConfigTargetSettings() end - Took 14us
InitTarget() start
Unknown SDA AP Id detected: 0xFFFFFFFF
InitTarget() end - Took 105ms
Error occurred: Could not connect to the target device.
For troubleshooting steps visit: https://wiki.segger.com/J-Link_Troubleshooting
Display More
-The issue occurs on two pieces of hardware, of which one was in factory state, and I was unable to connect once I flashed the target with offending binary.
-I've attached the logs I've created, there's a Saleae's logic analyzer files which contains dumps of SWD traffic.
My questions:
-How is it possible the JLink is unable to connect to the target, even if it is held in reset state? Does that mean that MCU is broken/bricked/locked-out somehow?
-Does it look like MCU problem, or perhaps JLink's?
-Is there a way to "unbrick" the devices?
If something is unclear, please let me know.
Thank you