I bought a ST-Link V2 clone to try and program a STM32 MCU that I salvaged from a hoverboard PCB (STM32F031C6T6). I've been having some difficulty getting it to work.

I downloaded STM32CubeIDE and set it to use OpenOCD for programming. The GDB server says the device ID is 0x00000000, which is why I'm guessing it says it can't recognize the device as STM32 family.

I have tried using hardware reset, and connected the clone programmer's reset pin to the MCU's reset pin, but the hardware reset does not trigger, I found this question and tried the hack to bridge the programmer's PB0 pin on the MCU, but I am still not getting a hardware reset. Would it need a correct device ID before it triggers a reset?

I'm also unsure why the device ID reads as 0x00000000; I've read about corrupted flash but since I can't program the MCU, I can't rewrite the flash, or is there another way?

I don't think the chip is faulty, because other GDB console outputs seem to detect it correctly, and when I manually trigger a hardware reset by pulling the chip's reset pin low, then GDB shows the event on the terminal output.

I hope someone can help. Here is the GDB output:

Open On-Chip Debugger 0.12.0-rc1+dev-00061-g5e9b46d77 (2022-10-20-14:50) 
Licensed under GNU GPL v2
For bug reports, read
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J40S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.053435
Info : clock speed 4000 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x0bb11477
Info : [STM32F031C6Tx.cpu] Cortex-M0 r0p0 processor detected
Info : [STM32F031C6Tx.cpu] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for STM32F031C6Tx.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x00000000
Warn : Cannot identify target as a STM32 family.
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
shutdown command invoked

This is the programmer: Stm32 Clone

It uses a STM32F103CBT6 MCU. The target is interfaced using SWD at 3.3 V.

This is the MCU: MM32F031C6T6

  • \$\begingroup\$ Well which clone it is, how you conneced it, how is the MCU powered and at which voltage, are you sure the MCU has not been set to JTAG/SWD disabled? Why not simply try entering the factory bootloader and try communicating via UART? \$\endgroup\$
    – Justme
    Jan 6, 2023 at 16:48
  • \$\begingroup\$ I updated the post to show the programmer info, it uses SWD, I'm not sure how to program it using UART, SPI or I2C, since the programmer only has SWD and SWIM. (I know the BOOT pin triggers the bootloader) I have worked with AVR MCUs but I'm still new to ARM \$\endgroup\$ Jan 6, 2023 at 16:59
  • \$\begingroup\$ That still does not reveal which programmer it is and how you made the connections between MCU, programmer and power supply. I hope you have a manual for the clone how to use it. But you don't need this kind of programmer if you simply want to program it via UART to check if the MCU can be reprogrammed. From the output it can be determined that the programmer can't communicate or detect with the target MCU. \$\endgroup\$
    – Justme
    Jan 6, 2023 at 17:15
  • \$\begingroup\$ @Justme FYI I had the wrong chip, you can check my answer below. \$\endgroup\$ Jan 13, 2023 at 9:05

1 Answer 1


It turns out the MCU is not an STM32F031C6T6 as I (incorrectly) assumed. After finding another MCU from the same manufacturer, and searching for it's datasheet, I found that the manufacturer is called Mind Motion. I then looked for the manufacturer's datasheet for the MM32F031C6T6 chip, and found that the memory mappings are completely different from the STM32F031C6T6. I was unable to program or erase it using STM32CubeIDE and STM32CubeProgrammer, so I ended up using Keil uVision, because it has built-in support for the Mind Motion MCUs. Using uVision, I was able to successfully erase and program the chip. Software based reset also works correctly.


Not the answer you're looking for? Browse other questions tagged or ask your own question.