TeXitoi/blue-pill-quickstart

Blue pills with clone CPUs

Opened this issue · 0 comments

Hello and thank you!

It turns out that recent blue pills sometimes (always?) have a clone of the stm32 so the corresponding openocd config file needs to be updated as described here: https://www.eevblog.com/forum/beginners/unexpected-idcode-flashing-bluepill-clone/

In case that link breaks, the error printed by openocd is:

Info : using stlink api v2
Info : Target voltage: 3.140492
Warn : UNEXPECTED idcode: 0x2ba01477
Error: expected 1 of 1: 0x1ba01477
in procedure 'init' 
in procedure 'ocd_bouncer'

The fix is to update the ID in the stm config file to match the clone:

curl https://raw.githubusercontent.com/arduino/OpenOCD/master/tcl/target/stm32f1x.cfg > clone.cfg
sed -i 's/0x1ba01477/0x2ba01477/g' clone.cfg
openocd -f interface/stlink-v2.cfg -f clone.cfg

Can this be fixed by making a PR against openocd with the new config file? Would it be better to keep the config file for the one true original chip and document the possible modifications here? Perhaps this issue suffices to document this.