Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Re: Debug using ST LINK V2 (Read 221 times)
Kabron
Member
***
Offline



Posts: 102
Re: Debug using ST LINK V2
Jan 6th, 2020 at 10:44am
 
Hello, openocd, installed by VM(c:\ProgramData\VMicro\tools\openocd-0.10.0.1) does not see ST-LINK V2 at all. I.e. no any activities on SWCLK/SWDIO pins.
Code:
c:\ProgramData\VMicro\tools>openocd -f interface/stlink-v2.cfg -f board/st_nucleo_f4.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Warn : Interface already configured, ignoring
Error: already specified hl_layout stlink
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Error: open failed
in procedure 'init'
in procedure 'ocd_bouncer'
 


I found OpenOCD-20191216-0.10.0 from https://gnutoolchains.com/arm-eabi/openocd.
It works fine. I tried to substitute it the c:\ProgramData\VMicro\tools\openocd-0.10.0.1.
But VM discovered the wrong version and re-download it.
What do I need to do to make it work?

Thanks in advance,
Vladimir
Back to top
 
 
IP Logged
 
Simon Hopkinson
Administrator
*****
Offline



Posts: 115
Re: Debug using ST LINK V2
Reply #1 - Jan 6th, 2020 at 11:25am
 
From your output "Error: open failed", it looks like OpenOCD cannot find the STLink device at the USB layer.

Have you updated the driver for the STLink Device using the Zadig tool?

A walk through of the driver element can be seen for a different debugger in this Instructable (and there is a video guide at the bottom too).

It is the same steps but select the "STM32 STLink" device.

Then you should see the output change from running OpenOCD from the Open Failed to the below:
Code:
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2 

Back to top
 
 
IP Logged
 
Kabron
Member
***
Offline



Posts: 102
Re: Debug using ST LINK V2
Reply #2 - Jan 6th, 2020 at 11:57am
 
No, I did not used Zadig. And I'm not sure that it'll help. At the moment I cheated VM by replacing only openocd.exe and scripts folder.
As a resutl I could now launch debug session on STM32F411CEU6 board with ST-LINK V2 and ST-LINK V3 MINI.
The only unsolved moment is that new openocd gives error "file.elf" not found during programming phase. But it also solved
by choosing STM32CubeProgrammer(SWD) for uploading.
Back to top
 
 
IP Logged
 
Simon Hopkinson
Administrator
*****
Offline



Posts: 115
Re: Debug using ST LINK V2
Reply #3 - Jan 6th, 2020 at 12:10pm
 
It should help with the Visual Micro installed Open OCD due to the way it has been built, it will need these driver amendments.  The one you have manually installed may be built with different drivers, which is why it works without using Zadig.

Back to top
 
 
IP Logged
 
Kabron
Member
***
Offline



Posts: 102
Re: Debug using ST LINK V2
Reply #4 - Jan 6th, 2020 at 12:36pm
 
For the interest I tested all Zadig drivers and openocd-0.10.0.1. It does not work.
Back to top
 
 
IP Logged
 
Simon Hopkinson
Administrator
*****
Offline



Posts: 115
Re: Debug using ST LINK V2
Reply #5 - Jan 6th, 2020 at 12:44pm
 
Would it be possible to paste in the OpenOCD output when it works with your customized OpenOCD (in case it reveals anything further)?

With Compile + Debug > Verbose enabled, could we have the output from the Build and Micro Debug windows, just so we have as much information as possible?

At present I cant understand why it doesn't work on your setup with the standard OpenOCD we ship as it does for others (myself included).
Back to top
 
 
IP Logged
 
Kabron
Member
***
Offline



Posts: 102
Re: Debug using ST LINK V2
Reply #6 - Jan 6th, 2020 at 1:01pm
 
Files attached
Back to top
 

MicroBuildOut.txt (3 KB | 5 )
OpenocdTst.txt (1 KB | 3 )
 
IP Logged
 
Simon Hopkinson
Administrator
*****
Offline



Posts: 115
Re: Debug using ST LINK V2
Reply #7 - Jan 6th, 2020 at 2:01pm
 
Thanks for the additional information, and the output looks as mine does for the STLinkV2 (same VidPid etc...)

(Apologies if you have already done the below)

At present all I can think to do is to remove the "C:\ProgramData\VMicro\tools\openocd-0.10.0.1" folder, and then try debugging in Visual Micro again to pull down a clean copy of our tools.

Now the USB Driver is installed for our version I would expect it would connect at least to the debugger as you have in the alternative version.  We haven't changed any of the OpenOCD files around this debugger, hence my current confusion.
Back to top
 
 
IP Logged
 
Kabron
Member
***
Offline



Posts: 102
Re: Debug using ST LINK V2
Reply #8 - Jan 6th, 2020 at 3:29pm
 
Thought I mentioned that VM re-installed openocd automatically and it is not work, I repeated the procedure with no success.
It does not find ST-LINK regardless all zadig drivers.

At the moment OpenOCD-20191216-0.10.0 is more reliable solution for me. And it works regardless installed/ininstalled zadig drivers.
Back to top
« Last Edit: Jan 6th, 2020 at 3:38pm by Kabron »  
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print