i was trying to flash a clone with
M0517LBN arm and could'n't get the cpu into
debug mode for
SWD flashing.
the solution after 1 day reading PDFs and general searching for how ARM using SWD turned out to be easy but hidden into datasheets......
when the M)517LBN is locked we have to force it into halt state manually just after hardware reset (HW RESET).
the problem:
bin>openocd-0.8.0.exe -f interface/stlink-v2.cfg -f target_M0517_win.tcl
Open On-Chip Debugger 0.8.0 (2014-04-28-08:39)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
0
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v23 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.471484
Error: init mode failed
in procedure 'transport'
in procedure 'init'
the solution:
on SWD pinouts force into manual hardware reset by jumper on RST pin (cpu side) to GND (STLink v2 side)
then plug the STLink v2 into USB
use 5V Vcc on STLink v2 side
then run openocd and do not unplug from USB
try 3-4 times by re-running openocd and plug-unplug the RST-on-GND (STLink v2 side)
that's it
charger - st-link
ICE_DATA <---------> SWDIO
ICE_CLK <---------> SWCLK
ICE_RST <-------->- GND <---------------- plun-unplug to manually reset the cpu
GND - <---------> GND
VCC <---------> 5V Vcc
progs used: openocd to halt and erase chip and CoFlash to prog , using Windows 7