I recently bought the STLINK-V3MINIE, but haven't actually tried it out until now (I have used the ST-LINK/V2 previously). Unfortunately I was disappointed with my findings.
The first problem I encountered was the debugger initialization failing with "Error: open failed
":
"C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\per\\AppData\\Local\\Temp\\.arduinoIDE-unsaved20241013-2888-1sut77h.opth\\Blink" -f "C:/arduino-tools/253-63e9dfd/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f "C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.2.1/debugger/select_hla.cfg" -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:45)
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
When I looked in interface/stlink.cfg
(full path: C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.11.0-arduino2\share\openocd\scripts\interface\stlink.cfg
), I discovered that the 0483:3754
VID/PID pair of my STLINK-V3MINIE was not present in the file's hla_vid_pid
command:
I added it:
hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 0x0483 0x3754
but the initialization fails with the same error. But there is a warning that explains this result:
Warn : ignoring extra IDs in hla_vid_pid (maximum is 8 pairs)
So openocd has an idiotic arbitrary limitation of eight VID/PID pair arguments of the hla_vid_pid
command and it happens there were already eight, so when I added 0x0483 0x3754
that made it nine, so my addition was ignored. Fine, I'll play the game and remove one of the other VID/PID pairs to get back to eight:
hla_vid_pid 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 0x0483 0x3754
Now the debugger initialization fails with a new error:
"C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\per\\AppData\\Local\\Temp\\.arduinoIDE-unsaved20241013-2888-1sut77h.opth\\Blink" -f "C:/arduino-tools/253-63e9dfd/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f "C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.2.1/debugger/select_hla.cfg" -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:45)
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: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: read version failed
I am familiar with the "libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
" error from other debug probes. With those, I fixed the error by using Zadig to install the WinUSB driver. But when I selected the "ST-Link Debug (Interface 0)" device in Zadig, I found it was already using WinUSB driver, but an older version (2.2.0.0) than the one available via Zadig (6.1.7600.16385). I was able to update the driver by clicking the ▼ icon to the right of the button in the Zadig window, then selecting "Replace Driver" from the menu, but even after that I still got the same "libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
" error when I tried starting the Arduino IDE debugger again. I gave the "libusbK" driver a try, but had the same result.
So I gave up on Windows and switched over to my Linux machine. Initialization now failed with the familiar "Error: open failed
" message:
/home/per/.arduino15/packages/arduino/tools/openocd/0.11.0-arduino2/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /tmp/.arduinoIDE-unsaved20241013-7495-98i1n1.0szhk/Blink -f /home/per/arduino-tools/2.x/249-2.3.3/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl -f interface/stlink.cfg -f /home/per/.arduino15/packages/arduino/hardware/mbed_giga/4.2.1/debugger/select_hla.cfg -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:49)
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
This was expected due to the VID/PID pair being missing from interface/stlink.cfg
on my Linux machine. I made the same modification to the file as I described above, then tried again. This time it failed with a new error:
/home/per/.arduino15/packages/arduino/tools/openocd/0.11.0-arduino2/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /tmp/.arduinoIDE-unsaved20241013-7495-98i1n1.0szhk/Blink -f /home/per/arduino-tools/2.x/249-2.3.3/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl -f interface/stlink.cfg -f /home/per/.arduino15/packages/arduino/hardware/mbed_giga/4.2.1/debugger/select_hla.cfg -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:49)
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: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: open failed
I am familiar with the "libusb_open() failed with LIBUSB_ERROR_ACCESS
" error from other debug probes and boards. This just means that the user account doesn't have write access to the device, to be fixed by installing the appropriate udev rules file. I did that by running this command:
printf \
'SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="3754", MODE="0666", TAG+="uaccess"
' | \
sudo \
tee \
"/etc/udev/rules.d/60-STLINK-V3.rules" \
&& \
sudo \
udevadm \
control \
--reload-rules \
&& \
sudo \
udevadm \
trigger
Now the initialization fails with the "Error: read version failed
" message (which I note was present in addition to the LIBUSB_ERROR_NOT_SUPPORTED
error on my Windows machine as well):
/home/per/.arduino15/packages/arduino/tools/openocd/0.11.0-arduino2/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /tmp/.arduinoIDE-unsaved20241013-7495-98i1n1.0szhk/Blink -f /home/per/arduino-tools/2.x/249-2.3.3/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl -f interface/stlink.cfg -f /home/per/.arduino15/packages/arduino/hardware/mbed_giga/4.2.1/debugger/select_hla.cfg -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.11.0+dev-gab95bac57-dirty (2021-05-11-10:49)
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: read version failed
I did some research on this "Error: read version failed
" message and it seems the problem is that version 0.11.0 of openocd doesn't have support for STLINK-V3MINIE and the solution is to use 0.12.0 instead. I grabbed the build from the asset on the release page here (I had switched back to my Windows machine), replaced the arduino:openocd@0.11.0-arduino2
installation with those files (note that they have remove the eight VID/PID pair limit and added the added the 0483:3754
VID/PID pair to interface/stlink.cfg
in 0.12.0), and tried again:
"C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\per\\AppData\\Local\\Temp\\.arduinoIDE-unsaved20241013-2888-1sut77h.opth\\Blink" -f "C:/arduino-tools/253-63e9dfd/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f "C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.2.1/debugger/select_hla.cfg" -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.12.0 (2023-01-14-23:37)
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
Info : STLINK V3J8M3 (API v3) VID:PID 0483:3754
Info : Target voltage: 3.272289
Error: [stm32h7x.cpu0] Cortex-M PARTNO 0x0 is unrecognized
Warn : target stm32h7x.cpu0 examination failed
Info : starting gdb server for stm32h7x.cpu0 on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
Error: Target not examined yet
Error executing event gdb-attach on target stm32h7x.cpu0:
Error: Target not examined yet
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
I tried adding gdb_memory_map disable
to interface/stlink.cfg
as suggested by the error, but I still get a similar error after doing that:
"C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.11.0-arduino2/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\per\\AppData\\Local\\Temp\\.arduinoIDE-unsaved20241013-2888-1sut77h.opth\\Blink" -f "C:/arduino-tools/253-63e9dfd/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f interface/stlink.cfg -f "C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.2.1/debugger/select_hla.cfg" -f target/stm32h7x_dual_bank.cfg
Open On-Chip Debugger 0.12.0 (2023-01-14-23:37)
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
Info : STLINK V3J8M3 (API v3) VID:PID 0483:3754
Info : Target voltage: 3.273896
Error: [stm32h7x.cpu0] Cortex-M PARTNO 0x0 is unrecognized
Warn : target stm32h7x.cpu0 examination failed
Info : starting gdb server for stm32h7x.cpu0 on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
Error: Target not examined yet
Error executing event gdb-attach on target stm32h7x.cpu0:
Error: Target stm32h7x.cpu0 not examined yet, refuse gdb connection 1!
Error: attempted 'gdb' connection rejected
So I gave up at this point. Hopefully someone else will have a better idea of how to proceed. I'm certainly interested in finding a way to use my STLINK-V3MINIE.
It is possible that some of this experience is specific to the STLINK-V3MINIE I have, and wouldn't occur for you if you have a different STLINK-V3 models (at least the VID/PID pair stuff is likely not universal).