1.. zephyr:board:: nucleo_g431kb
2
3Overview
4********
5
6The Nucleo G431KB board features an ARM Cortex-M4 based STM32G431KB MCU
7with a wide range of connectivity support and configurations.
8Here are some highlights of the Nucleo G431KB board:
9
10- STM32 microcontroller in LQFP32 package
11- Arduino Nano V3 connectivity
12- On-board ST-LINK/V3E debugger/programmer
13- Flexible board power supply:
14
15  - USB VBUS or external source(3.3 V, 5 V, 7 - 12 V)
16  - Power management access point
17
18- Three LEDs: USB communication (LD1), power LED (LD3), user LED (LD2)
19- One push-button for RESET
20
21More information about the board can be found at the `Nucleo G431KB website`_.
22
23- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell.
24
25More information about STM32G431KB can be found here:
26
27- `STM32G431KB on www.st.com`_
28- `STM32G4 reference manual`_
29
30Supported Features
31==================
32
33.. zephyr:board-supported-hw::
34
35Connections and IOs
36===================
37
38Nucleo G431KB Board has 6 GPIO controllers. These controllers are responsible for pin muxing,
39input/output, pull-up, etc.
40
41For more details please refer to `STM32G4 Nucleo-32 board User Manual`_.
42
43Default Zephyr Peripheral Mapping:
44----------------------------------
45
46.. rst-class:: rst-columns
47
48- LPUART_1_TX : PA2
49- LPUART_1_RX : PA3
50- LD2 : PB8
51- PWM_4_CH_3 : PB8
52- I2C_2_SCL : PA9
53- I2C_2_SDA : PA8
54
55System Clock
56------------
57
58The Nucleo G431KB System Clock could be driven by internal or external oscillator,
59as well as main PLL clock. By default the external oscillator is not connected to the board. Therefore only the internal
60High Speed oscillator is supported. By default System clock is driven by PLL clock at 170 MHz,
61the PLL is driven by the 16 MHz high speed internal oscillator.
62
63Serial Port
64-----------
65
66Nucleo G431KB board has 1 U(S)ARTs and one LPUART. The Zephyr console output is assigned to LPUART1.
67Default settings are 115200 8N1.
68
69Please note that LPUART1 baudrate is limited to 9600 if the MCU is clocked by LSE (32.768 kHz) in
70low power mode.
71
72Programming and Debugging
73*************************
74
75.. zephyr:board-supported-runners::
76
77Nucleo G431KB Board includes an ST-Link/V3 embedded debug tool interface.
78
79Applications for the ``nucleo_g431kb`` board target can be built and
80flashed in the usual way (see :ref:`build_an_application` and
81:ref:`application_run` for more details).
82
83Flashing
84========
85
86The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
87so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
88
89Alternatively, OpenOCD, or pyOCD can also be used to flash the board using
90the ``--runner`` (or ``-r``) option:
91
92.. code-block:: console
93
94   $ west flash --runner openocd
95   $ west flash --runner pyocd
96
97To enable support of the STM32G431KB SoC in pyOCD, its pack has to be installed first:
98
99.. code-block:: console
100
101   $ pyocd pack --update
102   $ pyocd pack --install stm32g431kb
103
104Flashing an application to Nucleo G431KB
105----------------------------------------
106
107Connect the Nucleo G431KB to your host computer using the USB port,
108then run a serial host program to connect with your Nucleo board.
109
110.. code-block:: console
111
112   $ minicom -D /dev/ttyACM0
113
114Now build and flash an application. Here is an example for
115:zephyr:code-sample:`hello_world`.
116
117.. zephyr-app-commands::
118   :zephyr-app: samples/hello_world
119   :board: nucleo_g431kb
120   :goals: build flash
121
122You should see the following message on the console:
123
124.. code-block:: console
125
126   $ Hello World! nucleo_g431kb/stm32g431xx
127
128Debugging
129=========
130
131You can debug an application in the usual way.  Here is an example for the
132:zephyr:code-sample:`hello_world` application.
133
134.. zephyr-app-commands::
135   :zephyr-app: samples/hello_world
136   :board: nucleo_g431kb
137   :maybe-skip-config:
138   :goals: debug
139
140References
141**********
142
143.. target-notes::
144
145.. _Nucleo G431KB website:
146    https://www.st.com/en/evaluation-tools/nucleo-g431kb.html
147
148.. _STM32G4 Nucleo-32 board User Manual:
149   https://www.st.com/resource/en/user_manual/um2397-stm32g4-nucleo32-board-mb1430-stmicroelectronics.pdf
150
151.. _STM32g431kb Nucleo-32 board schematic:
152    https://www.st.com/resource/en/schematic_pack/mb1430-g431kbt6-a02_schematic_internal.pdf
153
154.. _STM32G431KB on www.st.com:
155   https://www.st.com/en/microcontrollers-microprocessors/stm32g431kb.html
156
157.. _STM32G4 reference manual:
158   https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
159
160.. _STM32CubeProgrammer:
161   https://www.st.com/en/development-tools/stm32cubeprog.html
162