OpenOCD init fails when programming via STLINK-V3MINIE

I’m using the ST-LINK MINIV3E debugger connected like this:


I am getting this error

Error: open failed
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

Is this debugger supported? I thought it was the same as the miniv3 but with a usb-c port.

FWIW I can see it in STM32CubeProgrammer

  22:21:28 : ST-LINK SN  : 0023000E4D4B500E20373831
  22:21:28 : ST-LINK FW  : V3J8M3
  22:21:28 : Board       : STLINK-V3MINIE


It looks like the pinouts are the same so it should be compatible with the regular miniv3. I think it’s probably some sort of issue in the makefile that can’t find it

I thought maybe I needed a new interface to use in the libDaisy/core Makefile but it looks like the stlink.cfg one should cover all V3 debuggers. OpenOCD/tcl/interface at mainline_master · arduino/OpenOCD · GitHub

I noticed a missing feature in the comparison, could this be the reason it won’t recognize it? I assumed the openocd uses JTAG but I’m not totally sure.

https://www.st.com/resource/en/technical_note/tn1235-overview-of-stlink-derivatives-stmicroelectronics.pdf

Installed this driver but it’s still not working.
https://www.st.com/en/development-tools/stsw-link009.html#documentation

I was able to flash a compiled blink.hex onto the seed using the st-link in stm32cubeprogrammer so I know everything is working correctly. I think this is probably a configuration issue with libDaisy.
image

I’m not sure about your particular error, but I’ve been using the MINIE with both a seed and submodule (on macOS).

A few details about how I got it working here: Patch.Init() and stlinkv3 - #9 by whatnot.

1 Like

Hey this worked for me thank you!

For anyone who comes across this, I installed openocd 0.12 from here and placed it into my DaisyToolChain. Then I set the OCD var in libDaisy/core/Makefile

OCD=/c/Program\ Files/DaisyToolchain/OpenOCD-20230202-0.12.0/bin/openocd.exe
1 Like

It looks like the debugger still uses the other openocd, I’m not sure where to change that.
image

If you go to settings and search for “cortex-debug.openocdPath” you can enter it in the settings.json file like this:

"cortex-debug.openocdPath": "C:/windows/style/path/with/forward/slashes/openocd"
1 Like

Thank you so much for documenting all of this. It’ll be helpful for users trying to get STLINK-V3MINIE working in the future.

Hey everyone, thanks for your help. I was also struggling with this setup until I found this post. Just wanted to confirm the steps, because for me they were tiny bit different, I’m on win11 btw:

  1. Download latest open ocd version from @angrydan link
  2. Unpack it to C:/Program Files (Daisy toolchain I have in the Documents folder)
  3. In libdaisy/core/Makefile changed line 15 to OCD="C:/Program Files/OpenOCD-20230202-0.12.0/bin/openocd.exe"
  4. In cortex debug settings scrolled down to windows openocd path, edited it in settings.json to be "cortex-debug.openocdPath.windows": "C:/Program Files/OpenOCD-20230202-0.12.0/bin/openocd.exe"
  5. [optional] for some reason debug session would still use powershell as a default terminal and it was giving me a bunch of errors, if you have the same problem (you can check which terminal is being used by hovering over it in vscode) then switch your default terminal to be gitbash as described here
3 Likes

HI All
Thank you for all these informations. It is very usefull…
But please can you explain a little bit more how to you access to the settings.json for the cortex debug.

Thanks againt

I have find !

Just click on the setting in the upper left corner “cortex debug”
Then go to the External GDB Servers

1 Like

went through all these guidelines, but still was getting

Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: read version failed
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

disconnecting and connecting STLINK back to USB solved the problem!