stlink-V3 minie: works with stm32cubeprogrammer, but fails in openocd

Hello Everybody,

i have been spending my day on setting up a new ubuntu 22.04 workstation for working
on my daisy projects. Everything works ok in Arduino IDE (dfu and swd upload) , but unfortunately openocd does resist my efforts.

OS: ubuntu 22.04
Arduino IDE: upload via DFU … works
Arduino IDE: upload via SWD/stlin32 … works
vscode: build and program DFU … works
vscode: build and program … FAILS

Any help is appreciated.

Thank you

JT

How does it fail - any error messages? Missing Files reported by it? etc.

I’d check that it’s got a current version of openocd installed.

This is the error message:

openocd -s /usr/local/share/openocd/scripts -f interface/stlink.cfg -f target/stm32h7x.cfg
-c “program ./build/Blink.elf verify reset exit”
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
Info : auto-selecting first available session transport “hla_swd”. To override use ‘transport select ’.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1800 kHz
Error: open failed
in procedure ‘program’
** OpenOCD init failed **
shutdown command invoked

and openocd --version provides this:

Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting

While stm32programmer provides this overview

                    STM32CubeProgrammer v2.15.0                  
  -------------------------------------------------------------------

ST-LINK SN : 004A00263431511837393330
ST-LINK FW : V3J8M3
Board : STLINK-V3MINIE
Voltage : 3.30V
SWD freq : 8000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x450
Revision ID : Rev V
Device name : STM32H7xx
Flash size : 128 KBytes
Device type : MCU
Device CPU : Cortex-M7
BL Version : 0x90

openocd -s /usr/local/share/openocd/scripts -f interface/stlink.cfg -f target/stm32h7x.cfg
-c “program ./build/Blink.elf verify reset exit”
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
Info : auto-selecting first available session transport “hla_swd”. To override use ‘transport select ’.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1800 kHz
Error: open failed
in procedure ‘program’
** OpenOCD init failed **
shutdown command invoked

You need to update OpenOCD. 0.11.0 doesn’t know about stlink mini-E.

updated to 0.12.0. Now it is getting worse:

openocd -s /usr/local/share/openocd/scripts -f interface/stlink.cfg -f target/stm32h7x.cfg
-c “program ./build/Blink.elf verify reset exit”
Open On-Chip Debugger 0.12.0+dev-01528-g07141132a (2024-03-08-18:04)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
Error: The specified debug interface was not found (hla)
The following debug adapters are available:
1: buspirate

Did the openocd update install an updated stlink.cfg? This file needs an entry for
0x483 0x3754, which is the VendorID and Product ID for V3MINI-e

yes, it installed an updated version, actually both version are still on the system

And yes, i already checked the entry the ids are set correctly

In your ‘getting worse’ post, the only adapter listed is:
1:buspirate

Was that the complete list?

yes, this is it, just this one device

Looks to me like /usr/local/share/openocd/scripts/interface/stlink.cfg doesn’t exist, or doesn’t have VID and PID for the V3mini-e.

Here’s what it looks like on my Mac:

tele_player@mbp2 interface % ls -1
altera-usb-blaster.cfg
altera-usb-blaster2.cfg
arm-jtag-ew.cfg
at91rm9200.cfg
buspirate.cfg
calao-usb-a9260.cfg
chameleon.cfg
cmsis-dap.cfg
dln-2-gpiod.cfg
dummy.cfg
estick.cfg
flashlink.cfg
ft232r.cfg
ftdi
imx-native.cfg
jlink.cfg
jtag_dpi.cfg
jtag_vpi.cfg
kitprog.cfg
nds32-aice.cfg
nulink.cfg
opendous.cfg
openjtag.cfg
osbdm.cfg
parport.cfg
parport_dlc5.cfg
raspberrypi-native.cfg
raspberrypi2-native.cfg
rlink.cfg
rshim.cfg
stlink-dap.cfg
stlink-v1.cfg
stlink-v2-1.cfg
stlink-v2.cfg
stlink.cfg
sysfsgpio-raspberrypi.cfg
ti-icdi.cfg
ulink.cfg
usb-jtag.cfg
usbprog.cfg
vsllink.cfg
xds110.cfg

Good Day,

  1. thank you so much for your help, this is very much appriciated :slight_smile:
  2. I have been away from my office during the weekend and will return on wednesday, so
  3. I can currently not work on the openocd problem, but
  4. will come back to it in two days,

Best wishes JT

Hi I’m just getting off the starting blocks and managed to run into all of the above problems. :tired_face:

But I eventually managed to get the STLink working on Ubuntu 20.04.

  1. /usr/bin/openocd was 0.10, so I followed @tele_player and installed 0.12
  2. I built it from source, but didn’t --enable_stlink when I configured. Then got the error with “buspirate” the only available adapter.
  3. Fixing that I got LIBUSB_ERROR_ACCESS when trying to flash (unless I sudo:ed). In this case I missed the udev rules that you get from the package stlink-tools (apt install stlink-tools)
  4. But, at least for Ubuntu 20.04, the udev rules don’t support STLinkV3 MINIE, this patch fixed it
    Merge pull request #1281 from angiglesias/develop · stlink-org/stlink@5af42f7 · GitHub

And, hey, now it works!
/Carl

1 Like