cancel
Showing results for 
Search instead for 
Did you mean: 

STlink can't connect to device!!! [stm32f103c8t6 bluepill]

eggsacc
Visitor

I recently got another bluepill board (stm32f103c8t6) to replace the old board, and I could not connect to it using stlink. Using OpenOCD:

 

Open On-Chip Debugger 0.12.0+dev-00600-g090b431b1 (2024-09-13-19:14) [https://github.com/STMicroelectronics/OpenOCD]
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J45S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.262724
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : clock speed 4000 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x2ba01477
Info : [STM32F103C8Tx.cpu] Cortex-M3 r2p0 processor detected
Info : [STM32F103C8Tx.cpu] target has 6 breakpoints, 4 watchpoints
Info : [STM32F103C8Tx.cpu] Examination succeed
Info : starting gdb server for STM32F103C8Tx.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Error: timed out while waiting for target halted
Error executing event gdb-attach on target STM32F103C8Tx.cpu:
C:/ST/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.0.202411041438/resources/openocd/st_scripts/gdb_helper.tcl:18: Error: TARGET: STM32F103C8Tx.cpu - Not halted
in procedure 'gdb_attach_hook' called at file "C:/ST/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.0.202411041438/resources/openocd/st_scripts/target/stm32f1x.cfg", line 184
in procedure 'first_gdb_attach_hook' called at file "C:/ST/STM32CubeIDE_1.17.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug.openocd_2.3.0.202411041438/resources/openocd/st_scripts/gdb_helper.tcl", line 18
Info : device id = 0x10010414
Info : flash size = 256 KiB
Warn : GDB connection 1 on target STM32F103C8Tx.cpu not halted
undefined debug reason 8 (UNDEFINED) - target needs reset
shutdown command invoked
Info : dropped 'gdb' connection

 

Does anyone know what's wrong with the board?? The stlink device is detected properly, but it cannot verify the st device.

7 REPLIES 7
SofLit
ST Employee

Hello and welcome to the community.

See the reply here regarding the usage of the blue pill boards.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.
AScha.3
Chief III

>Does anyone know what's wrong with the board?? 

Wait, i need  to consult my blue crystal ball first ...

 

+

What connect mode you set ?  try: debug configuration -> connect mode ...software reset.

 

+

>but it cannot verify the st device.

cpu is recognized!  < Cortex-M3 r2p0 processor detected > + < device id = 0x10010414 >

If you feel a post has answered your question, please click "Accept as Solution".

Still not sure what's wrong with the board, but I can connect to it using STM32CubeProgrammer and download the .elf file manually. Guess I'll stick with that for now, but rip to debugging :(

not answered:

+

What connect mode you set ?  try: debug configuration -> connect mode ...software reset.

If you feel a post has answered your question, please click "Accept as Solution".

That is the mode I used, I also tried OpenOCD and the stlink GDB server. I've looked through many other forums and tried most of the solutions, like uploading a new project, changing the chip id etc but right now the only way I can even flash code to the microcontroller is through STM32CubeProgrammer. And that is also like the common fix i see others did. But again I don't think I will be able to access the debug functionalities.

Ok, so whats your st-link ? >  STLINK V2J45S7

A "stick" , (the well known st-link clones ), probably with a non-STM-cpu inside ?

Because IDE checking this , refuse to work. 

CubeProgrammer working with "clones" also most times. (depends on version and how "wrong" is the detected chip:

i have one, that only shows "6" as serial number, no debug possible, but older version of CubeProgrammer is working normal;  afair this has a GD32F103 inside .

If you feel a post has answered your question, please click "Accept as Solution".

It isn't a "stick" as per mentioned, but it is some clone. However I don't think it is a problem with the stlink, I've been using it with other STM32 board for about a year now and everything worked well. These batch of blupills I recently bought probably just have some non-genuine chips that the stlink cant recognise somehow.