1.. zephyr:board:: mikroe_clicker_2
2
3Overview
4********
5MikroE Clicker 2 for STM32 is a development board containing an `STM32F407`_
6microcontroller. It is equipped with two mikrobus sockets and furthermore has
7two headers for general signal break out.
8The board also has battery connection and a battery management unit on board.
9It can be powered either from a battery pack, such as a LiPo or from USB.
10The board is equipped with a 25MHz crystal as well as a 32.768kHz clock crystal.
11
12Hardware
13********
14The Clicker 2 board contains the following connections:
15
16  - Two MikroBUS connectors
17  - Two headers with general connections
18
19Furthermore the board contains two LEDs and two push buttons that are connected
20to the microcontroller.
21
22Supported Features
23==================
24
25.. zephyr:board-supported-hw::
26
27Connections and IOs
28===================
29
30The two mikroBUS interfaces are aliased in the device tree so that their
31peripherals can be accessed using ``mikrobus_N_INTERFACE`` so e.g. the spi on
32bus 2 can be found by the alias ``mikrobus_2_spi``. The counting corresponds
33with the marking on the board.
34
35For connections on the edge connectors, please refer to `Clicker 2 for STM32 User Manual`_.
36
37Programming and Debugging
38*************************
39Applications for the ``mikroe_clicker_2`` board configuration can
40be built and flashed in the usual way (see :ref:`build_an_application` and
41:ref:`application_run` for more details).
42
43
44Flashing
45========
46The initial state of the board is set to lock.
47When you flash, it will fail with the message:
48
49.. code-block:: console
50
51   Error: stm32x device protected
52
53Unlocking with openocd makes it possible to flash.
54
55.. code-block:: console
56
57   $ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg \
58       -f /usr/share/openocd/scripts/target/stm32f4x.cfg -c init\
59       -c "reset halt" -c "stm32f4x unlock 0" -c "reset run" -c shutdown
60
61Here is an example for the :zephyr:code-sample:`hello_world` application.
62
63.. zephyr-app-commands::
64   :zephyr-app: samples/hello_world
65   :board: mikroe_clicker_2
66   :goals: build flash
67
68You should see the following message on the console:
69
70.. code-block:: console
71
72   Hello World! mikroe_clicker_2
73
74
75Debugging
76=========
77
78You can debug an application in the usual way.  Here is an example for the
79:zephyr:code-sample:`hello_world` application.
80
81.. zephyr-app-commands::
82   :zephyr-app: samples/hello_world
83   :board: mikroe_clicker_2
84   :maybe-skip-config:
85   :goals: debug
86
87References
88**********
89.. _Clicker 2 website:
90    https://www.mikroe.com/clicker-2-stm32f4
91.. _Clicker 2 for STM32 User Manual:
92    https://download.mikroe.com/documents/starter-boards/clicker-2/stm32f4/clicker2-stm32-manual-v100.pdf
93.. _STM32F407VG Website:
94    https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-high-performance-mcus/stm32f4-series/stm32f407-417/stm32f407vg.html
95.. _STM32F407:
96    https://www.st.com/resource/en/datasheet/stm32f407vg.pdf
97