Hi,
I accidently reprogrammed the option bytes from region 0x400 to 0x40f and now I am not able to erase the device anymore. I can connect with Jlink Commander and I tried to start a mass erase as described in this question: Unbricking S32K146 - NXP Community but it does not seem to work
SEGGER J-Link Commander V7.56a (Compiled Oct 11 2021 16:33:05)
DLL version V7.56a, compiled Oct 11 2021 16:31:49
Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Oct 6 2021 11:22:15
Hardware version: V11.00
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
VTref=4.999V
Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: S32K146
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>
Device "S32K146 (ALLOW SECURITY)" selected.
Connecting to target via SWD
InitTarget() start
InitTarget()
Active Kinetis write protection detected. This could cause problems during flash download.
Note: Unsecuring will trigger a mass erase of the internal flash.
Executing default behavior previously saved in the registry.
Device will be unsecured now.
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]: 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
[0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
[0][1]: E0001000 CID B105E00D PID 003BB002 DWT
[0][2]: E0002000 CID B105E00D PID 002BB003 FPB
[0][3]: E0000000 CID B105E00D PID 003BB001 ITM
[0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
Initializing 126976 bytes work RAM @ 0x1FFF0000
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
T-bit of XPSR is 0 but should be 1. Changed to 1.
Cortex-M4 identified.
J-Link>r0
J-Link>swdwritedp 2,0x01000000
Write DP register 2 = 0x01000000
J-Link>swdreadap 0
Read AP register 0 = 0x40000001
J-Link>swdreadap 0
Read AP register 0 = 0x0001003B
J-Link>swdreadap 1
Read AP register 1 = 0x0001003B
J-Link>swdreadap 1
Read AP register 1 = 0x00000000
J-Link>unlock Kinetis
Found SWD-DP with ID 0x2BA01477
Unlocking device...O.K.
J-Link>swdwriteap 1,0x01
Write AP register 1 = 0x00000001
J-Link>
Any Hints on what is going wrong. Or is there any other way to start a mass erase and restore the bytes from section 0x400 to 0x40F. Just for my understanding I would also like to know how I can read out the Read-only identification register (0x3F) from the MDM-AP with Jlink just so I can check that I am doing everything right.
Thank you in advance