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