使用Jlink commander Connect可以连接成功但是无法擦除flash和下载程序,之前有一次可以debug但是没怎么操作后面就怎么也不行了,请问下这种情况还有办法救吗?
Jlink commander log :
Cortex-M4 identified.
J-Link>connect
Device "S32K142" selected.
Connecting to target via SWD
InitTarget()
Timeout while halting CPU.
Found SW-DP with ID 0x2BA01477
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
Cortex-M4 identified.
J-Link>R0
J-Link>swdwritedp 2,0x01000000
Write DP register 2 = 0x01000000
J-Link>swdreadap 0
Read AP register 0 = 0x00000000
J-Link>swdreadap 0
Read AP register 0 = 0x00000033
J-Link>swdreadap 1
Read AP register 1 = 0x00000033
J-Link>swdreadap 1
Read AP register 1 = 0x00000004
J-Link>swdwriteap 1,0x1
Write AP register 1 = 0x00000001
J-Link>swdwriteap 1,0x1
Write AP register 1 = 0x00000001
J-Link>erase
**************************
WARNING: CPU could not be halted
**************************
Erasing device...
**************************
WARNING: CPU could not be halted
**************************
****** Error: Can not read register 16 (XPSR) while CPU is running
Can not read register 20 (CFBP) while CPU is running
Can not read register 0 (R0) while CPU is running
Can not read register 1 (R1) while CPU is running
Can not read register 2 (R2) while CPU is running
Can not read register 3 (R3) while CPU is running
Can not read register 4 (R4) while CPU is running
Can not read register 5 (R5) while CPU is running
Can not read register 6 (R6) while CPU is running
Can not read register 7 (R7) while CPU is running
Can not read register 8 (R8) while CPU is running
Can not read register 9 (R9) while CPU is running
Can not read register 10 (R10) while CPU is running
Can not read register 11 (R11) while CPU is running
Can not read register 12 (R12) while CPU is running
Can not read register 14 (R14) while CPU is running
Can not read register 15 (R15) while CPU is running
Can not read register 17 (MSP) while CPU is running
Can not read register 18 (PSP) while CPU is running
****** Error: Verification of RAMCode failed @ address 0x1FFFC000.
Write: 0xA801BE00 F0009900
Read: 0x00000000 00000000
Failed to prepare for programming.
Failed to download RAMCode!
ERROR: Erase returned with error code -1.
J-Link>
S32K1xx系列MCU应用指南之芯片锁死(lockup)复位原因分析与恢复方法详解
Find the article in this link, the analysis of the cause of the lock and whether it can be restored is very detailed.
https://community.nxp.com/t5/S32K-Knowledge-Base/Tips-and-Links/ta-p/1113497
I will close another case of yours with the same topic.
the MDM-AP status register BIT-3 is 0,that means system is in reset status.
please measure reset pin waveform first and then refer to chapter 7.1:能否解锁恢复MCU的判断方法
if yes, you can try this tool to halted reset .
https://community.nxp.com/t5/S32K/Can-t-use-PEmicro-debugger-with-S32K118EVB2-Q048/m-p/1376204