cancel
Showing results for 
Search instead for 
Did you mean: 

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

matsadrian
Associate

Hello everyone, 

 

I recently bought the NUCLEO-N657X0-Q and I am trying to debug it using the ST-LINK_gdbserver.

Also this is my first development board and I don't know where to look. The data sheet and reference manual give me nothing in this regard and I am helpless. 

Here is the command line output:

$ /opt/ST/STM32CubeCLT_1.20.0/STLink-gdb-server/bin/ST-LINK_gdbserver --swd \ 
  -cp /opt/ST/STM32CubeCLT_1.20.0/STM32CubeProgrammer/bin -v -l 31 --frequency 8000 -k 


STMicroelectronics ST-LINK GDB server. Version 7.12.0
Copyright (c) 2025, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 31
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Enabled
        SWD Debug                  : Enabled
        InitWhile                  : Enabled

COM frequency = 8000 kHz
Target connection mode: Under reset
Target not halted after reset. Force halt
Failed to halt target
Target not halted

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

I am on macOS Tahoe 26.2.

I have ruled out that it is due to connectivity problems because I can program the board and run software on it using the STM32CubeProgrammer and its corresponding STM32_Programmer_CLI. I can also halt the core, inspect memory, read system registers and configure peripherals. I have also not encountered anyone with a similar problem on the internet.  BOOT0 is LOW and BOOT1 is HIGH to enter development boot. The board is connected through the CN10 USB-C port and the 5V_PWR LED (LD1) is ON. Also the PWR status tricolor LED (LD4) is GREEN which indicates that the power delivery is okay.

 I got a simple blinking LED to work with basic GPIO but more complex projects require a debugger. I am deliberately avoiding the STM32CubeIDE because I do not want any hardware abstractions, but even CLion throws this exact error when I try to connect.

 

Please help me resolve this issue, I would be grateful!

 

For certainty here are more details from the STM32_Programmer_CLI:

ST-LINK SN  : 003C00184142501420353451
ST-LINK FW  : V3J16M8
Board       : NUCLEO-N657X0-Q
Voltage     : 3.28V
SWD freq    : 8000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x486
Revision ID : Rev B
Device name : ST32N657
Device type : MCU
Device CPU  : Cortex-M55
BL Version  : --

 

Thank you in advance!

1 REPLY 1
Mike_ST
ST Employee

Hello,

I don't know about GDB server nor MacOS, but with GDB you have :

>> Target connection mode: Under reset

and with STM32CubeProgrammer_CLI, where it works:

>> Connect mode: Normal
>> Reset mode : Software reset

So based on the GDB server User Manual I would at least try to remove the -k option.

-v -l 31 --frequency 8000 -k

I don't know much more...

>> STM32CubeIDE because I do not want any hardware abstractions

You don't have to compile/call the HAL/LL libraries when you're using the CubeIDE, you can make direct register accesses as well, if that's what you mean.