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==================
24The Zephyr MikroE Clicker 2 configuration supports the following hardware features:
25
26+-----------+------------+-------------------------------------+
27| Interface | Controller | Driver/Component                    |
28+===========+============+=====================================+
29| NVIC      | on-chip    | nested vector interrupt controller  |
30+-----------+------------+-------------------------------------+
31| UART      | on-chip    | serial port-polling;                |
32|           |            | serial port-interrupt               |
33+-----------+------------+-------------------------------------+
34| PINMUX    | on-chip    | pinmux                              |
35+-----------+------------+-------------------------------------+
36| I2C       | on-chip    | i2c                                 |
37+-----------+------------+-------------------------------------+
38| SPI       | on-chip    | spi                                 |
39+-----------+------------+-------------------------------------+
40| ADC       | on-chip    | adc                                 |
41+-----------+------------+-------------------------------------+
42| USB       | on-chip    | usb                                 |
43+-----------+------------+-------------------------------------+
44
45Other hardware features have not been enabled yet for this board.
46
47The default configuration can be found in
48:zephyr_file:`boards/mikroe/clicker_2/mikroe_clicker_2_defconfig`
49
50Connections and IOs
51===================
52
53The two mikroBUS interfaces are aliased in the device tree so that their
54peripherals can be accessed using ``mikrobus_N_INTERFACE`` so e.g. the spi on
55bus 2 can be found by the alias ``mikrobus_2_spi``. The counting corresponds
56with the marking on the board.
57
58For connections on the edge connectors, please refer to `Clicker 2 for STM32 User Manual`_.
59
60Programming and Debugging
61*************************
62Applications for the ``mikroe_clicker_2`` board configuration can
63be built and flashed in the usual way (see :ref:`build_an_application` and
64:ref:`application_run` for more details).
65
66
67Flashing
68========
69The initial state of the board is set to lock.
70When you flash, it will fail with the message:
71
72.. code-block:: console
73
74   Error: stm32x device protected
75
76Unlocking with openocd makes it possible to flash.
77
78.. code-block:: console
79
80   $ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg \
81       -f /usr/share/openocd/scripts/target/stm32f4x.cfg -c init\
82       -c "reset halt" -c "stm32f4x unlock 0" -c "reset run" -c shutdown
83
84Here is an example for the :zephyr:code-sample:`hello_world` application.
85
86.. zephyr-app-commands::
87   :zephyr-app: samples/hello_world
88   :board: mikroe_clicker_2
89   :goals: build flash
90
91You should see the following message on the console:
92
93.. code-block:: console
94
95   Hello World! mikroe_clicker_2
96
97
98Debugging
99=========
100
101You can debug an application in the usual way.  Here is an example for the
102:zephyr:code-sample:`hello_world` application.
103
104.. zephyr-app-commands::
105   :zephyr-app: samples/hello_world
106   :board: mikroe_clicker_2
107   :maybe-skip-config:
108   :goals: debug
109
110References
111**********
112.. _Clicker 2 website:
113    https://www.mikroe.com/clicker-2-stm32f4
114.. _Clicker 2 for STM32 User Manual:
115    https://download.mikroe.com/documents/starter-boards/clicker-2/stm32f4/clicker2-stm32-manual-v100.pdf
116.. _STM32F407VG Website:
117    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
118.. _STM32F407:
119    https://www.st.com/resource/en/datasheet/stm32f407vg.pdf
120