summaryrefslogtreecommitdiff
path: root/source/microcontrollers/maple_mini/index.rst
blob: f472edb74bfea3306236bd2e2cf4d5a9b4db7fbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
************
 Maple Mini
************

Programming with OpenOCD
========================

The Maple Mini can be programmed using OpenOCD_ and a suitable
programmer.

.. _OpenOCD: https://openocd.sourceforge.io/

To program a Maple Mini the following PINs should be connected:

====  ===
Prog  MM
====  ===
GND   GND
3V3   Vcc
MOSI  D22
CLK   D21
====  ===

If the maple mini still has the original firmware it may be necessary to
press and hold the button (at least 1 s) while resetting the board, to
enter DMU mode.

Create the file ``openocd.cfg`` according to the programmer you are
using, and then run::

   openocd -f openocd.cfg
   telnet localhost 4444

To then write ``<binary>.elf`` to the Maple Mini use the following
commands::

   reset halt
   stm32f1x unlock 0
   reset halt
   flash write_image erase <binary>.elf
   stm32f1x lock 0
   reset halt

With an ST-Link V2 Clone from Baite
-----------------------------------

The required PINs on the ST-Link V2 Clone from Baite are as follows,
with the notch on the left::

       +------+
       | 1  2 | 3V3
    5V | 3  4 | CLK (MM 21)
         5  6 | MOSI (MM 22)
   GND | 7  8 |
       | 9 10 |
       +------+

``openocd.cfg`` should have the following contents::

   source [find interface/stlink.cfg]

   source [find target/stm32f1x.cfg]


With a Bus Pirate v3.6
----------------------

``openocd.cfg`` should have the following contents::

   source [find interface/buspirate.cfg]

   buspirate_port /dev/ttyUSB0
   buspirate_vreg 1
   buspirate_mode normal
   transport select swd

   source [find target/stm32f1x.cfg]

Programmin with gnuk/tool/stlinkv2.py
=====================================

gnuk also provides a tool to write binaries; first the board should be
unlocked with::

   ./stlinkv2.py -u

then reset (while pressing the button), and the flash erased::

   ./stlinkv2.py -e

and finally it can be written with::

   ./stlinkv2.py <binary>.elf

See also
========

* https://web.archive.org/web/20150502182337/http://nodonogard.blogspot.com/2014/08/writting-gnuk-binary-to-fst-01-using-st.html
* https://www.earth.li/~noodles/blog/2017/02/gnuk-on-maple-mini.html
* https://www.earth.li/~noodles/blog/2015/08/program-fst01-with-buspirate.html
* https://enricorossi.org/blog/2020/flash_programming_stm32_maple_mini/

..
   vim: set filetype=rst: