IDE debugger initialization fails w/ STLINK V3: "open failed"

I'm also trying to get an STLINK V3SET probe working with my GIGA WiFi so far unsuccessfully. I'm on macOSX.

I select STLINK in the Programmers menu and click the Start Debugging button. GDB Server tries to start, OpenOCD gives Error: open failed.

It would seem that it can't find the STLINK probe and indeed the symptoms are the same whether the probe is attached via USB or not.

I have not found a way to specify which USB/serial port to use, and I've not configured the probe's serial number although I've seen it mentioned. There seems to be some implication that these two things are auto discovered but until it starts working they seem like big unaddressed questions to me.

Has anyone gotten an STLINK V3SET to work and what was the general process?

Here's the whole debug console output:

[2025-02-28T20:24:27.911Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/Users/joehuber/Library/Arduino15/packages/arduino/tools/openocd/0.11.0-arduino2/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /private/var/folders/zj/2tr0l6dj0_lb700x269gh4yw0000gn/T/.arduinoIDE-unsaved2025128-47952-1whpcql.rfh6/Demo -f "/Applications/Arduino IDE.app/Contents/Resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f /Users/joehuber/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.2.2/debugger/select_hla.cfg -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:57)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1800 kHz
Error: open failed


[2025-02-28T20:24:27.975Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

Hi @JoeHuber. Which exact STLINK do you have? There are several products that might be described as "STLINK V3", including:

It is possible that knowing which specific probe you are using might allow the forum helpers to more effectively assist you.


I have the STLINK-V3MINIE, but unfortunately haven't had any success using it. I reported my findings here:

Hi [quote="ptillisch, post:2, topic:1359078"]
Which exact STLINK do you have?
[/quote]

Thanks for the suggestion. I have the STLINK-V3SET which consists of two devices, the fully enclosed JTAG probe and an Adapter board. I'm only using the JTAG probe and haven't attached the Adapter board.

I've update my original post indicating it's the STLINK-V3SET.

I spent a lot of time reading other threads and it seems there's quite a complex set of possibilities for getting the virtual serial ports properly recognized. This and similar issues with OpenOCD seem to date back to 2010 and even before. So I'm tempted to find an alternative that doesn't depend on OpenOCD at all.

OK I made some progress. My main initial issue was a bad USB cable, DUH. The STLINK-V3SET uses a Micro USB connector and I have very few of those cables these days. The cable I grabbed may have even been designed just for charging and missing the data pins all together.

Anyway, with a good USB cable the Arduino IDE can see and generally control the STLINK. I didn't have to do anything special with the Mac OSX serial ports, they just worked. The RUN and STOP buttons now work, but the PAUSE button doesn't do anything and so I can't yet see anything about the state of the sketch.

Along the way I picked up a couple of useful tips:

  • Use the -D3 flag in the OpenOCD command line to get lots of debug info.
  • There are major differences among the STLINK probes such as their default operating mode after power up. Seems like a recipe for compatibility problems.
  • That document also outlines the blink codes for the two LEDs.

Next is figuring out how to get more of the basic Pause, Step and Break features working.

1 Like

OK success! Turns out to be quite easy to get the STLINK-V3SET probe to work with Arduino on Mac OSX after all. A few embarrassingly simple issues distracted me along the way but it's really just plug and play.

  1. Use a known good USB cable to connect the STLINK V3SET to your Mac. You can verify this by noting that a new USB device gets created.
  • Use a terminal window
  • cd /dev
  • ls -l tty.usb*
  • Look for a newly created device named something like tty.usbmodem14103
  • Double check the correlation by unplugging the cable to confirm that device goes away
  1. Select STLINK from the Arduino Tools--> Programmer menu
  2. Click the Start Debugging button (Third button at the top left of the main Arduino window)
  3. OpenOCD and GDB server should start up and successfully interrogate the GIGA and discover details about the STM32 chip
  4. The Play and Stop icons should Start and Stop your sketch.
  5. The Pause icon doesn't do anything for me.
  6. Scroll down to the Breakpoint panel and click + to add a Breakpoint. It wants a function name so I just used setup to get the hang of things.
  7. When it hits your breakpoint it stops and allows you to investigate variables and registers
  8. And the StepOver, StepIn and StepOut buttons all worked too!