SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By crylla
I have installed OpenOCD onto a Raspberry Pi 3, following the instructions here: ... 32-and-RPi

OpenOCD appears to run ok and says that it is listening on port 3333 for GDB commands and on port 444 for telnet commands (it can be issued commands via either protocol)

According to the link above, it should be possible to send GDB or telnet commands remotely from a PC connected to the same network as the RPi.

However, when I try to connect to OpenOCD on port 3333 from a Windows 10 PC running a a gdb client:

(gdb) target remote

I get the error message: No connection could be made because the target machine actively refused it.

Similarly, if I try to connect to OpenOCD on port 4444 from a Windows 10 PC via telnet

C:\WINDOWS\system32>telnet 4444

I get the error message:

Connecting To not open connection to the host, on port 4444: Connect failed

If I run the following command on the Raspberry Pi

netstat -an | grep tcp

I get:

tcp 0 0* LISTEN
tcp 0 0* LISTEN
tcp 0 0* LISTEN
tcp 0 0* LISTEN
tcp 0 0* LISTEN
tcp 0 0* LISTEN
tcp6 0 0 :::5900 :::* LISTEN
tcp6 0 0 :::22

I can establish the following PC to RPi connections:
SSH, VNC and telnet on the standard port 23.

On the RPi, I can connect via telnet to port 4444 at the loopback address

I can also connect to port 3333 at The connection is immediately dropped , presumably because the GDB protocol is not used, however I thing this proves that OpenGDB is listening on this port.

I am not a network expert but I think the problem may be that OpenGDB is listening to ports 3333 and 4444 at the local loopback address instead of the generic (all addresses) address. So connection requests to the RPi's address on the local network are being ignored.

Earlier versions of Raspian and or RPi hardware did seem to work with OpenOCD so I am assuming that this has something to do with changes to the standard RPi network setup.

But eaqualy this could be a fault with OpenOCD not choosing the address correctly.

Does anyone have any ideas on how to solve this?

Here is the contents of my hosts file on the RPi: localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters raspberrypi

I have not been fiddling with any of the standard setup and have only installed OpenOCD and various application like telnet, telnetd and iperf in an attempt at diagnosing the problem.
I had an exactly same problem today. After a few minutes searching "" in the source code. I found the solution is actually in manual.

Command: bindto [name]
Specify hostname or IPv4 address on which to listen for incoming TCP/IP connections. By default, OpenOCD will listen on the loopback interface only. If your network environment is safe, bindto can be used to cover all available interfaces.

So just add "bindto" in your cfg file then it will work.
Thanks again iamseer, that did work.

I now have a new problem when I try to load software:

pi@raspberrypi:~/OpenOcd $ sudo openocd
Open On-Chip Debugger 0.10.0+dev-00430-g06123153 (2018-06-08-21:58)
Licensed under GNU GPL v2
For bug reports, read
BCM2835 GPIO nums: swclk = 25, swdio = 24
BCM2835 GPIO config: srst = 18
srst_only separate srst_gates_jtag srst_push_pull connect_deassert_srst
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_push_pull connect_deassert_srst
cortex_m reset_config sysresetreq
adapter_nsrst_delay: 100
adapter_nsrst_assert_width: 100
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : SWD only mode enabled (specify tck, tms, tdi and tdo gpios to add JTAG mode)
Info : clock speed 2002 kHz
Info : SWD DPIDR 0x5ba02477
Warn : Silicon bug: single stepping will enter pending exception handler!
Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0* stm32f7x.cpu cortex_m little stm32f7x.cpu running
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800cbdc msp: 0x20050000
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x10016449
Info : flash size = 1024kbytes
Info : SWD DPIDR 0x5ba02477
Error: Failed to read memory at 0xfffffffe
Info : SWD DPIDR 0x5ba02477
Error: Failed to read memory at 0xfffffffe
Info : SWD DPIDR 0x5ba02477
Error: Failed to read memory at 0x20050000
I should say that I am trying to upload firmware via VisualGDB running under Windows 10 so I think I need to understand how this package drives OpenOCD when it writes to flash. I think I probably need to add some commands into the config file on the RPi side because the config file and command line settings normally used on the PC side (for non remote driving) are being circumvented.

I will post here again if I figure it out.