Cannot upload to STM32 Bluepill board over STLink-V2

Chances are you don’t have an STM32F103C8T6 chip, but a Chinese clone, namely CS32F103C8T6 from China Key System & Integrated. That one is reported to use the 0x2ba01477 (as the IDcode or rather as the SW-DP tap id).

As a workaround, you can edit the file ~/.platformio/packages/tool-openocd/scripts/target/stm32f1x.cfg and change the line:

set _CPUTAPID 0x1ba01477

to:

set _CPUTAPID 0x2ba01477

If it’s really the Chinese clone, you should also initiate that the chip gets added to OpenOCD and PlatformIO.

3 Likes