11

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/

riQQ
  • 9,878
  • 7
  • 49
  • 66
Leonard1995
  • 141
  • 1
  • 2
  • 10
  • 2
    Check that the jumpers are correct on the dev board, particularly the one one for the ST-LINK and PSU (not sure wha jumpers are on the board.. Try turning everything off and on again. Try reinstalling the drivers. If it did work once and non of this fixes it I fear you may have damaged the board! – Realtime Rik Jun 29 '16 at 10:08
  • Thanks for your suggestions, I had removed all the jumpers on the development board and reinstall the drivers for 3 times but the problem still cannot fix. Besides, I am sure that my board is fine since I can program it using other laptop. – Leonard1995 Jun 29 '16 at 12:55
  • Can you connect to your ST-Link using the free software that you can download from ST? If yes, then it's an Atollic problem and presumably they have support for their product. – Andy Brown Jul 05 '16 at 08:06
  • I had figured out a stupid solution a few days ago where I copied the 'setting' file in my previous project to replace the 'setting' file in my current project, the problem was solved. But, when I compared the setting between my previous project and current project, it seem not differences. . – Leonard1995 Jul 07 '16 at 06:28
  • 2
    @KalmanRotert Hi, were you able to fix it? I have the same issue. My host is Ubuntu 16 LTS 64bit. Installed st-link, TRUEStudio, CUBEMx. I have the udev rules and can see several st related drivers in /dev folder. I connected STM32L476 Discovery board and tried running a LED blink program and bam "ST-Link enumeration failed. Error in initializing ST-Link device." lsusb also did not show the board. Checked the board on a Windows and it's fine. :( Reason: ST-Link DLL error." – jxgn Aug 16 '18 at 11:42

6 Answers6

4

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

IsaBostan
  • 60
  • 4
3

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.

MikeLemo
  • 521
  • 1
  • 5
  • 11
1

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.

Guillaume Michel
  • 1,189
  • 8
  • 14
1

From the documentation of a Nucleo-144 board, it can be few problems:

  1. Before connecting the Nucleo-144 board to a Windows® 7, Windows® 8 or Windows® 10 PC via USB, a driver for ST-LINK/V2-1 must be installed. It can be downloaded from the www.st.com website. In case the STM32 Nucleo-144 board is connected to the PC before installing the driver, the PC device manager may report some Nucleo interfaces as “Unknown”. To recover from this situation, after installing the dedicated driver, the association of “Unknown” USB devices found on the STM32 Nucleo-144 board to this dedicated driver, must be updated in the device manager manually It is recommended to proceed using USB Composite Device, as shown in the image enter image description here

  2. To program and debug the on-board STM32, place the two jumpers marked in red on the connector CN4, as shown in the image. The CN6 connector must not be used, since it could disturb the communication with the STM32 microcontroller of the Nucleo-144 board. enter image description here

66Ton99
  • 430
  • 6
  • 19
0

In the debugger tab, make sure to select SWD, not JTAG.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
-1

enter image description here This error occurs due to old firmware, Using the STLinkUpgrade tool, upgrade the firmware of the ST-LINK, ST-LINK/V2, and ST-LINK/V2-1 boards through the USB port.

Martin
  • 2,411
  • 11
  • 28
  • 30