Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in initializing ST-Link Device - Failed to connect to device

I am currently using the ST-Link debugger to program my STM32F3 Discovery Board. The IDE that I am using is Atollic TrueStudio 5.5.2. Now I am facing a very weird problem which is I keep on getting the message

Error in initializing ST-Link Device. Reason : (-1) Failed to connect to device . Please check power and cabling to target.

whenever I want to download the program into my STM32. I have tried some solutions that I found from internet but the problem still exists. Has anyone faced this problems before? Any suggestions will help. enter image description here

Here is the solution I found, but I doesn't work for me. http://www.kerrywong.com/2012/08/02/the-dreaded-cannot-connect-to-st-link-error-message/

like image 238
Leonard1995 Avatar asked Jun 29 '16 07:06

Leonard1995


3 Answers

I had same situation on Ubuntu. I solved this, using STM32CubeProgrammer.

On the ST-LINK configuration area:

  1. Serial number -> refresh to get your stlink serial
  2. Mode: Under reset
  3. Reset mode: Core reset

try to connect asap when power your board. When you connect you can do "full chip erease". It suppose to be ready for next usage. I hope it helps

like image 90
IsaBostan Avatar answered Nov 15 '22 02:11

IsaBostan


Not an expert in the whole PC stuff but I found out in windows 10 using external ST-LINK V2 from aliexpress that the PC machine might select the wrong driver per device by default and what you do to fix that is to simply change the corresponding driver for the device.

Here's how you do it:

Hit Windows key 
Type "device manager"
Locate connected ST link device Right click-> "Update driver"
browse my PC -> Let me pick from a list available
and there you want to select STLink Dongle Version:("Your most recent")

And that pretty much fixed all my problems.

like image 30
MikeLemo Avatar answered Nov 15 '22 04:11

MikeLemo


You could try the following.

Make sure that you have installed the right version of the driver (32 or 64 bits).

If you are using an external ST-Link, make sure that you connect VCC, GND, RESET, SWDIO and SWDCLK.

If you are using an external ST-Link, make sure that Atollic is using the right one. You may have 2 ST-link connected (the external and the embedded one).

Ensure that the ST-Link is setup in SWD mode and not in JTAG.

In Atollic, you could also change how the ST-Link connects to your target. Try different combinations, for example Connect under hardware reset.

like image 1
Guillaume Michel Avatar answered Nov 15 '22 03:11

Guillaume Michel