2025-01-31 11:10 PM
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.
2025-01-31 11:58 PM
Hello and welcome to the community.
See the reply here regarding the usage of the blue pill boards.
2025-02-01 01:14 AM - edited 2025-02-01 01:16 AM
>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 >
2025-02-01 02:45 AM
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 :(
2025-02-01 04:02 AM
not answered:
+
What connect mode you set ? try: debug configuration -> connect mode ...software reset.
2025-02-01 04:06 AM
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.
2025-02-01 04:27 AM
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 .
2025-02-01 04:32 AM
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.