I've a couple of STM32F103C8T6 bluepill boards that I've so far been programming using serial. I never could get any of the STM32duino-bootloaders working, even after replacing the 10K USB pullup resistor with 1K5.
I received an Aliexpress ST-LINK V2 today and have been tearing my hair out trying to get it to work with STM32CubeIDE. I updated its firmware to V2J34S7 no problem, and the bluepill can be programmed using ST-LINK Utility just fine. It identifies as Device ID:0x410, flash Size : 64KBytes, Device family :STM32F10xx Medium-density.
Trying to debug using the STM32CubeIDE (ST-LINK GDB server) probe fails with
Hardware watchpoint supported by the target
SWD frequency = 4000 kHz
ST-LINK Firmware version : V2J34S7
Device ID: 0x410
PC: 0x80052c4
ST-LINK device status: HALT_MODE
ST-LINK detects target voltage = 3.26 V
Vendor = 0x55
Error in initializing ST-LINK device.
Reason: ST-LINK: Could not verify ST device! Abort connection.
In the log file it shows
readJEP106ID(): Vendor = 0x55 and I'm guessing that isn't ST Micro.
I gave up on ST-LINK GDB Server
![Flogging A Dead Horse :horse:](https://www.eevblog.com/forum/Smileys/default/DeadHorse.gif.pagespeed.ce.kBWvHKqCd1.gif)
Switched the probe to (ST-LINK OpenOCD) and then got the same
UNEXPECTED idcode: 0x2ba01477 error as the OP.
Thankfully I found this thread
![ThumbsUp :-+](https://www.eevblog.com/forum/Smileys/default/icon_smile_thumbsup.gif.pagespeed.ce._JElyJQqdB.gif)
I replaced the
set _CPUTAPID 0x1ba01477 as suggested by tsman in the
...\resources\openocd\st_scripts\target\stm32f1x.cfg file and also had to set the generator options to connection speed 4MHz and reset mode to software. Debugging is now working with STM32CubeIDE
![ThumbsUp :-+](https://www.eevblog.com/forum/Smileys/default/icon_smile_thumbsup.gif.pagespeed.ce._JElyJQqdB.gif)
I'm also using Visual Studio Code with Platform IO. I had to modify the
...\.platformio\packages\tool-openocd\scripts\target\stm32f1x.cfg file to get that working.
The dodgy bluepill boards purport to have proper STM32 chips. See attached.