S32k116 Timeout while unsecuring device. Erase never stops.

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

S32k116 Timeout while unsecuring device. Erase never stops.

1,832 Views
vishal_roy
Contributor II

While i try to connect via Jlink SWD to my device i get the below response

J-Link>si swd
Selecting SWD as current target interface.
J-Link>device S32K116
J-Link>speed 4000
Selecting 4000 kHz as target interface speed
J-Link>erase
Target connection not established yet but required for command.
Device "S32K116" selected.
 

Connecting to target via SWD
InitTarget() start
InitTarget()
Device will be unsecured now.
Timeout while unsecuring device. Erase never stops.
InitTarget() end
Found SW-DP with ID 0x0BC11477
DPIDR: 0x0BC11477
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: 0x04770031)
AP[1]: JTAG-AP (IDR: 0x001C0020)
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()
Device will be unsecured now.
Timeout while unsecuring device. Erase never stops.
InitTarget() end
Found SW-DP with ID 0x0BC11477
DPIDR: 0x0BC11477
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: 0x04770031)
AP[1]: JTAG-AP (IDR: 0x001C0020)
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
 
InitTarget() start
InitTarget()
Device will be unsecured now.
Timeout while unsecuring device. Erase never stops.
InitTarget() end
Found SW-DP with ID 0x0BC11477
DPIDR: 0x0BC11477
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: 0x04770031)
AP[1]: JTAG-AP (IDR: 0x001C0020)
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()
Device will be unsecured now.
 
Timeout while unsecuring device. Erase never stops.
InitTarget() end
Found SW-DP with ID 0x0BC11477
DPIDR: 0x0BC11477
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: 0x04770031)
AP[1]: JTAG-AP (IDR: 0x001C0020)
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
 
Cannot connect to target.
J-Link>
 
Any help in unbricking this
0 Kudos
4 Replies

1,799 Views
vishal_roy
Contributor II

Any Comments!!

0 Kudos

1,822 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi vishal_roy,

Did you configure the PTC5 as GPIO? This pin is default as JTAG function. 

Please try to use the P&E Recovery Utility described in "Bricking and Recovering FRDM-KL25Z Boards: Reset, SWD Clock and Low Power".

 

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,814 Views
vishal_roy
Contributor II

Hi Robin,

Yes we are configuring PTC5 as GPIO ,from our previous conversation.

But we are using SWD interface to flash the MCU so this should not be an issue correct?

 There are about 2k devices with this MCU on field and more coming out of factory with this code where we configure this PIN as GPIO we do lot of erase and flashing during QA before it goes out. Have not faced such an issue on any other device. So that is why I wanted to know if I am missing something fundamental.

 

0 Kudos

1,780 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

If you only configure the PTC5 pin as GPIO, without modify SWD_DIO and SWD_CLK. Then using SWD interface connect MCU should not meet this issue.

Would you please let me know if you have enable any secure function?

Please follow "3.1.1 SWD connection steps" of AN12130.

AN12130.png

Could you please try to read the MDM_AP status and control registers first. Use J-link commander and these commands:

J-Link>r0                      // pull reset pin low

J-Link>swdwritedp 2,0x01000000 // MDM_AP status register

J-Link>swdreadap 0      // Read MDM_AP status register
J-Link>swdreadap 0      // Read MDM_AP status register (has to be done 2x) Flash memory ready and Mass erase enable bits should be set

J-Link>swdreadap 1      // Read MDM_AP control register
J-Link>swdreadap 1      // Read MDM_AP control register (has to be done 2x) 

J-Link>unlock Kinetis   // Erase and unsecure the MCU

//J-Link>swdwriteap 1,0x1 // Launch mass erase directly, set Control[0] = 1
 ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

For more information about the register please refer to Section "58.6 MDM-AP status and control registers", RM rev.12.1.

You should be able to see if the MCU secured (Status[2]), if the Mass Erase operation is enabled (Status[5]) and if the Flash memory is ready (Status[1]).

0 Kudos