Failed to connect to device. Please check power and cabling to target.

Discuss how to use the features of Atollic TrueSTUDIO, including the editor, assembler, C/C++ compiler, linker, debugger, static code analysis and team collaboration tools.

Moderators: Markus Girdland, Mattias Norlander

P@A
Posts: 2
Joined: Wed Feb 28, 2018 6:25 pm

Failed to connect to device. Please check power and cabling to target.

Postby P@A » Wed Feb 28, 2018 6:42 pm

Hello,


we are using (amongst other STM32 CPUs) a STM32F405. At one series of our mainboards, we are unable to transmit the firmware to the target via TrueStudio V 9.0.0.

The connection between our PC and our target is a ST-LINK/V2. The STM32 ST-LINK Utility is able to detect our target and to update the firmware (from a .hex file) with the settings which are seen in "Settings.png".

Contrary, TrueStudio reports the following after we press the "Debug" button:

Starting server with the following options:
Persistant Mode : Disabled
LogFile Name : debug_log.txt
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled

Device connect error

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


We assume that we should reconfigure TrueStudio to use the settings which are successful for the STM32 ST-LINK Utility, but we did not figure out yet how we could achieve this. When we open "Run" and choose "Debug Configurations..." and go to the "Startup Scripts", we have no settings within "Target Hardware Initialization Script". Within "Target Software Startup Scripts", we have the default settings:

# Set flash parallelism mode to 32, 16, or 8 bit when using STM32 F2/F4 microcontrollers
# 2=32 bit, 1=16 bit and 0=8 bit parallelism mode
monitor flash set_parallelism_mode 2

# Set character encoding
set host-charset CP1252
set target-charset CP1252

# Load the program executable
load

# Reset the chip to get to a known state. Remove "monitor reset" command
# if the code is not located at default address and does not run by reset.
monitor reset

# Enable Debug connection in low power modes (DBGMCU->CR)
set *0xE0042004 = (*0xE0042004) | 0x7

# Set a breakpoint at main().
tbreak main

# Run to the breakpoint.
continue


Is this script the place where we can reconfigure the connection settings and the reset mode to the configuration which is working with the STM32 ST-LINK Utility? If yes, what shall we configure there in order to achieve the same settings?
If no, what can we do in order to become able to program and to debug this target via TrueStudio V 9.0.0?


Thanks in Advance,
M
You do not have the required permissions to view the files attached to this post.

mablejames
Posts: 2
Joined: Wed Sep 06, 2017 7:09 pm

Re: Failed to connect to device. Please check power and cabling to target.

Postby mablejames » Thu Mar 15, 2018 11:56 pm

Hm... this is really strange problem. I can't identify what caused it. Have you found solution or not?
Hi! Can somebody advise me top 10 online casinos sites?

P@A
Posts: 2
Joined: Wed Feb 28, 2018 6:25 pm

Re: Failed to connect to device. Please check power and cabling to target.

Postby P@A » Fri Mar 16, 2018 6:28 am

Yes, in fact this issue resolved to two issues, both of them were our fault:

First, the quoted error message

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


happened because while collecting of all information for this post, I used also the STM32 ST-LINK Utility. This error message occurs because I did not close/disconnect the STM32 ST-LINK Utility before I started to debug via TrueStudio.
If the STM32 ST-LINK Utility is not running (or at least disconnected), the error message from TrueStudio is different ... it would be then:

Error in initializing ST-Link device.
Reason: Failed to reset target.


The reason of this error is, that the reset-pin of the to-be-programmed STM32F4 was connected to our STM32F3. We kept this reset pin as output of the STM32F3 also when it was 1 (= no reset) ... and for some reason, the ST-LINK/V2 was unable to pull the reset of the STM32F4 to 0 when the STM32F3 wanted to have it at 1.
We did not think about this possibility for a long time because the same ST-LINK/V2 in combination with the STM32 ST-LINK Utility obviously was able to update the firmware.

So the solution to the overall problem was to redefine the pin of our STM32F3 to input when we do not need to reset the STM32F4. With this pin-configuration, also TrueStudio is able to download and to debug the firmware of the STM32F4.

In addition, the Atollic support has pointed us to the chapter "Using ST-link utility inside Atollic TrueSTUDIO" on page 194 of the user guide. There, information should be available how to use the STM32 ST-LINK Utility out of TrueStudio for download and debug purposes ... at the end, we did not use this information because everything started to work directly out of TrueStudio.
The referenced user guide can be opened out of the "Information Center" of TrueStudio (see "Help" - "Information Center" and check the "Integrated Development Environment" group within the "Documentation center" column ... there is a "User guide" link which opens this user guide).


Best Regards,
M

dave.best@sage.com
Posts: 1
Joined: Fri Apr 27, 2018 2:36 pm

Re: Failed to connect to device. Please check power and cabling to target.

Postby dave.best@sage.com » Fri Apr 27, 2018 2:55 pm

I am seeing the same error message from V9.0.1

'Launching our_software.elf' has encountered a
problem.

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

Similar to the original submitter, I too can use ST-Link Utility
successfully. The utility easily attaches to the target and
is capable of inspecting and writing memory. Then I disconnect
and exit the utility, and try to debug in Atollic and I get the
message above.

It has worked. I have been developing and debugging for about
3 weeks with all the same equipment with no issues. The error
message just started yesterday. I have tried a different ST-Link
module, different USB cables, different target cables and different
target boards... Keep in mind those changes don't seem to matter
- the ST-Link utility works flawlessly with the same equipment that
Atollic cannot connect through.

Thanks for any help you can offer.

Dave

mhnasseri
Posts: 3
Joined: Wed Feb 20, 2019 9:38 am

Re: Failed to connect to device. Please check power and cabling to target.

Postby mhnasseri » Wed Feb 20, 2019 9:40 am

Hi,
I Have the same problem. any solution?

alexsmith789
Posts: 1
Joined: Tue Mar 12, 2019 9:10 am

Re: Failed to connect to device. Please check power and cabling to target.

Postby alexsmith789 » Tue Mar 12, 2019 9:30 am

I tried to connect the device by any means but every time it failed. The power cable was working the problem as I have tested it with another device. Still, I was getting lenovo laptop screen flickering issue which was really harassing me a lot.

rawand
Posts: 3
Joined: Sun Mar 17, 2019 7:30 am

Re: Failed to connect to device. Please check power and cabling to target.

Postby rawand » Sun Mar 17, 2019 7:33 am

One of the worst problem I've faced.Have you found solution?
Graduated from Soran University with First Class Degree with Honours in Computer Science.

NVade
Posts: 2
Joined: Thu Apr 18, 2019 1:35 pm

Re: Failed to connect to device. Please check power and cabling to target.

Postby NVade » Thu Apr 18, 2019 1:44 pm

For me changing port to 7869 (just randomly typed) solved problem.

eldar.mahmudov
Posts: 1
Joined: Sun May 26, 2019 6:26 pm

Re: Failed to connect to device. Please check power and cabling to target.

Postby eldar.mahmudov » Sun May 26, 2019 6:30 pm

Hi.
I had same problem too.
I solved this with closing application STM32 ST-LINK Utility this application prevent connection with stlink because its using same connection too and when i closing this application stlink debug begun working

jprinster
Posts: 3
Joined: Wed Jul 11, 2018 11:01 pm

Re: Failed to connect to device. Please check power and cabling to target.

Postby jprinster » Wed Jul 17, 2019 4:05 pm

I have the same problem. Even when ST-LINK Utility is closed the error occurs. Specifically I get the following:
Target unknown error 19
Error in initializing ST-LINK device.
Reason: Unknown. Please check power and cabling to target.


Return to “Atollic TrueSTUDIO tool discussions”

Who is online

Users browsing this forum: No registered users and 4 guests