1.. _nucleo_f042k6_board:
2
3ST Nucleo F042K6
4################
5
6Overview
7********
8The STM32 Nucleo-32 development board with STM32F042K6 MCU, supports Arduino nano connectivity.
9
10The STM32 Nucleo board provides an affordable, and flexible way for users to try out new concepts,
11and build prototypes with the STM32 microcontroller, choosing from the various
12combinations of performance, power consumption and features.
13
14The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer.
15
16The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together
17with various packaged software examples.
18
19.. image:: img/nucleo_f042k6.jpg
20   :align: center
21   :alt: Nucleo F042k6
22
23More information about the board can be found at the `Nucleo F042K6 website`_.
24
25Hardware
26********
27Nucleo F042K6 provides the following hardware components:
28
29- STM32 microcontroller in LQFP32 package
30
31- On-board ST-LINK/V2-1 debugger/programmer with SWD connector:
32
33- Flexible board power supply:
34
35  - USB VBUS or external source (3.3V, 5V, 7 - 12V)
36
37- Three LEDs:
38
39  - USB communication (LD1), user LED (LD2), power LED (LD3)
40
41- reset push button
42
43More information about STM32F042K6 can be found here:
44
45- `STM32F042 reference manual`_
46- `STM32F042 data sheet`_
47
48Supported Features
49==================
50
51The Zephyr nucleo_f042k6 board configuration supports the following hardware features:
52
53+-----------+------------+-------------------------------------+
54| Interface | Controller | Driver/Component                    |
55+===========+============+=====================================+
56| NVIC      | on-chip    | nested vector interrupt controller  |
57+-----------+------------+-------------------------------------+
58| UART      | on-chip    | serial port-polling;                |
59|           |            | serial port-interrupt               |
60+-----------+------------+-------------------------------------+
61| PINMUX    | on-chip    | pinmux                              |
62+-----------+------------+-------------------------------------+
63| GPIO      | on-chip    | gpio                                |
64+-----------+------------+-------------------------------------+
65| CLOCK     | on-chip    | reset and clock control             |
66+-----------+------------+-------------------------------------+
67| FLASH     | on-chip    | flash memory                        |
68+-----------+------------+-------------------------------------+
69| I2C       | on-chip    | i2c controller                      |
70+-----------+------------+-------------------------------------+
71| SPI       | on-chip    | spi controller                      |
72+-----------+------------+-------------------------------------+
73
74Other hardware features are not yet supported in this Zephyr port.
75
76The default configuration can be found in the defconfig file:
77``boards/arm/nucleo_f042k6/nucleo_f042k6_defconfig``
78
79Connections and IOs
80===================
81
82Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
83input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
84GPIO pins are shared with digital or analog alternate functions.
85
86Board connectors:
87-----------------
88.. image:: img/nucleo_f042k6_connectors.jpg
89   :align: center
90   :alt: Nucleo F042K6 connectors
91
92Default Zephyr Peripheral Mapping:
93----------------------------------
94
95- UART_1 TX/RX : PA2/PA15 (ST-Link Virtual COM Port)
96- I2C1 SCL/SDA : PB6/PB7 (Arduino I2C)
97- SPI1 NSS/SCK/MISO/MOSI : PA4/PA5/PA6/PA7 (Arduino SPI)
98- LD2 : PB3
99
100
101For mode details please refer to `STM32 Nucleo-32 board User Manual`_.
102
103Programming and Debugging
104*************************
105
106Applications for the ``nucleo_f042k6`` board configuration can be built and
107flashed in the usual way (see :ref:`build_an_application` and
108:ref:`application_run` for more details).
109
110Flashing
111========
112
113Nucleo F042K6 board includes an ST-LINK/V2-1 embedded debug tool interface.
114This interface is supported by the openocd version included in the Zephyr SDK.
115
116Flashing an application to Nucleo F042K6
117----------------------------------------
118
119Here is an example for the :zephyr:code-sample:`blinky` application.
120
121.. zephyr-app-commands::
122   :zephyr-app: samples/basic/blinky
123   :board: nucleo_f042k6
124   :goals: build flash
125
126You will see the LED blinking every second.
127
128Debugging
129=========
130
131You can debug an application in the usual way.  Here is an example for the
132:zephyr:code-sample:`blinky` application.
133
134.. zephyr-app-commands::
135   :zephyr-app: samples/basic/blinky
136   :board: nucleo_f042k6
137   :maybe-skip-config:
138   :goals: debug
139
140References
141**********
142
143.. target-notes::
144
145.. _Nucleo F042K6 website:
146   https://www.st.com/en/evaluation-tools/nucleo-f042k6.html
147
148.. _STM32F042 reference manual:
149   https://www.st.com/resource/en/reference_manual/dm00031936-stm32f0x1stm32f0x2stm32f0x8-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
150
151.. _STM32F042 data sheet:
152   https://www.st.com/resource/en/datasheet/stm32f042k6.pdf
153
154.. _STM32 Nucleo-32 board User Manual:
155   https://www.st.com/resource/en/user_manual/dm00231744-stm32-nucleo32-boards-mb1180-stmicroelectronics.pdf
156