A comprehensive guide to getting started with the STM32 NUCLEO-G474RE development board for power electronics applications. This repository provides tutorials, examples, and best practices for developing power electronics projects using STM32CubeIDE and MATLAB Embedded Coder.
- Overview
- Features
- Prerequisites
- Hardware Requirements
- Software Requirements
- Getting Started
- Project Structure
- Examples
- Documentation
- Contributing
- License
- Support
This guide is designed for engineers and developers who want to learn how to build power electronics applications on the STM32 NUCLEO-G474RE board. Whether you're working with motor control, DC-DC converters, inverters, or other power electronics applications, you'll find practical examples and comprehensive tutorials.
The NUCLEO-G474RE is particularly suited for power electronics due to its:
- Advanced PWM capabilities (multiple timers with complementary outputs)
- High-resolution ADC for sensing and feedback
- Floating-point math co-processor (FPU)
- Sufficient computational power for real-time control algorithms
- STM32CubeIDE Projects: Complete, ready-to-use project templates
- MATLAB Integration: Selected examples with MATLAB Embedded Coder support
- Power Electronics Focus: PWM generation, ADC sampling, feedback control, protection mechanisms
- Step-by-Step Tutorials: Beginner-friendly guides with detailed explanations
- Real-World Examples: Practical implementations of common power electronics circuits
- Best Practices: Firmware development guidelines for power electronics applications
- Documentation: Comprehensive comments and external documentation
- Basic understanding of embedded C programming
- Familiarity with STM32 microcontroller concepts
- Introductory power electronics knowledge (PWM, ADC, feedback control)
- (Optional) MATLAB/Simulink experience for MATLAB Embedded Coder examples
- STM32 NUCLEO-G474RE development board
- USB cable for programming and debugging
- ST-Link programmer (built-in on NUCLEO board)
- STM32CubeIDE (version 1.10 or later)
- STM32CubeMX (typically included with CubeIDE)
- (Optional) MATLAB R2021b or later with Embedded Coder toolbox
| Component | Specification |
|---|---|
| Microcontroller | STM32G474RE |
| Flash Memory | 512 KB |
| RAM | 160 KB |
| Operating Voltage | 2.0V - 3.6V |
| ADC Resolution | 12-bit |
| Timer Channels | Multiple advanced timers with complementary outputs |
| Debug Interface | ST-Link V2-1 (on-board) |
| Tool | Version | Purpose |
|---|---|---|
| STM32CubeIDE | 1.10+ | Development environment and debugging |
| STM32CubeMX | Included | Pin and peripheral configuration |
| ARM GCC Compiler | Included | C/C++ compilation |
| MATLAB Embedded Coder | R2021b+ | (Optional) Code generation from Simulink |
git clone https://github.com/Anmol-G-K/NUCLEO-G474RE-PowerElectronics-Guide.git
cd NUCLEO-G474RE-PowerElectronics-Guide- Download from STMicroelectronics official website
- Install following the official documentation
- Ensure ST-Link drivers are installed
- Launch STM32CubeIDE
- Go to
FileβOpen Projects from File System - Navigate to the
Examples/01_Basic_LED_Blinkfolder - Select the project and click
Finish
- Right-click on the project β
Build Project - Connect the NUCLEO board via USB
- Right-click on the project β
Run AsβSTM32 C/C++ Application - Verify the LED blinks on the board
For examples using MATLAB Embedded Coder:
- Install MATLAB with Embedded Coder toolbox
- Configure MATLAB to use the ARM GCC compiler
- Navigate to MATLAB examples in the specific folder
- Follow the specific tutorial documentation
NUCLEO-G474RE-PowerElectronics-Guide/
β
βββ Examples/
β βββ 01_Basic_LED_Blink/ # Simple GPIO introduction
β βββ 02_ADC_Basic/ # ADC sampling fundamentals
β βββ 03_PWM_Generation/ # PWM basics and configuration
β βββ 04_Timer_Basics/ # Timer operation and ISR
β βββ 05_H_Bridge_Control/ # H-Bridge PWM control
β βββ 06_Current_Sensing/ # ADC-based current measurement
β βββ 07_Phase_Shifted_PWM/ # Complex PWM Switching Technique
β
βββ README.md # This file
βββ LICENSE # MIT License
βββ CONTRIBUTING.md # Contribution guidelines
Location: Examples/01_Basic_LED_Blink
Get familiar with the development environment by blinking an LED. This example teaches GPIO configuration and basic project structure.
Location: Examples/02_ADC_Basic
Read analog values from a potentiometer or sensor. Essential for understanding feedback in power electronics applications.
Location: Examples/03_PWM_Generation
Configure PWM signals for driving MOSFETs or IGBTs. Covers frequency, duty cycle, and dead-time configuration.
Comprehensive documentation is available in the Documentation/ folder:
- STM32G474RE Overview - Hardware features and capabilities
- PWM Configuration Guide - Advanced PWM setup
- ADC Setup Guide - Analog-to-digital conversion configuration
- Debugging Tips - Troubleshooting and debugging techniques
- Power Electronics Basics - Fundamental concepts
Contributions are welcome! Whether it's adding new examples, improving documentation, or reporting bugs:
- Fork the repository
- Create a feature branch (
git checkout -b feature/YourFeatureName) - Commit your changes (
git commit -m 'Add your feature') - Push to the branch (
git push origin feature/YourFeatureName) - Open a Pull Request
Please ensure your contributions:
- Follow the existing code style and structure
- Include meaningful comments in the code
- Add documentation for new examples
- Test thoroughly on actual hardware
See CONTRIBUTING.md for more details.
This project is licensed under the MIT License - see the LICENSE file for details.
This allows for both commercial and personal use with proper attribution.
- STM32:
- Matlab:
- Issues: Check existing GitHub Issues or create a new one
- Discussions: Use GitHub Discussions for questions and knowledge sharing
- Compilation Errors: Check Debugging Tips
- Hardware Issues: Verify connections and power supply
- STM32CubeIDE Problems: Update to the latest version
- Get Started with Embedded Coder
- Embedded Coder Documentation
- Getting Started with STMicroelectronics STM32 Processor Based Boards
- STMicroelectronics STM32 Documentation
- STM32 G474RE User Manual
- STM32G474xE Datasheet
- STM32 G474RE Reference Manual
- Application note - HRTIM Cookbook
- Description of STM32G4 HAL and low-layer drivers
Planned additions:
- Three-phase inverter control example
- Advanced PWM dead-time management
- Real-time data logging example
- More MATLAB Embedded Coder examples
- FreeRTOS integration example
- CAN bus communication tutorial
- As of now ert_rtw is also tracked will untrack in future if required.
If you use this guide in your projects or research, please cite:
NUCLEO-G474RE-PowerElectronics-Guide
https://github.com/Anmol-G-K/NUCLEO-G474RE-PowerElectronics-Guide
Anmol Govindarajapuram Krishnan
- GitHub: @Anmol-G-K
- Email: cb.en.u4eee23103@cb.students.amrita.edu
- STMicroelectronics for excellent microcontrollers and tools
- The embedded systems and power electronics community
- Contributors and users who provide feedback
Last Updated: February 2026
Status: Active Development
For the latest updates and announcements, watch this repository! β