Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v21 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.177734 Warn : UNEXPECTED idcode: 0x2ba01477 Error: expected 1 of 1: 0x1ba01477 in procedure 'program' in procedure 'init' called at file "embedded:startup.tcl", line 506 in procedure 'ocd_bouncer' ** OpenOCD init failed ** shutdown command invoked make: *** [Makefile:43: flash] Error 1So, openocd never even tried erasing or programming. This device is announcing itself with a new and different idcode, namely 0x2ba01477 instead of the expected 0x1ba01477.
So, we are going to have to monkey around with the openocd config file. My makefile has the following paths:
OCDCFG = -f /usr/share/openocd/scripts/interface/stlink-v2.cfg \ -f /usr/share/openocd/scripts/target/stm32f1x.cfgThe advice on one forum is to create a new cfg file with the proper ID. So I do this:
su cd /usr/share/openocd/scripts/target cp stm32f1x.cfg cs32f1x.cfg vi cs32f1x.cfgI change one line (actually one character) in the file so the line reads:
set CPUTAPID 0x2ba01477Of course I have to change my Makefile now according to which chip I am working with. Once I do that, this board works just fine, so now my Makefile has:
# This is what we expect #OCDCFG = -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg # Some newer chips are shipping with a idcode of 0x2ba01477, this will make them work. OCDCFG = -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/cs32f1x.cfgI will notice that openocd now reports 128K of flash on these units, so this could be a good thing. It is different silicon, and who can say whether it is bad or good. The original units reported 64K of flash, but it was commonly known that 128K was there (whether the other 64K was reliable or not was open to question).
It is also worth noting that the markings on these new parts are just the same as the old. Likely they are both counterfeit ST parts, but it is curious that now we apparently have at least two makers in China, maybe more, making these chips. Just to be sold at a few cents each!?
The following has some discussion of these new parts:
Tom's Computer Info / [email protected]