I bought an st-link2 clone which arrived today.
I’ve connected ground to ground on the mini, reset to reset on the min, SWCLK to pin 21, and SWDIO to pin 22
I then powered the Mini only by USB (so not 3.3v connection from the st-link2 clone)
The st-link utility reports the following:
11:23:49 : Can not connect to target!
Please select "Connect Under Reset" mode from Target->Settings menu and try again.
If you're trying to connect to a low frequency application , please select a lower SWD Frequency mode from Target->Settings menu.
11:23:50 : No target connected
11:40:51 : Can not connect to target!
If you're trying to connect to an STM32W1xx device, please select Normal or HotPlug mode from Target->Settings menu.
If you're trying to connect to a low frequency application , please select a lower SWD Frequency mode from Target->Settings menu.
11:40:53 : No target connected
Removed reset, and powered the board from the st-link, still no leds light on the board and cant connect.
Tried my working board, the leds flash, but still can’t connect.
I’m clearly doing something wrong. I’ve tried a few different frequencies too – default was 4mhz.

i’ve got tons of dupont wires (male-male, female-female & female-male) just for the reason you just mentioned: it’s so stupid to not have them when you need them. especially when it costs next to nothing

And the last time i had issues with flashing, flashing under reset did work, but i don’t know what exactly i had to do to get it to work. i also fiddled with it until it worked . (but i did have 5 cables :p )
hopefully something on how to unbrick will emerge

stephen

https://github.com/rogerclarkmelbourne/ … from-Linux
… for what its worth, when I wrote that, I only used 3 “du-pont” wires… It shows how to connect to a Bluepill and the “Uggly board” but it should work with pretty much any stm32fXXX board, so the mm will work too. The version of Linux is not important. So long as the version of openocd is fairly recent you should be fine.
Connecting under reset with openocd will unbrick pretty much any screwup that doesn’t actually result in smoke.
Pinout for stm32f103 is
Programmer -> Target
Ground (Green) -> GND
SWDIO (Blue) -> PA13
SWCLK (Yellow) -> PA14
(Colour of wire is up to you of course )
If still dead, unplug the maple mini USB and connect the 3v3 pin from the programmer to 3v3 on the mm and try again.
Open On-Chip Debugger 0.10.0+dev-00001-g0ecee83 (2017-01-27-13:59)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
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 v27 API v2 SWIM v6 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.233618
Error: init mode failed (unable to connect to the target)
in procedure 'init'
in procedure 'ocd_bouncer'
https://www.youtube.com/watch?v=DC5tlE6XOIg
https://www.youtube.com/watch?v=DC5tlE6XOIg
For fear of destroying the board I _did not_ also connect it via USB whilst 3.3 was being supplied to the VCC pin.
Here’s a photo of the wiring:

I think this st-link clone hardware must be garbage. I can feel a stamping frenzy coming on.
I continuity checked the dupont leads just for peace of mind, all are good.

I think this st-link clone hardware must be garbage. I can feel a stamping frenzy coming on.
I continuity checked the dupont leads just for peace of mind, all are good.
And it’s a good advice that Roger likes to repeat on this forum: always have 2 of whatever you’re working on. it’s cheap chinese stuff, something will be broken or break, and if you then have to wait a month for the replacement to arrive…
And it’s a good advice that Roger likes to repeat on this forum: always have 2 of whatever you’re working on. it’s cheap chinese stuff, something will be broken or break, and if you then have to wait a month for the replacement to arrive…
Just checked continuity and it’s good.
I hope I’m just doing something stupid…
The swdio and swdclk pins in the MCU should match the schematics for the stlinks in the nucleo boards, which are widely available. Check continuity on those, gnd, etc.
And it’s possibly about time to order another one of those stlinks


Last night, I upgraded my HAL libraries to STM32Cube_FW_F1_V1.4.0, migrated one of my projects via CubeMX, and Openocd programmed the target one time. Openocd managed to get the new firmware into the target, but immediately lost connection with the target. I was never able to establish connection with that target again.
Today, to see if my st-link dongle was dead, I attempted the same thing with a different target. I experienced exactly the same problem… Firmware was downloaded into the target one time, connection was immediately lost, and I am unable to re-establish connection.
bootloader, target start address, linker address’s ?
stephen
However today I received a CH340 based USB to Serial adapter
Presumably I can use this to program the board, but how do I get a bootloader .bin uploaded? What tool do I need?
From what I’ve rad I need
tx from the ch340 to rx1 on the mini
rx from the ch340 to tx1 on the mini
gnd to gnd
3.3v to vcc
boot1 tied to ground…
Then what? I’ve got the v2 bootloader bin from github but not sure how to get it onto the device!?!
You can flash with USB to serial
You can even make your own STLink if you have a spare STM32F103 board (albeit the STLink binary is not officially released but is available from various websites (mainly russian ones))
Download ST’s
“Flash loader Demonstrator” PC gui program
(You can use the STM32Flash exe in the repo, but the Gui is easier)
http://jeelabs.org/book/1546c/
the ch340 shows up as ttyUSB0 in ubuntu
Issuing this command whilst holding down ‘button’
./stm32loader.py -p /dev/ttyUSB0 -ewv maple_mini_boot20.bin
results in this:
Traceback (most recent call last):
File "./stm32loader.py", line 434, in <module>
bootversion = cmd.cmdGet()
File "./stm32loader.py", line 118, in cmdGet
if self.cmdGeneric(0x00):
File "./stm32loader.py", line 115, in cmdGeneric
return self._wait_for_ask(hex(cmd))
File "./stm32loader.py", line 80, in _wait_for_ask
raise CmdException("Can't read port or timeout")
__main__.CmdException: Can't read port or timeout
I forgot you were using Ubuntu
Thanks Roger!


But it will need a different config for the ch340 usb to serial…
So this line:
while true; do openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg ; sleep 1;done
Would need to look something like:
while true; do openocd -f /usr/local/share/openocd/scripts/interface/ftdi/ch340.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg ; sleep 1;done
I’m trying to find a suitable config though.