1.. _nucleo_g474re_board:
2
3ST Nucleo G474RE
4################
5
6Overview
7********
8
9The Nucleo G474RE board features an ARM Cortex-M4 based STM32G474RE MCU
10with a wide range of connectivity support and configurations. Here are
11some highlights of the Nucleo G474RE board:
12
13- STM32 microcontroller in LQFP64 package
14- Arduino Uno V3 connectivity
15- On-board ST-LINK/V3E debugger/programmer with SWD connector
16- Flexible board power supply:
17
18  - USB VBUS or external source(3.3V, 5V, 7 - 12V)
19  - Power management access point
20
21- Three LEDs: USB communication (LD1), power LED (LD3), user LED (LD2)
22- Two push-buttons: RESET and USER
23
24.. image:: img/nucleo_g474re.jpg
25  :align: center
26  :alt: Nucleo G474RE
27
28More information about the board can be found at the `Nucleo G474RE website`_.
29
30Hardware
31********
32
33The STM32G474RE SoC provides the following hardware IPs:
34
35- Ultra-low-power with FlexPowerControl (down to 28 nA Standby mode and 84
36  |micro| A/MHz run mode)
37- Core: ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU, frequency up to 170 MHz
38- Clock Sources:
39
40  - 4 to 48 MHz crystal oscillator (HSE)
41  - 32 kHz crystal oscillator for RTC (LSE)
42  - Internal 16 MHz factory-trimmed RC ( |plusminus| 1%)
43  - Internal low-power 32 kHz RC ( |plusminus| 5%)
44  - 2 PLLs for system clock, USB, audio, ADC
45
46- RTC with HW calendar, alarms and calibration
47- 14x timers:
48
49  - 1x 32-bit timer and 2x 16-bit timers with up to four IC/OC/PWM or pulse counter and quadrature (incremental) encoder input
50  - 2x 16-bit 8-channel advanced motor control timers, with up to 8x PWM channels, dead time generation and emergency stop
51  - 1x 16-bit timer with 2x IC/OCs, one OCN/PWM, dead time generation and emergency stop
52  - 2x 16-bit timers with IC/OC/OCN/PWM, dead time generation and emergency stop
53  - 2x watchdog timers (independent, window)
54  - 2x 16-bit basic timers
55  - SysTick timer
56  - 1x low-power timer
57
58- Up to 86 fast I/Os, most 5 V-tolerant
59- Memories
60
61  - Up to 128 KB single bank Flash, proprietary code readout protection
62  - Up to 22 KB of SRAM including 16 KB with hardware parity check
63
64- Rich analog peripherals (independent supply)
65
66  - 2x 12-bit ADC 5 MSPS, up to 16-bit with hardware oversampling, 200
67    |micro| A/MSPS
68  - 4x 12-bit DAC, low-power sample and hold
69  - 3x operational amplifiers with built-in PGA
70  - 4x ultra-fast rail-to-rail analog comparators
71
72- 16x communication interfaces
73
74  - 1 x FDCAN controller supporting flexible data rate
75  - 3x I2C FM+(1 Mbit/s), SMBus/PMBus
76  - 4x USARTs (ISO 7816, LIN, IrDA, modem)
77  - 1x LPUART
78  - 3x SPIs (2x with multiplexed half duplex I2S interface)
79  - 1x SAI (serial audio interface)
80  - USB 2.0 full-speed interface with LPM and BCD support
81  - IRTIM (Infrared interface)
82  - USB Type-C™ /USB power delivery controller (UCPD)
83
84- 12-channel DMA controller
85- True random number generator (RNG)
86- CRC calculation unit, 96-bit unique ID
87- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell*
88
89
90More information about STM32G474RE can be found here:
91
92- `STM32G474RE on www.st.com`_
93- `STM32G4 reference manual`_
94
95Supported Features
96==================
97
98The Zephyr nucleo_g474re board configuration supports the following hardware features:
99
100+-----------+------------+-------------------------------------+
101| Interface | Controller | Driver/Component                    |
102+===========+============+=====================================+
103| NVIC      | on-chip    | nested vector interrupt controller  |
104+-----------+------------+-------------------------------------+
105| UART      | on-chip    | serial port-polling;                |
106|           |            | serial port-interrupt               |
107+-----------+------------+-------------------------------------+
108| PINMUX    | on-chip    | pinmux                              |
109+-----------+------------+-------------------------------------+
110| GPIO      | on-chip    | gpio                                |
111+-----------+------------+-------------------------------------+
112| I2C       | on-chip    | i2c                                 |
113+-----------+------------+-------------------------------------+
114| WATCHDOG  | on-chip    | independent watchdog                |
115+-----------+------------+-------------------------------------+
116| PWM       | on-chip    | pwm                                 |
117+-----------+------------+-------------------------------------+
118| ADC       | on-chip    | adc                                 |
119+-----------+------------+-------------------------------------+
120| DAC       | on-chip    | DAC Controller                      |
121+-----------+------------+-------------------------------------+
122| FLASH     | on-chip    | flash memory                        |
123+-----------+------------+-------------------------------------+
124| COUNTER   | on-chip    | rtc                                 |
125+-----------+------------+-------------------------------------+
126| SPI       | on-chip    | spi                                 |
127+-----------+------------+-------------------------------------+
128| die-temp  | on-chip    | die temperature sensor              |
129+-----------+------------+-------------------------------------+
130
131Other hardware features are not yet supported on this Zephyr port.
132
133The default configuration can be found in the defconfig file:
134``boards/arm/nucleo_g474re/nucleo_g474re_defconfig``
135
136
137Connections and IOs
138===================
139
140Nucleo G474RE Board has 6 GPIO controllers. These controllers are responsible for pin muxing,
141input/output, pull-up, etc.
142
143For mode details please refer to `STM32G4 Nucleo-64 board User Manual`_.
144
145Default Zephyr Peripheral Mapping:
146----------------------------------
147
148.. rst-class:: rst-columns
149
150- UART_1_TX : PC4
151- UART_1_RX : PC5
152- LPUART_1_TX : PA2
153- LPUART_1_RX : PA3
154- I2C_1_SCL : PB8
155- I2C_1_SDA : PB9
156- SPI_1_NSS : PB6
157- SPI_1_SCK : PA5
158- SPI_1_MISO : PA6
159- SPI_1_MOSI : PA7
160- SPI_2_NSS : PB12
161- SPI_2_SCK : PB13
162- SPI_2_MISO : PB14
163- SPI_2_MOSI : PB15
164- SPI_3_NSS : PA15
165- SPI_3_SCK : PC10
166- SPI_3_MISO : PC11
167- SPI_3_MOSI : PC12
168- PWM_2_CH1 : PA5 (might conflict with SPI1)
169- PWM_3_CH1 : PB4
170- USER_PB : PC13
171- LD2 : PA5
172- ADC1_IN1 : PA0
173- DAC1_OUT1 : PA4
174
175System Clock
176------------
177
178Nucleo G474RE System Clock could be driven by internal or external oscillator,
179as well as main PLL clock. By default System clock is driven by PLL clock at 150MHz,
180driven by 16MHz high speed internal oscillator. The clock can be boosted to 170MHz if boost mode
181is selected.
182
183Serial Port
184-----------
185
186Nucleo G474RE board has 3 U(S)ARTs. The Zephyr console output is assigned to LPUART1.
187Default settings are 115200 8N1.
188
189Please note that LPUART1 baudrate is limited to 9600 if the MCU is clocked by LSE (32.768 kHz) in
190low power mode.
191
192Programming and Debugging
193*************************
194
195Applications for the ``nucleo_g474re`` board configuration can be built and
196flashed in the usual way (see :ref:`build_an_application` and
197:ref:`application_run` for more details).
198
199Flashing
200========
201
202Nucleo G474RE board includes an ST-LINK/V3E embedded debug tool interface.
203
204Flashing an application to Nucleo G474RE
205----------------------------------------
206
207Connect the Nucleo G474RE to your host computer using the USB port,
208then run a serial host program to connect with your Nucleo board.
209
210.. code-block:: console
211
212   $ minicom -D /dev/ttyACM0
213
214Now build and flash an application. Here is an example for
215:ref:`hello_world`.
216
217.. zephyr-app-commands::
218   :zephyr-app: samples/hello_world
219   :board: nucleo_g474re
220   :goals: build flash
221
222You should see the following message on the console:
223
224.. code-block:: console
225
226   $ Hello World! arm
227
228
229Debugging
230=========
231
232You can debug an application in the usual way.  Here is an example for the
233:ref:`hello_world` application.
234
235.. zephyr-app-commands::
236   :zephyr-app: samples/hello_world
237   :board: nucleo_g474re
238   :maybe-skip-config:
239   :goals: debug
240
241.. _Nucleo G474RE website:
242   https://www.st.com/en/evaluation-tools/nucleo-g474re.html
243
244.. _STM32G4 Nucleo-64 board User Manual:
245   https://www.st.com/resource/en/user_manual/dm00556337.pdf
246
247.. _STM32G474RE on www.st.com:
248   https://www.st.com/en/microcontrollers/stm32g474re.html
249
250.. _STM32G4 reference manual:
251   https://www.st.com/resource/en/reference_manual/dm00355726.pdf
252