Solution for OpenOCD “Cannot communicate… target not haltet”

Related to my earlier article about using OpenOCD, I want to share something I have learned (again) with OpenOCD v0.10.0:

I was running often into the following error:

Warn : Cannot communicate... target not halted.
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
OpenOCD cannot communicate

OpenOCD cannot communicate

I had to reflash/connect to the board with either P&E or Segger to be able to connect to the board with OpenOCD again.

Karibe is here to the rescue about anything on OpenOCD. The solution to the  “Cannot communicate… target not halted.” problem is to add this to the OpenOCD configuration (.cfg) file:

$_TARGETNAME configure -event gdb-attach {
   halt
 }
 $_TARGETNAME configure -event gdb-attach {
   reset init
 }

For OpenOCD v0.10.0 and NXP Kinetis L debugging I have added this to the scripts/target\klx.cfg file:

klx.cfg File

klx.cfg File

With this OpenOCD is able to connect to the NXP FRDM-KL46Z board :-).

Happy Halting 🙂

Advertisements

6 thoughts on “Solution for OpenOCD “Cannot communicate… target not haltet”

  1. I am using STM32F030K6x with ST-Link/V2, am still getting this error, it doesnt recognize the device connected “Cannot identify target as STM32 family”

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s