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
It uses a STM32F103CBT6 MCU. The target is interfaced using SWD at 3.3 V.