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