ERROR: InitTarget(): PCode returned with error code -1

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

ERROR: InitTarget(): PCode returned with error code -1

Jump to solution
16,528 Views
jamesyim
Contributor I

I am working with my own boards(S32K144).

J-link can't connect the board :

Connecting to target...ERROR: InitTarget(): PCode returned with error code -1

ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
Shutting down...

(S32DS v2.0)

Connecting to target...ERROR: Kinetis (connect): Communication error while accessing MDM-AP.

ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
Shutting down...

(S32DS v1.3)

The code that may make it happen:

for(j=0;j<0x20;j++)
{
ret = FlashEraseSector(&flashSSDConfig, address+FSL_FEATURE_FLS_PF_BLOCK_SECTOR_SIZE*j, size, pCmdSequence);
}

Did anybody have a similar issue? Any ideas are welcomed.

 

Thank you very much.

0 Kudos
Reply
1 Solution
11,100 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm assuming that debugger and connection to board is okay. So - please check if the board is powered properly.  If yes  - you probably secured MCU by writing some unknown data to flash config address - 0x400. If it is your case - there is no way back. Secured chip has disconnected JTAG. 

If you have another debugger - for example PE Micro, you can try Emergency Kinetis device recovery option: 

pastedImage_1.png

If everything fails - the soldering iron is only option. 

Jiri 

View solution in original post

0 Kudos
Reply
6 Replies
11,100 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

You are probably erasing the part of FLASH where is your code present. Make sure that you are running RAM target if you like erase all FLASH memory.  

Jiri

0 Kudos
Reply
11,100 Views
jamesyim
Contributor I

Thank you for your help.

It is highly possible that I erase the part of FLASH where is my code present.

I burned the program with the Flash erase code . After that the board cannot work when I burn any other program including example .

I tried J-Flash. When I connected the board, I got the error.

I have made two boards not work.

Can you give me some advice to make the connection successful ?

Thank you very much.

捕获.JPG

0 Kudos
Reply
11,101 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm assuming that debugger and connection to board is okay. So - please check if the board is powered properly.  If yes  - you probably secured MCU by writing some unknown data to flash config address - 0x400. If it is your case - there is no way back. Secured chip has disconnected JTAG. 

If you have another debugger - for example PE Micro, you can try Emergency Kinetis device recovery option: 

pastedImage_1.png

If everything fails - the soldering iron is only option. 

Jiri 

0 Kudos
Reply
11,100 Views
andrew_thornbor
Contributor II

Hey Jiri,

I unfortunately have the same problem. Can you specify what you mean by the "Secured chip has disconnected JTAG"? So I can understand what is going on? Is the Secured chip the MCU or an external chip on the EVB.

More importantly, you specified that I have to use the soldering iron to solve this problem. Can you please go in more detail on what I solder where? It looks I have to solder the reset pin to a pin on the MCU but looking at the EVB schematic it looks like it is wired up directly? I am new to JTAG and this process.

I would like to solve this problem if possible.

Thank you so much and have a great day!

0 Kudos
Reply
11,100 Views
jiri_kral
NXP Employee
NXP Employee

Hi Andrew, 

if your chip is secured, back door key disabled and mass erase disabled - there is no way how to recovery MCU (as far as I know). Technically JTAG connection is cut off and you can't connect to MCU even with RAM target. If you are able connect at least with RAM Target project - you can recovery your MCU. 

Hope it helps. 

Jiri 

0 Kudos
Reply
11,100 Views
jamesyim
Contributor I

Thank you for your help. 

The soldering iron is the best option.

0 Kudos
Reply