1.. zephyr:board:: nucleo_g031k8
2
3Overview
4********
5The STM32 Nucleo-32 board provides an affordable and flexible way for users to try
6out new concepts and build prototypes by choosing from the various combinations of
7performance and power consumption features, provided by the STM32
8microcontroller.
9
10The Arduino™ Nano V3 connectivity support allows the easy expansion of the
11functionality of the STM32 Nucleo open development platform with a wide choice of
12specialized shields.
13
14The STM32 Nucleo-32 board does not require any separate probe as it integrates the
15ST-LINK debugger/programmer.
16
17The STM32 Nucleo-32 board comes with the STM32 comprehensive free software
18libraries and examples available with the STM32Cube MCU Package.
19
20
21More information about the board can be found at the `Nucleo G031K8 website`_.
22
23Hardware
24********
25Nucleo G031K8 provides the following hardware components:
26
27- STM32 microcontroller in 32-pin package featuring 64 Kbytes of Flash memory
28  and 8 Kbytes of SRAM.
29- Extension resource:
30
31  - Arduino* Nano V3 connectivity
32
33- On-board ST-LINK/V2-1 debugger/programmer with SWD connector:
34
35- Flexible board power supply:
36
37  - USB VBUS or external source (3.3V, 5V, 7 - 12V)
38  - Current consumption measurement (IDD)
39
40- Four LEDs:
41
42  - USB communication (LD1), power LED (LD2), user LED (LD3),
43    USB power fault LED (LD4)
44
45- One push-button: RESET
46
47- USB re-enumeration capability. Three different interfaces supported on USB:
48
49  - Virtual COM port
50  - Mass storage
51  - Debug port
52
53More information about STM32G031K8 can be found in the
54`STM32G0x1 reference manual`_
55
56Supported Features
57==================
58
59The Zephyr nucleo_g031k8 board configuration supports the following hardware features:
60
61+-----------+------------+-------------------------------------+
62| Interface | Controller | Driver/Component                    |
63+===========+============+=====================================+
64| NVIC      | on-chip    | nested vector interrupt controller  |
65+-----------+------------+-------------------------------------+
66| UART      | on-chip    | serial port-polling;                |
67|           |            | serial port-interrupt               |
68+-----------+------------+-------------------------------------+
69| PINMUX    | on-chip    | pinmux                              |
70+-----------+------------+-------------------------------------+
71| GPIO      | on-chip    | gpio                                |
72+-----------+------------+-------------------------------------+
73| CLOCK     | on-chip    | reset and clock control             |
74+-----------+------------+-------------------------------------+
75| I2C       | on-chip    | i2c controller                      |
76+-----------+------------+-------------------------------------+
77| SPI       | on-chip    | spi controller                      |
78+-----------+------------+-------------------------------------+
79
80Other hardware features are not yet supported in this Zephyr port.
81
82The default configuration can be found in the defconfig file:
83:zephyr_file:`boards/st/nucleo_g031k8/nucleo_g031k8_defconfig`
84
85Connections and IOs
86===================
87
88Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
89input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
90GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
91capable except for analog inputs.
92
93Default Zephyr Peripheral Mapping:
94----------------------------------
95
96- UART_2 TX/RX : PA2/PA3 (ST-Link Virtual Port Com)
97- I2C2 SCL/SDA : PA9/PA10 (Arduino I2C)
98- SPI1 SCK/MISO/MOSI : PB3/PB4/PB5 (Arduino SPI)
99- LD3       : PC6
100
101For more details please refer to `STM32 Nucleo-32 board User Manual`_.
102
103Programming and Debugging
104*************************
105
106Nucleo G031K8 board includes an ST-LINK/V2-1 embedded debug tool interface.
107
108Applications for the ``nucleo_g031k8`` board configuration can be built and
109flashed in the usual way (see :ref:`build_an_application` and
110:ref:`application_run` for more details).
111
112Flashing
113========
114
115The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
116so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
117
118Alternatively, OpenOCD or JLink can also be used to flash the board using
119the ``--runner`` (or ``-r``) option:
120
121.. code-block:: console
122
123   $ west flash --runner openocd
124   $ west flash --runner jlink
125
126Flashing an application to Nucleo G031K8
127----------------------------------------
128
129Here is an example for the :zephyr:code-sample:`blinky` application.
130
131.. zephyr-app-commands::
132   :zephyr-app: samples/basic/blinky
133   :board: nucleo_g031k8
134   :goals: build flash
135
136You will see the LED blinking every second.
137
138Debugging
139=========
140
141You can debug an application in the usual way.  Here is an example for the
142:zephyr:code-sample:`hello_world` application.
143
144.. zephyr-app-commands::
145   :zephyr-app: samples/hello_world
146   :board: nucleo_g031k8
147   :maybe-skip-config:
148   :goals: debug
149
150Restriction
151***********
152
153On some boards, the board reset line is not used by the controller.
154Therefore the reset button, reset-pin and the ST-Link reset have no effect.
155To enable those functionalities, the option byte NRST_mode in the User
156Configuration needs to be changed from 2 to 1 or 3 - depending on the
157requirements.
158
159References
160**********
161
162.. target-notes::
163
164.. _Nucleo G031K8 website:
165   https://www.st.com/en/evaluation-tools/nucleo-g031k8.html
166
167.. _STM32G0x1 reference manual:
168   https://www.st.com/resource/en/reference_manual/rm0444-stm32g0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
169
170.. _STM32 Nucleo-32 board User Manual:
171   https://www.st.com/resource/en/user_manual/um2591-stm32g0-nucleo32-board-mb1455-stmicroelectronics.pdf
172
173.. _STM32CubeProgrammer:
174   https://www.st.com/en/development-tools/stm32cubeprog.html
175