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
75Nucleo G431KB Board includes an ST-Link/V3 embedded debug tool interface.
76
77Applications for the ``nucleo_g431kb`` board target can be built and
78flashed in the usual way (see :ref:`build_an_application` and
79:ref:`application_run` for more details).
80
81Flashing
82========
83
84The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
85so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
86
87Alternatively, OpenOCD, or pyOCD can also be used to flash the board using
88the ``--runner`` (or ``-r``) option:
89
90.. code-block:: console
91
92   $ west flash --runner openocd
93   $ west flash --runner pyocd
94
95To enable support of the STM32G431KB SoC in pyOCD, its pack has to be installed first:
96
97.. code-block:: console
98
99   $ pyocd pack --update
100   $ pyocd pack --install stm32g431kb
101
102Flashing an application to Nucleo G431KB
103----------------------------------------
104
105Connect the Nucleo G431KB to your host computer using the USB port,
106then run a serial host program to connect with your Nucleo board.
107
108.. code-block:: console
109
110   $ minicom -D /dev/ttyACM0
111
112Now build and flash an application. Here is an example for
113:zephyr:code-sample:`hello_world`.
114
115.. zephyr-app-commands::
116   :zephyr-app: samples/hello_world
117   :board: nucleo_g431kb
118   :goals: build flash
119
120You should see the following message on the console:
121
122.. code-block:: console
123
124   $ Hello World! nucleo_g431kb/stm32g431xx
125
126Debugging
127=========
128
129You can debug an application in the usual way.  Here is an example for the
130:zephyr:code-sample:`hello_world` application.
131
132.. zephyr-app-commands::
133   :zephyr-app: samples/hello_world
134   :board: nucleo_g431kb
135   :maybe-skip-config:
136   :goals: debug
137
138References
139**********
140
141.. target-notes::
142
143.. _Nucleo G431KB website:
144    https://www.st.com/en/evaluation-tools/nucleo-g431kb.html
145
146.. _STM32G4 Nucleo-32 board User Manual:
147   https://www.st.com/resource/en/user_manual/um2397-stm32g4-nucleo32-board-mb1430-stmicroelectronics.pdf
148
149.. _STM32g431kb Nucleo-32 board schematic:
150    https://www.st.com/resource/en/schematic_pack/mb1430-g431kbt6-a02_schematic_internal.pdf
151
152.. _STM32G431KB on www.st.com:
153   https://www.st.com/en/microcontrollers-microprocessors/stm32g431kb.html
154
155.. _STM32G4 reference manual:
156   https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
157
158.. _STM32CubeProgrammer:
159   https://www.st.com/en/development-tools/stm32cubeprog.html
160