Hi there,
I’m having problems with getting the STlink v3 Mini Debugger to work on OSX (M2).
What can I do?
this is my output:
Open On-Chip Debugger v0.12.0-esp32-20230419 (2023-04-21-16:09)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1800 kHz
Info : STLINK V3J7M2 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.217021
Info : [stm32h7x.cpu0] Cortex-M7 r1p1 processor detected
Info : [stm32h7x.cpu0] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32h7x.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
[stm32h7x.cpu0] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08009d58 msp: 0x20020000
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
** Programming Started **
Info : Device: STM32H74x/75x
Info : flash size probed value 128k
Info : STM32H7 flash has a single bank
Info : Bank (0) size is 128 kb, base address is 0x08000000
Info : Padding image section 2 at 0x080119e4 with 28 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x08011a00 .. 0x0801ffff
Error: error while writing to address 0x52002004
Error: error while writing to address 0x5200200c
Error: error during the lock of flash
Error: failed erasing sectors 0 to 0
Error: jtag status contains invalid mode value - communication failure
Polling target stm32h7x.cpu0 failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
** Programming Failed **
shutdown command invoked
make: *** [program] Error 1
My only suggestion is that you provide specific details about what you are doing, how you installed openocd, has it ever worked for you, anything else which might be useful.
I’m trying to get the blink example going.
On Linux I had no problems. On OSX it is my first try.
I’m using vscode. I installed openocd with brew.
I have a cable with an adapter (microUSB → USB_A → USB_A to USB_C Adapter)
What else could be relevant?
EDIT: on the output above I had openocd compiled from source, but meanwhile I reverted to the brew version.
Updated my firmware to V3J12M3 (had to use my old linux for that since there is a java hassle on the m2).
still no luck…
What do you mean by modifying the makefile?
I’m pretty sure there is a usb problem, but how to fix it?
Error: libusb_open() failed with LIBUSB_ERROR_OTHER
Error: open failed
Here my latest output:
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1800 kHz
Info : STLINK V3J12M3 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.193625
Info : [stm32h7x.cpu0] Cortex-M7 r1p1 processor detected
Info : [stm32h7x.cpu0] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32h7x.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
[stm32h7x.cpu0] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080006d4 msp: 0x20020000
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
** Programming Started **
Info : Device: STM32H74x/75x
Info : flash size probed value 128k
Info : STM32H7 flash has a single bank
Info : Bank (0) size is 128 kb, base address is 0x08000000
Info : Padding image section 1 at 0x08011598 with 8 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x080115a0 .. 0x0801ffff
Error: jtag status contains invalid mode value - communication failure
Error: error waiting for target flash write algorithm
Error: error while writing to address 0x5200200c
Error: error during the lock of flash
Error: error writing to flash at address 0x08000000 at offset 0x00000000
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32h7x.cpu0 failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
** Programming Failed **
shutdown command invoked
Your latest output doesn’t appear to have a USB problem.
is the ribbon cable correctly attached?
Is the Daisy known to be working correctly?
Does the Daisy load and run correctly using USB cable (program-dfu)?
I use a USB C to USB A adapter on my M1 MacBook Air with STLINK, it works correctly. You showed a libusb_open() error, but then you show that openocd is obviously connecting to the STLINK on USB. I don’t know what this might mean.
I asked if somebody had M2 on our Discord and one user said they should be getting one soon. I’ll keep you posted here. They’re planning on using ST Link with it ofc.
I unfortunately don’t have any news as I don’t have an M2 Mac. Though, there’s a possibility that it could not be related to it?
I saw you ping-ing another user who has an M2 and ST-Link, so I hope they might have some insight.
But yeah, since M2 is still new and not many people seem to have it yet, there is lack of resource on this online unfortunately.
By the way, did you use the brew to install libusb?
Could you go to /opt/homebrew/lib/ folder to see if the libusb-1.0.0.dylib file is installed there? I just wanna confirm that with you. That libusb error: -99 has existed for a while and even on Windows.