I have several faulty boards which fail to be programmed normally with CPU halt timeout error.
I use J-Link debugger and the latest J-Flash software. I choose device
S32K142 (allow security), but the connection always fails after clicking Connect. The detailed J-Flash log is shown below:
Connecting ...
- Connecting via USB to probe/ programmer device 0
- Probe/ Programmer firmware: J-Link V12 compiled Mar 26 2026 10:14:53
- Probe/ Programmer S/N: 602004248
- Device "S32K142 (ALLOW SECURITY)" selected.
- Target interface speed: 4000 kHz (Fixed)
- VTarget = 3.328V
- ConfigTargetSettings() start
- ConfigTargetSettings() end - Took 30us
- InitTarget() start
- SWD selected. Executing JTAG -> SWD switching sequence.
- Device will be unsecured now.
- Timeout while halting CPU.
- InitTarget() end - Took 1.97s
- Found SW-DP with ID 0x2BA01477
- DPIDR: 0x2BA01477
- CoreSight SoC-400 or earlier
- 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, ADDR: 0x00000000)
- AP[1]: JTAG-AP (IDR: 0x001C0000, ADDR: 0x01000000)
- 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
- Attach to CPU failed. Executing connect under reset.
- DPIDR: 0x2BA01477
- CoreSight SoC-400 or earlier
- 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, ADDR: 0x00000000)
- AP[1]: JTAG-AP (IDR: 0x001C0000, ADDR: 0x01000000)
- 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
- Could not find core in Coresight setup
- ConfigTargetSettings() start
- ConfigTargetSettings() end - Took 4us
- InitTarget() start
- SWD selected. Executing JTAG -> SWD switching sequence.
- Device will be unsecured now.
- Timeout while halting CPU.
- InitTarget() end - Took 1.30s
- Found SW-DP with ID 0x2BA01477
- DPIDR: 0x2BA01477
- CoreSight SoC-400 or earlier
- 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, ADDR: 0x00000000)
- AP[1]: JTAG-AP (IDR: 0x001C0000, ADDR: 0x01000000)
- 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
- Attach to CPU failed. Executing connect under reset.
- DPIDR: 0x2BA01477
- CoreSight SoC-400 or earlier
- 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, ADDR: 0x00000000)
- AP[1]: JTAG-AP (IDR: 0x001C0000, ADDR: 0x01000000)
- 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
- Could not find core in Coresight setup
- ERROR: Failed to connect.
Could not establish a connection to target.
General troubleshooting guide:
https://kb.segger.com/J-Link_Troubleshooting- ERROR: Connect failed
Furthermore, I captured SWD communication waveforms with a logic analyzer during mass erase process, and the operation sequence is as below:
- Read MDM-AP Status = 0x34
- Read MDM-AP Status = 0x36
- Write MDM-AP Control = 0x10
- Write MDM-AP Control = 0x01
- Write MDM-AP Control = 0x08
- Read MDM-AP Status = 0x35
Could anyone kindly help analyze the possible reasons causing this programming and connection failure? Thank you very much.