README.md
1# STM32G431-Nucleo BSP Introduction
2
3[中文](README_zh.md)
4
5## MCU: STM32G431RB @170MHz, 128KB FLASH, 32KB RAM
6
7The STM32G431x6/x8/xB devices are based on the high-performance Arm® Cortex®-M4 32-bit RISC core. They operate at a frequency of up to 170 MHz.
8
9The Cortex-M4 core features a single-precision floating-point unit (FPU), which supports all the Arm single-precision data-processing instructions and all the data types. It also implements a full set of DSP (digital signal processing) instructions and a memory protection unit (MPU) which enhances the application’s security.
10These devices embed high-speed memories (128 Kbytes of Flash memory, and 32 Kbytes of SRAM), an extensive range of enhanced I/Os and peripherals connected to two APB buses, two AHB buses and a 32-bit multi-AHB bus matrix.
11The devices also embed several protection mechanisms for embedded Flash memory and SRAM: readout protection, write protection, securable memory area and proprietary code readout protection.
12The devices embed peripherals allowing mathematical/arithmetic function acceleration (CORDIC for trigonometric functions and FMAC unit for filter functions).
13They offer two fast 12-bit ADCs (5 Msps), four comparators, three operational amplifiers, four DAC channels (2 external and 2 internal), an internal voltage reference buffer, a low-power RTC, one general-purpose 32-bit timers, two 16-bit PWM timers dedicated to motor control, seven general-purpose 16-bit timers, and one 16-bit low-power timer.
14They also feature standard and advanced communication interfaces such as:
15\- Three I2Cs
16\- Three SPIs multiplexed with two half duplex I2Ss
17\- Three USARTs, one UART and one low-power UART.
18\- One FDCAN
19\- One SAI
20\- USB device
21\- UCPD
22The devices operate in the -40 to +85 °C (+105 °C junction) and -40 to +125 °C (+130 °C junction) temperature ranges from a 1.71 to 3.6 V power supply. A comprehensive set of power-saving modes allows the design of low-power applications.
23Some independent power supplies are supported including an analog independent supply input for ADC, DAC, OPAMPs and comparators. A VBAT input allows backup of the RTC and the registers.
24The STM32G431x6/x8/xB family offers 9 packages from 32-pin to 100-pin.
25
26#### KEY FEATURES
27
28- Core: Arm® 32-bit Cortex®-M4 CPU with FPU, Adaptive real-time accelerator (ART Accelerator) allowing 0-wait-state execution from Flash memory, frequency up to 170 MHz with 213 DMIPS, MPU, DSP instructions
29- Operating conditions:
30 - VDD, VDDA voltage range: 1.71 V to 3.6 V
31- Mathematical hardware accelerators
32 - CORDIC for trigonometric functions acceleration
33 - FMAC: filter mathematical accelerator
34- Memories
35 - 128 Kbytes of Flash memory with ECC support, proprietary code readout protection (PCROP), securable memory area, 1 Kbyte OTP
36 - 22 Kbytes of SRAM, with hardware parity check implemented on the first 16 Kbytes
37 - Routine booster: 10 Kbytes of SRAM on instruction and data bus, with hardware parity check (CCM SRAM)
38- Reset and supply management
39 - Power-on/power-down reset (POR/PDR/BOR)
40 - Programmable voltage detector (PVD)
41 - Low-power modes: sleep, stop, standby and shutdown
42 - VBAT supply for RTC and backup registers
43- Clock management
44 - 4 to 48 MHz crystal oscillator
45 - 32 kHz oscillator with calibration
46 - Internal 16 MHz RC with PLL option (± 1%)
47 - Internal 32 kHz RC oscillator (± 5%)
48- Up to 86 fast I/Os
49 - All mappable on external interrupt vectors
50 - Several I/Os with 5 V tolerant capability
51- Interconnect matrix
52- 12-channel DMA controller
53- 2 x ADCs 0.25 µs (up to 23 channels). Resolution up to 16-bit with hardware oversampling, 0 to 3.6 V conversion range
54
55- 4 x 12-bit DAC channels
56 - 2 x buffered external channels 1 MSPS
57 - 2 x unbuffered internal channels 15 MSPS
58- 4 x ultra-fast rail-to-rail analog comparators
59- 3 x operational amplifiers that can be used in PGA mode, all terminals accessible
60- Internal voltage reference buffer (VREFBUF) supporting three output voltages (2.048 V, 2.5 V, 2.9 V)
61- 14 timers:
62 - 1 x 32-bit timer and 2 x 16-bit timers with up to four IC/OC/PWM or pulse counter and quadrature (incremental) encoder input
63 - 2 x 16-bit 8-channel advanced motor control timers, with up to 8 x PWM channels, dead time generation and emergency stop
64 - 1 x 16-bit timer with 2 x IC/OCs, one OCN/PWM, dead time generation and emergency stop
65 - 2 x 16-bit timers with IC/OC/OCN/PWM, dead time generation and emergency stop
66 - 2 x watchdog timers (independent, window)
67 - 1 x SysTick timer: 24-bit downcounter
68 - 2 x 16-bit basic timers
69 - 1 x low-power timer
70- Calendar RTC with alarm, periodic wakeup from stop/standby
71- Communication interfaces
72 - 1 x FDCAN controller supporting flexible data rate
73 - 3 x I2C Fast mode plus (1 Mbit/s) with 20 mA current sink, SMBus/PMBus, wakeup from stop
74 - 4 x USART/UARTs (ISO 7816 interface, LIN, IrDA, modem control)
75 - 1 x LPUART
76 - 3 x SPIs, 4 to 16 programmable bit frames, 2 x with multiplexed half duplex I2S interface
77 - 1 x SAI (serial audio interface)
78 - USB 2.0 full-speed interface with LPM and BCD support
79 - IRTIM (infrared interface)
80 - USB Type-C™ /USB power delivery controller (UCPD)
81- True random number generator (RNG)
82- CRC calculation unit, 96-bit unique ID
83- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell™
84
85
86
87## Read more
88
89| Documents | Description |
90| :----------------------------------------------------------: | :----------------------------------------------------------: |
91| [STM32_Nucleo-64_BSP_Introduction](../docs/STM32_Nucleo-64_BSP_Introduction.md) | How to run RT-Thread on STM32 Nucleo-64 boards (**Must-Read**) |
92| [STM32G431RB ST Official Website](https://www.st.com/en/microcontrollers-microprocessors/stm32g431rb.html#documentation) | STM32G431RB datasheet and other resources |
93
94
95
96## Maintained By
97
98[xuzhuoyi](https://github.com/xuzhuoyi), <xzy476386434@vip.qq.com>
99
100
101
102## Translated By
103
104Meco Man @ RT-Thread Community
105
106> jiantingman@foxmail.com
107>
108> https://github.com/mysterywolf
README_zh.md
1# NUCLEO-G431RB 开发板 BSP 说明
2
3## 简介
4
5本文档为 NUCLEO-G431RB 开发板的 BSP (板级支持包) 说明。
6
7主要内容如下:
8
9- 开发板资源介绍
10- BSP 快速上手
11- 进阶使用方法
12
13通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
14
15## 开发板介绍
16
17NUCLEO-G431RB 是 ST 公司推出的一款针对 STM32G4 系列设计的 Cortex-M4 Nucleo-64 开发板,支持 mbed,兼容 Arduino、还带有 ST Morpho 扩展接口,可连接微控制器的所有周边外设。
18
19开发板外观如下图所示:
20
21
22
23该开发板常用 **板载资源** 如下:
24
25- MCU:STM32G431RB,主频 170MHz,128KB FLASH ,32KB RAM
26- 常用外设
27 - LED:1个,LD2(黄色,PA5)
28- 常用接口:USB 转串口
29- 调试接口,标准 ST-LINK/SWD
30
31开发板更多详细信息请参考【NUCLEO-G431RB】 [开发板介绍](https://www.st.com/zh/evaluation-tools/nucleo-g431rb.html)。
32
33## 外设支持
34
35本 BSP 目前对外设的支持情况如下:
36
37| **板载外设** | **支持情况** | **备注** |
38| :----------------- | :----------: | :------------------------------------- |
39| USB 转串口 | 支持 | |
40| **片上外设** | **支持情况** | **备注** |
41| GPIO | 支持 | |
42| UART | 支持 | LPUART1 USART1/3 UART4 |
43
44## 使用说明
45
46使用说明分为如下两个章节:
47
48- 快速上手
49
50 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
51
52- 进阶使用
53
54 本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
55
56
57### 快速上手
58
59本 BSP 为开发者提供 MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
60
61**请注意!!!**
62
63在执行编译工作前请先打开ENV执行以下指令(该指令用于拉取必要的HAL库及CMSIS库,否则无法通过编译):
64
65```bash
66pkgs --update
67```
68
69#### 硬件连接
70
71使用数据线连接开发板到 PC,通过数据线对开发板供电,下载,调试。
72
73#### 编译下载
74
75双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
76
77> 工程默认配置使用 ST-LINK 仿真器下载程序,在通过 ST-LINK 连接开发板的基础上,点击下载按钮即可下载程序到开发板
78
79#### 运行结果
80
81下载程序成功之后,系统会自动运行,黄色的 LD2 以 500MS 周期闪烁。
82
83连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
84
85```bash
86 \ | /
87- RT - Thread Operating System
88 / | \ 4.0.2 build Oct 5 2019
89 2006 - 2019 Copyright by rt-thread team
90msh >
91```
92### 进阶使用
93
94此 BSP 默认只开启了 GPIO 和 LPUART1 的功能,如果需使用更多高级功能,需要利用 ENV 工具对 BSP 进行配置,步骤如下:
95
961. 在 bsp 下打开 env 工具。
97
982. 输入`menuconfig`命令配置工程,配置好之后保存退出。
99
1003. 输入`pkgs --update`命令更新软件包。
101
1024. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。
103
104本章节更多详细的介绍请参考 [STM32 系列 BSP 外设驱动使用教程](../docs/STM32系列BSP外设驱动使用教程.md)。
105
106## 注意事项
107
108- 默认终端输出设备是 LPUART1
109
110## 联系人信息
111
112维护人:
113
114- [xuzhuoyi](https://github.com/xuzhuoyi), 邮箱:<xzy476386434@vip.qq.com>