Unable to flash the code TWR-K64

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

Unable to flash the code TWR-K64

2,497 Views
rinipatel
Contributor III

Hello all,

Board was running alright, and I think I might have used IRC48M as MCG external reference clock. The program crashed and now I'm unable to flash the new application on board.

I'm still able to upgrade the OpenSDA Bootloader firmware, and access MSD flash programmer. But not able to flash the code. Tried this with blhost, KinetisFlashTool, and KDS3.0. Every time initial ping to board seems to fail.

What could be the work around for this issue?

Thanks,

Rini

Tags (2)
0 Kudos
Reply
8 Replies

1,510 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Rini,

I am not sure whether your K64 is locked or reset repeatedly.

SEGGER offers a firmware running on the Freescale OpenSDA platform which makes OpenSDA compatible to J-Link Lite. Input "unlock kinetis" at J-Link Commander can mass erase the Kinetis MCU. The firmware of TWR-K64F120M can be download from this webpage. If the J-Link Commander can't identify the Cortex-M core, you need keep press down the reset buttom(SW2) and then reopen J-Link Commander.

jlink commander unlock kinetis.jpg

Then refer this Document download the KDS3.2 (it has fixed some known issues).

Using KDS3.2 debug or flash your code.

Best Regards,

Robin

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,510 Views
rinipatel
Contributor III

Hello Robin,

Thanks for the reply.With J-Link OpenSDA firmware running on K64, I'm getting below error in J-Link Commander.

jlink error.PNG

Regards,

Rini

0 Kudos
Reply

1,510 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Rini,

Have you try the method below?

1. Keep press down the reset buttom(SW2).

2. Open J-Link Commander.

3. Release the reset buttom. 

If the J-Link Commander can identify the Cortex-M core, then you can input "unlock kinetis" mass erase K64. After mass erasing you can launch the debugger and you should be able to connect/program the device again.

Best Regards,

Robin

0 Kudos
Reply

1,510 Views
rinipatel
Contributor III

Hello Robin,

Yes I've launched the J-Link commander while pressing down the reset (SW2). Still getting the same result.  It is not connecting to the target.

Regards,

Rini

0 Kudos
Reply

1,510 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Rini,

Please make sure the jumper settings are default on your TWR-K64F120M board, refer "Table 6. Jumper options and headers" in TWRK64F120MUG.

The version of my board is "SCH-27943 REV B1".

Rev of TWR-K64F120M.jpg

I tried to connect the board with different version  J-Link Commander(V4.90d V4.92 and V5.12f), all of them can identify the Cortex-M core.

When using J-Link Commander V5.12f, the LED D4 will turn off after connect and it will light (reset repeatedly) after mass erase.

J-Link Commander V5.12f.jpg

I am not sure whether you have secure or disable mass erase by using Flash security byte (FSEC) and Program Flash Protection (FPROT).

This "JLink on unsecure and erase Kinetis FLASH" may help if the K64 is secure.

You can attach the code here so that we can help you easier.

Have you try to flash a correct code(examples in Kinetis SDK Builder (REV 2 & 1.3) ) by using different IDEs(KDS3.2 or IAR)?

Best Regards,

Robin

0 Kudos
Reply

1,510 Views
rinipatel
Contributor III

Hello Robin,

1. Yes, jumper settings are default on my TWR-K64F120M board.

2. Board schematic version is "SCH-27943 REV B1".

3. I've downloaded the latest J-Link commander V5.12f, and LED D4 is blinking when I run the command. But as I stated earlier, it fails to connect with the target.

jlink error2.PNG

I'm trying to flash the pre-compiled example from QSP only. But apparently I can not get past to "Cannot connect to target" error and every other commands after that (e.g. unlock Kinetis, erase) fail. And I can't read Flash security byte (FSEC) and Program Flash Protection (FPROT) byte using mem command.

Regards,

Rini

0 Kudos
Reply

1,510 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Rini,

Have you observe the voltage of NMI_b(PTA4 Pin)?  NMI_b pin could lead to generate a non-maskable interrupt (NMI). If you don't need NMI function, please ensure it is high. The pullup resistor R64 is not place by default. The NMI_b Pin has a weak internal pullup, but an external 4.7 kΩ to 10 kΩ pullup is recommended.

NMI_b PTA4.jpg

And please attach your project here so that I can help you check whether it is caused by software.

Best Regards,

Robin

0 Kudos
Reply

1,510 Views
rinipatel
Contributor III

Hello Robin,

I'm getting 3.3 V NMI voltage, I can assure that board is not getting reset repeatedly.

Attached is the project space of the code which I last flashed on board from KSDK1.2.0.  Please have a look.

Thanks,

Rini

0 Kudos
Reply