1.. _nucleo_g431rb_board: 2 3ST Nucleo G431RB 4################ 5 6Overview 7******** 8 9The Nucleo G431RB board features an ARM Cortex-M4 based STM32G431RB MCU 10with a wide range of connectivity support and configurations. Here are 11some highlights of the Nucleo G431RB 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_g431rb.jpg 25 :align: center 26 :alt: Nucleo G431RB 27 28More information about the board can be found at the `Nucleo G431RB website`_. 29 30Hardware 31******** 32 33The STM32G431RB 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 STM32G431RB can be found here: 91 92- `STM32G431RB on www.st.com`_ 93- `STM32G4 reference manual`_ 94 95Supported Features 96================== 97 98The Zephyr nucleo_g431rb 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| PWM | on-chip | pwm | 115+-----------+------------+-------------------------------------+ 116| DAC | on-chip | dac | 117+-----------+------------+-------------------------------------+ 118| COUNTER | on-chip | rtc | 119+-----------+------------+-------------------------------------+ 120| SPI | on-chip | spi | 121+-----------+------------+-------------------------------------+ 122 123Other hardware features are not yet supported on this Zephyr port. 124 125The default configuration can be found in the defconfig file: 126``boards/arm/nucleo_g431rb/nucleo_g431rb_defconfig`` 127 128 129Connections and IOs 130=================== 131 132Nucleo G431RB Board has 6 GPIO controllers. These controllers are responsible for pin muxing, 133input/output, pull-up, etc. 134 135For mode details please refer to `STM32G4 Nucleo-64 board User Manual`_. 136 137Default Zephyr Peripheral Mapping: 138---------------------------------- 139 140.. rst-class:: rst-columns 141 142- UART_1_TX : PC4 143- UART_1_RX : PC5 144- LPUART_1_TX : PA2 145- LPUART_1_RX : PA3 146- I2C_1_SCL : PB8 147- I2C_1_SDA : PB9 148- SPI_1_NSS : PB6 149- SPI_1_SCK : PA5 150- SPI_1_MISO : PA6 151- SPI_1_MOSI : PA7 152- SPI_2_NSS : PB12 153- SPI_2_SCK : PB13 154- SPI_2_MISO : PB14 155- SPI_2_MOSI : PB15 156- SPI_3_NSS : PA15 157- SPI_3_SCK : PC10 158- SPI_3_MISO : PC11 159- SPI_3_MOSI : PC12 160- PWM_3_CH1 : PB4 161- USER_PB : PC13 162- LD2 : PA5 163- DAC1_OUT1 : PA4 164 165System Clock 166------------ 167 168Nucleo G431RB System Clock could be driven by internal or external oscillator, 169as well as main PLL clock. By default System clock is driven by PLL clock at 150MHz, 170driven by 16MHz high speed internal oscillator. The clock can be boosted to 170MHz if boost mode 171is selected. 172 173Serial Port 174----------- 175 176Nucleo G431RB board has 3 U(S)ARTs and one LPUART. The Zephyr console output is assigned to LPUART1. 177Default settings are 115200 8N1. 178 179Please note that LPUART1 baudrate is limited to 9600 if the MCU is clocked by LSE (32.768 kHz) in 180low power mode. 181 182Programming and Debugging 183************************* 184 185Applications for the ``nucleo_g431rb`` board configuration can be built and 186flashed in the usual way (see :ref:`build_an_application` and 187:ref:`application_run` for more details). 188 189Flashing 190======== 191 192Nucleo G431RB board includes an ST-LINK/V3E embedded debug tool interface. 193 194This interface is not yet supported by the openocd version included in the Zephyr SDK. 195 196Instead, support can be enabled on pyocd by adding "pack" support with 197the following pyocd command: 198 199.. code-block:: console 200 201 $ pyocd pack --update 202 $ pyocd pack --install stm32g431rb 203 204Note: 205To manually enable the openocd interface, You can still update, compile and install 206a 'local' openocd from the official openocd repo http://openocd.zylin.com . 207Then run the following openocd command where the '/usr/local/bin/openocd'is your path 208for the freshly installed openocd, given by "$ which openocd" : 209 210.. code-block:: console 211 212 $ west flash --openocd /usr/local/bin/openocd 213 214Flashing an application to Nucleo G431RB 215---------------------------------------- 216 217Connect the Nucleo G431RB 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:ref:`hello_world`. 226 227.. zephyr-app-commands:: 228 :zephyr-app: samples/hello_world 229 :board: nucleo_g431rb 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:ref:`hello_world` application. 244 245.. zephyr-app-commands:: 246 :zephyr-app: samples/hello_world 247 :board: nucleo_g431rb 248 :maybe-skip-config: 249 :goals: debug 250 251.. _Nucleo G431RB website: 252 https://www.st.com/en/evaluation-tools/nucleo-g431rb.html 253 254.. _STM32G4 Nucleo-64 board User Manual: 255 https://www.st.com/resource/en/user_manual/dm00556337.pdf 256 257.. _STM32G431RB on www.st.com: 258 https://www.st.com/en/microcontrollers/stm32g431rb.html 259 260.. _STM32G4 reference manual: 261 https://www.st.com/resource/en/reference_manual/dm00355726.pdf 262