Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Re: Debug using ST LINK V2 (Read 4798 times)
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Debug using ST LINK V2
Jan 6th, 2020 at 10:44am
Print Post  
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
Select All
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@Visual Micro
Administrator
*****
Offline


Posts: 2142
Joined: Feb 13th, 2019
Re: Debug using ST LINK V2
Reply #1 - Jan 6th, 2020 at 11:25am
Print Post  
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
Select All
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
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Debug using ST LINK V2
Reply #2 - Jan 6th, 2020 at 11:57am
Print Post  
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@Visual Micro
Administrator
*****
Offline


Posts: 2142
Joined: Feb 13th, 2019
Re: Debug using ST LINK V2
Reply #3 - Jan 6th, 2020 at 12:10pm
Print Post  
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
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Debug using ST LINK V2
Reply #4 - Jan 6th, 2020 at 12:36pm
Print Post  
For the interest I tested all Zadig drivers and openocd-0.10.0.1. It does not work.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2142
Joined: Feb 13th, 2019
Re: Debug using ST LINK V2
Reply #5 - Jan 6th, 2020 at 12:44pm
Print Post  
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
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Debug using ST LINK V2
Reply #6 - Jan 6th, 2020 at 1:01pm
Print Post  
Files attached
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2142
Joined: Feb 13th, 2019
Re: Debug using ST LINK V2
Reply #7 - Jan 6th, 2020 at 2:01pm
Print Post  
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
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Debug using ST LINK V2
Reply #8 - Jan 6th, 2020 at 3:29pm
Print Post  
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.
« Last Edit: Jan 6th, 2020 at 3:38pm by Kabron »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2142
Joined: Feb 13th, 2019
Re: Debug using ST LINK V2
Reply #9 - Mar 4th, 2020 at 12:51pm
Print Post  
The latest release of Visual Micro also contains an updated OpenOCD version, which may help with this problem as it is far more up to date than the one which was previously installed.

The updated OpenOCD download is available hereif you want to try it manually / command line.
  
Back to top
 
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Debug using ST LINK V2
Reply #10 - Mar 4th, 2020 at 3:11pm
Print Post  
Thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint