cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE debugger: Target unknown error 19 Error in initializing ST-LINK device

MNich
Associate

I am trying to debug with the STM32CubeIDE but it fails with message:

...

Verifying ...

Download verified successfully 

Target unknown error 19

Error in initializing ST-LINK device.

Reason: Unknown. Please check power and cabling to target.

Failed to restart ST-LINK connection

Error in STM32CubeProgrammer

Target is not responding, retrying...

Target is not responding, retrying...

...

see full STM32CubeProgrammer.log attached.

I am using the STM32H753I-EVAL board and a Linux PC (Ubuntu 1604 LTS).

However, debugging is successful with Atollic TrueStudio so I think the hardware is ok and the problem is with the STM32CubeIDE.

I have also attached .launch and .prefs files from working and non working environments for comparison:

STM32CubeIDE (fails):

cube_ide_eval_board Debug.launch

org.eclipse.cdt.core.prj-cube_ide_eval_board.prefs

Atollic TrueStudio (succeeds):

eval_H7cube.elf.launch

com.atollic.truestudio.debug.hardware_device.prefs

I would like to get this running and use the latest tools.

However, I'm new to the STM32 hardware and IDE's and not sure what the benefits of STM32CubeIDE over Atollic TrueStudio are?

18 REPLIES 18
Xiangyu Chen
Associate

For now(1.0.2) the stm32cubeide stlink upgrade plugin is not up-to-date, download a stsw-link007 software from the ST website and upgrade the firmware of ST-link will solve this issue.

DCosa
Associate

I had the same issue with the older ST-Link firmware. Once I upgraded to the latest version (using latest stsw-link007) the debugger started working fine

JBere
Associate II

I have upgraded ST-Link v2.1 to V2J33S7, using STM32CubeProgrammer, and use with a developed board with H743 and works fine with STM32CubeIDE 1.0.2 for debugging. But using NucleoH743ZI2, that already have a STLinkV3, does not work for me, same issue as described above.

JBere
Associate II

The issue debugging with NucleoH743ZI2 also solved upgrading firmware to V3J3M2

STMicroelectronics ST-LINK GDB server. Version 5.3.2

Copyright (c) 2019, STMicroelectronics. All rights reserved.

Starting server with the following options:

       Persistent Mode           : Disabled

       Logging Level             : 1

       Listen Port Number        : 61234

       Status Refresh Delay      : 15s

       Verbose Mode              : Disabled

       SWD Debug                 : Enabled

Waiting for debugger connection...

Debugger connected

sh: 1: Encountered Error when opening /home/dnk116/stm32cubeide(1.1.0)/en.en.st-stm32cubeide_1.1.0_4551_20191014_1140_amd64.sh/st-stm32cubeide_1.1.0_4551_20191014_1140_amd64.sh.root/cubemx_1.1.0/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.linux64_1.1.0.201910081157/tools/bin/STM32_Programmer_CLI

Error in STM32CubeProgrammer

Syntax error: word unexpected (expecting ")")

Debugger connection lost.

Shutting down...

DevBee
Associate II

Please try OpenOCD option in Debugger Options (Debug -> Configuration -> Debugger -> Debug Probe.

This worked for me on Linux.

You may also try installing Segger Jlink firmware instead of STLink for Linux as well as windows. This worked for me on Linux as well as windows.

JesseAusMon
Associate

Hey Guys,

I am using V1.0.2 of STM32CubeIDE and am getting the issue above. I've tried updating the STLink to the latest firmware version that the cube suggests but that doesn't solve the issue. Also tried putting in (ST-LINK FW : V2J33S7) as suggested above but still no luck.

The chip I am using is STM32F103VCT6. I basically create a project in the cube with this chip and select SYS-> Debug: Serial Wire in the pin allocation page and then try to build and debug it.

I've triple checked that I have connected the following signals correctly to the STLink V2 programmer to my WizNet W5100S-EVB dev board:

1) Target VDD

2) GND

3) SWDCLK

4) SWDIO

5) NRESET

I can program a binary in through the STLink programming utility but I cant seem to get the debug functionality happening, so that makes me think the hardware is ok.

Any help would be appreciated, console log below:

STMicroelectronics ST-LINK GDB server. Version 5.2.3

Copyright (c) 2019, STMicroelectronics. All rights reserved.

Starting server with the following options:

    Persistent Mode      : Disabled

    Logging Level       : 1

    Listen Port Number     : 61234

    Status Refresh Delay    : 15s

    Verbose Mode        : Disabled

    SWD Debug         : Enabled

Waiting for debugger connection...

Debugger connected

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.1.0          

   -------------------------------------------------------------------

Log output file:  C:\Users\JESSE~1.KOV\AppData\Local\Temp\STM32CubeProgrammer_a09120.log

ST-LINK SN : 54FF69067880565330600267

ST-LINK FW : V2J33S7

Voltage   : 3.25V

SWD freq  : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x414

Device name : STM32F101/F103 High-density

Flash size : 256 KBytes

Device type : MCU

Device CPU : Cortex-M3

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_a09120.srec

 File     : ST-LINK_GDB_server_a09120.srec

 Size     : 6020 Bytes

 Address    : 0x08000000 

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 2]

Download in Progress:

File download complete

Time elapsed during download operation: 00:00:00.556

Verifying ...

Download verified successfully 

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Error! Failed to read target status 

Debugger connection lost.

Shutting down...

JesseAusMon
Associate

Solved my issue with this solution.

https://stackoverflow.com/questions/56673154/stm32-cube-ide-true-studio-connect-under-reset

"I found the problem of the code, why the upload just works one time after full erase:

Cube IDE generate the HAL_MspInit() in ..stm32f1xx_hal_msp.c which contains:

__HAL_AFIO_REMAP_SWJ_DISABLE();

With that all debug stuff will be disabled after first flash. With changing this line to:

__HAL_AFIO_REMAP_SWJ_NOJTAG();

The Debug mode works fine and several times in a row."

SpinKernel
Senior

Mine gets all the way to the end, then just disconnects..

IDE v1.3.1

Ubuntu 20.04

*** update ****

Just tested this on my Windows 10 machine, i have the same issue. So this might be a firmware issue with the NUCLEO F091RC

STMicroelectronics ST-LINK GDB server. Version 5.5.0
Copyright (c) 2019, STMicroelectronics. All rights reserved.
 
Starting server with the following options:
        Persistent Mode            : Disabled
        LogFile Name               : /home/dustin/repos/release-ctrl/barebones/Debug/st-link_gdbserver_log.txt
        Logging Level              : 31
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Enabled
        SWD Debug                  : Enabled
 
Target connection mode: Attach
Hardware watchpoint supported by the target 
COM frequency = 4000 kHz
ST-LINK Firmware version : V2J36M26
Device ID: 0x442
PC: 0x8000238
ST-LINK device status: RUN_MODE
ST-LINK detects target voltage = 3.25 V
ST-LINK device status: RUN_MODE
ST-LINK device initialization OK
Waiting for debugger connection...
Waiting for connection on port 61234...
Accepted connection on port 61234...
Debugger connected
Try halt...
ST-LINK device status: HALT_MODE
Enter STM32_AppReset() function 
NVIC_DFSR_REG = 0x00000009
 ------ Switching to STM32CubeProgrammer ----- 
[36m[01m      -------------------------------------------------------------------
[39;49m[36m[01m                        STM32CubeProgrammer v2.4.0                  
[39;49m[36m[01m      -------------------------------------------------------------------
 
[39;49m[39;49m
 
[39;49m[39;49mLog output file:   /tmp/STM32CubeProgrammer_5Gk6kg.log
[39;49m[39;49m[39;49m[39;49m[90mST-LINK SN  : 0672FF383930434B43155617
[39;49m[90mST-LINK FW  : V2J36M26
[39;49m[90mVoltage     : 3.25V
[39;49m[90mSWD freq    : 4000 KHz
[39;49m[90mConnect mode: Under Reset
[39;49m[90mReset mode  : Hardware reset
[39;49m[90mDevice ID   : 0x442
[39;49m[39;49m[39;49mDevice name : STM32F09x/F030xC
[39;49m[39;49mFlash size  : 256 KBytes
[39;49m[39;49mDevice type : MCU
[39;49m[39;49mDevice CPU  : Cortex-M0
[39;49m[39;49m
[39;49m[39;49m
 
[39;49m[39;49mMemory Programming ...
[39;49m[39;49mOpening and parsing file: ST-LINK_GDB_server_p6h0se.srec
[39;49m[39;49m  File          : ST-LINK_GDB_server_p6h0se.srec
[39;49m[39;49m  Size          : 13532 Bytes
[39;49m[39;49m  Address       : 0x08000000 
[39;49m[39;49m
 
[39;49m[39;49m[39;49mErasing memory corresponding to segment 0:
[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49mErasing internal memory sectors [0 6]
[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49mDownload in Progress:
[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[00;32m[==================================================] 100% 
[39;49m
 
File download complete
Time elapsed during download operation: 00:00:00.890
 
 
 
Verifying ...
 
 
Read progress:
[39;49m[39;49m[39;49m[39;49m[39;49m[00;32m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[39;49m[00;32m[=======                                           ]  15% 
[39;49m[39;49m[39;49m[00;32m[===========                                       ]  22% 
[39;49m[39;49m[39;49m[00;32m[===============                                   ]  30% 
[39;49m[39;49m[39;49m[00;32m[==================                                ]  37% 
[39;49m[39;49m[39;49m[00;32m[======================                            ]  45% 
[39;49m[39;49m[39;49m[00;32m[==========================                        ]  52% 
[39;49m[39;49m[39;49m[00;32m[==============================                    ]  60% 
[39;49m[39;49m[39;49m[00;32m[==================================                ]  68% 
[39;49m[39;49m[39;49m[00;32m[=====================================             ]  75% 
[39;49m[39;49m[39;49m[00;32m[=========================================         ]  83% 
[39;49m[39;49m[39;49m[00;32m[=============================================     ]  90% 
[39;49m[39;49m[39;49m[00;32m[================================================= ]  98% 
[39;49m[39;49m[39;49m[00;32m[==================================================] 100% 
[39;49m[39;49m[39;49m
 
Download verified successfully 
 
 
[39;49m[39;49m[00;32m[39;49m[39;49m[39;49m ------ Switching context ----- 
Target connection mode: Default
Hardware watchpoint supported by the target 
COM frequency = 4000 kHz
ST-LINK Firmware version : V2J36M26
Device ID: 0x442
PC: 0x8000864
ST-LINK detects target voltage = 3.25 V
ST-LINK device status: HALT_MODE
ST-LINK device initialization OK
handle_vCont_c, continue thread
Debugger connection lost.
Shutting down...