First impression with KDS 1.1.0 Can't Debug FRDM-K64F with OpenOCD/CMSIS-DAP

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

First impression with KDS 1.1.0 Can't Debug FRDM-K64F with OpenOCD/CMSIS-DAP

Jump to solution
5,436 Views
schen
Contributor III

Just installed KDS 1.1.0.

 

Wrote a simple program using Processor Expert to blink an LED.

I tried an FRDM-KL25Z. It works with OpenOCD/CMSIS-DAP and OpenSDA/P&E GDB Server.

 

I tried an FRDM-K64F. Was able to get it to work with OpenOCD/Segger J-Link firmware but can't get it to go into debugger with OpenOCD/CMSIS-DAP.

I tried the latest firmware 20140530_k20dx128_k64f_if_mbed.bin. It displayed these messages in the Console then went silent:

13928_13928.jpgOpenOCD failed 2.jpg

When I manually switched to Debug perspective, I see this:

13929_13929.jpgOpenOCD failed 3.jpg

 

I tried an older version of the firmware: DEBUG_K64F_MBED_PEMICRO_V108.bin, which gave me the following error:

13927_13927.jpgFRDM-K64F OpenOCD failed.jpg

 

When I tried DEBUG-FRDM-K64F_Pemicro_v108.bin firmware, it would not communicate with P&E GDB Server.

13931_13931.jpgOpenSDA failed.jpg

 

Any suggestions are appreciated.

Labels (1)
0 Kudos
1 Solution
1,405 Views
BlackNight
NXP Employee
NXP Employee

Hello,

you really need to use

-f kinetis.cfg

otherwise I'm not surprised that you face problems.

Another issue I have seen with OpenOCD and CMSIS-DAP (at least with the 0203 firmware from the mbed site): You need to power the board twice before it can be debugged. There is a note about this in the release notes, but probably not clear.

As basic steps:

a) plug in the FRDM-K64F board (using the OpenSDA plug).

b) unplug the board

c) plug in the baord again

d) now you can debug the board with OpenOCD/CMSIS-DAP

It is not clear to me why this is so strange, but that way I was able to debug the board as expected.

I'll check if I have an example to post for printf().

Erich

View solution in original post

0 Kudos
8 Replies
1,405 Views
schen
Contributor III

Took a break from KDS. Reload with 20140530_k20dx128_k64f_if_mbed.bin and worked with mbed for a while.

I restarted KDS and now OpenOCD is working.

FRDM-K64F OpenOCD success.jpg

0 Kudos
1,405 Views
BlackNight
NXP Employee
NXP Employee

Hello,

if you have the mbed/CMSIS-DAP firmware loaded on your board, then you only can use it with a CMSIS-DAP aware connection (e.g. OpenOCD). So trying to connect to it with the P&E GDB server (or Segger GDB server too) will fail, so no surprise.

Your first screenshot indicates that you are not using the correct configuration kinetis.cfg file. See screenshot below.

The other thing I saw sometimes (and might be related to your issue): I have seen cases that if debug connection with CMSIS-DAP fails, it is necessary to re-power the board, and then it is ok. I have already filed a ticket about this.

pastedImage_0.png

I hope this helps,

Erich

1,405 Views
schen
Contributor III

Erich,

Thanks for the quick response.

For FRDM-K64F, I have tried three firmwares:

1. mbed/CMSIS-DAP firmware

2. P&E OpenSDA with GDB Server

3. Segger J-Link

Only #3 gave me consistent success debug connection.

#2 GDB Server gave me E17925  error all the time.

#1 debug connection is touchy. The first time I set it up, it would not work as described above. I play with mbed, reset, and disconnect/reconnect USB and it worked sometimes but not all the time. I have yet to find the pattern.  I did read that k64.cfg is deprecated and tried kinetis.cfg but kinetis.cfg did not get me anywhere. I finally realized that I should replace

-f target/k64.cfg

with

-f kinetis.cfg

but I was using

-f target/kinetis.cfg

and that seemed to be the problem.

I could get my simple blinking LED program to work most of the time now.

I wrote a program trying to use printf through virtual COM port following the directions from

UART printf() for the FRDM-K64F Board and Kinetis Design Studio | MCU on Eclipse

but I could not get the debugger launched.

The Console said "monitor halt" and the Debug window said

<terminated, exit value: -1>openocd

<terminated, exit value: 1>arm-none-eabi-gdb

I would not be surprised I have some bugs in my code but without getting into the debugger, it is difficult to find the bugs.

0 Kudos
1,405 Views
BlackNight
NXP Employee
NXP Employee

Attached is my example for UART printf on the FRDM-K64F board and KDS V1.1.0.

It has debug configurations for OpenOCD, P&E and Segger.

I verfied that on my end, and that works fine. Make sure you are using a terminal program with the correct COM port to the virtual COM (OpenOCD, Segger or P&E).

The project is availabl !e on GitHub too: mcuoneclipse/Examples/KDS/FRDM-K64F120M/K64_PEx_Printf at master · GitHub

I hope this helps,

Erich

1,405 Views
bilalarain
Contributor II

Hi Eric

I have experienced an error with OpenOCD. Please have a look my reply for details

Debugging on FRDM-K64F on KDS 1.1.1

I will appreciate your help in this regard

Bilal

0 Kudos
1,405 Views
schen
Contributor III

This is really helpful. Thanks.

0 Kudos
1,406 Views
BlackNight
NXP Employee
NXP Employee

Hello,

you really need to use

-f kinetis.cfg

otherwise I'm not surprised that you face problems.

Another issue I have seen with OpenOCD and CMSIS-DAP (at least with the 0203 firmware from the mbed site): You need to power the board twice before it can be debugged. There is a note about this in the release notes, but probably not clear.

As basic steps:

a) plug in the FRDM-K64F board (using the OpenSDA plug).

b) unplug the board

c) plug in the baord again

d) now you can debug the board with OpenOCD/CMSIS-DAP

It is not clear to me why this is so strange, but that way I was able to debug the board as expected.

I'll check if I have an example to post for printf().

Erich

0 Kudos
1,405 Views
schen
Contributor III

Thank, Erich. I would not have thought of powering the board twice is the solution but I did experience it. I ought to read the release note more carefully.

0 Kudos