cancel
Showing results for 
Search instead for 
Did you mean: 

Error in initializing ST-LINK device. Reason: (9) Target not halted.

GRuben
Associate II

Hello everyone, I'm new to this topic, and I'm needing help with an error that got me stuck.

I have a development board with a STM32F401CCU6 MCU. Until now, I had been doing exercises without problems in stm32cubeide. The problem was when I wanted to do an exercise with USART and show the result with the Realterm software, the program compiled correctly and allowed me to debug it without errors with ST-LINK, on ​​the other hand realterm did not show me anything, so I tried to reset the MCU pressing the button, also still had no results, I made sure that the configuration in realterm is ok. Then I tried debugging it again and there it gave me the following error:

STMicroelectronics ST-LINK GDB server. Version 6.0.0

Copyright (c) 2021, 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

    InitWhile         : Enabled

Target not halted after reset.

Target not halted

Error in initializing ST-LINK device.

Reason: Target not halted.

0693W00000NqjW8QAJ.jpg-I tried compiling it and debugging it with some other exercise that I did before just in case and it gives me the same error

-I also tried to erase the flash memory with STM32CubeProgrammer API v2.10.0 and when connecting I get the following error:

Error: ST-LINK error (DEV_CONNECT_ERR)

0693W00000NqjZ7QAJ.jpg-Another thing I tried is using the ST-Link with a stm32f103c8t6 MCU and it works fine, so the problem comes specifically from the development bord. Any help will help me thank you

7 REPLIES 7

Hardware Reset selected, is the NRST pin of the target connected to the debug pod.

If it's not, the device won't be in the state it expects after it attempts a reset.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

If you think you misconfigured the STM32 with your USART code, so that it is not responsive to the debugger, you can try resetting the device whilst BOOT0 pin is HIGH (this might be another button), no picture of board or connectivity shown.

If NRST is not connected to the debug pod, it can't reset it. So would recommend connecting SWDIO, SWCLK, NRST, GND and VCC, if this is an authentic ST-LINK/V2

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GRuben
Associate II

Hi, thanks for your response. I tried now to debug it but before that I held Boot0 and then without releasing the button I pressed NRST. and I got this error

STMicroelectronics ST-LINK GDB server. Version 6.0.0

Copyright (c) 2021, 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

    InitWhile         : Enabled

Waiting for debugger connection...

Debugger connected

Waiting for debugger connection...

Debugger connected

Waiting for debugger connection...

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

            STM32CubeProgrammer v2.9.0-RC01          

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

ST-LINK SN : 52FF6C068088524943132581

ST-LINK FW : V2J39S7

Board    : --

Voltage   : 3.25V

Error: ST-LINK error (DEV_CONNECT_ERR)

Encountered Error when opening I:\ST\STM32CubeIDE_1.8.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.100.202110141430\tools\bin\STM32_Programmer_CLI.exe

Error in STM32CubeProgrammer

Shutting down...

Exit.

0693W00000NqmfNQAR.jpg 

Not sure, either there is some sort of connectivity/electrical issue, or the last message suggests it can't find the .ELF output from the linker, which would suggest the BUILD didn't complete properly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Is this a Black Pill / Blue Pill type board, please be specific, with links to board, and info on exactly what is connected, and to what.

Does STM32 Cube Programmer work, does it find/connect with the board successfully.

If you need BOOT0=HIGH to connect, consider doing an ERASE on the part, and dwell on what you're doing in the code that would cause it to block other access.

Assume we have very little context about what you're doing, or what code you're compiling

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GRuben
Associate II

-Is a black pill board

https://imgaz.staticbg.com/images/oaupload/banggood/images/A2/9E/bb9135d9-c4ad-4fdc-9937-baf872903796.jpg.webp

-STM32 Cube Programmer work, i checked it with a blue pill i have.On the other hand with the black pill, it doesn't find/connect with the board properly

-Right now I'm just building an example of blinking the LED c13 just to get it working.

Sorry for the poor information :weary_face:

GRuben
Associate II

hello, good news... i was able to solve the problem.Pressing Boot0+NRST and then debugging with that configuration.

0693W00000Nqo3VQAR.pngBut I do not understand the cause of the error, if someone explains to me that I do not understand much, Why do we have to select none?