Skip to content

A guide to power electronics with the STM32 NUCLEO-G474RE, featuring projects using STM32CubeIDE and MATLAB

License

Notifications You must be signed in to change notification settings

Anmol-G-K/NUCLEO-G474RE-PowerElectronics-Guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NUCLEO-G474RE-PowerElectronics-Guide

MCU IDE MATLAB Language License Status

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.

πŸ“‹ Table of Contents

🎯 Overview

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

✨ Features

  • 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

πŸ“¦ Prerequisites

Knowledge

  • 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

Hardware

  • STM32 NUCLEO-G474RE development board
  • USB cable for programming and debugging
  • ST-Link programmer (built-in on NUCLEO board)

Software

  • STM32CubeIDE (version 1.10 or later)
  • STM32CubeMX (typically included with CubeIDE)
  • (Optional) MATLAB R2021b or later with Embedded Coder toolbox

πŸ”§ Hardware Requirements

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)

πŸ’» Software Requirements

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

πŸš€ Getting Started

Step 1: Clone the Repository

git clone https://github.com/Anmol-G-K/NUCLEO-G474RE-PowerElectronics-Guide.git
cd NUCLEO-G474RE-PowerElectronics-Guide

Step 2: Install STM32CubeIDE

  1. Download from STMicroelectronics official website
  2. Install following the official documentation
  3. Ensure ST-Link drivers are installed

Step 3: Open Your First Project

  1. Launch STM32CubeIDE
  2. Go to File β†’ Open Projects from File System
  3. Navigate to the Examples/01_Basic_LED_Blink folder
  4. Select the project and click Finish

Step 4: Build and Flash

  1. Right-click on the project β†’ Build Project
  2. Connect the NUCLEO board via USB
  3. Right-click on the project β†’ Run As β†’ STM32 C/C++ Application
  4. Verify the LED blinks on the board

Step 5: (Optional) MATLAB Setup

For examples using MATLAB Embedded Coder:

  1. Install MATLAB with Embedded Coder toolbox
  2. Configure MATLAB to use the ARM GCC compiler
  3. Navigate to MATLAB examples in the specific folder
  4. Follow the specific tutorial documentation

πŸ“ Project Structure

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

πŸ“š Examples

1. Basic LED Blink

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.

2. ADC Sampling

Location: Examples/02_ADC_Basic

Read analog values from a potentiometer or sensor. Essential for understanding feedback in power electronics applications.

3. PWM Generation

Location: Examples/03_PWM_Generation

Configure PWM signals for driving MOSFETs or IGBTs. Covers frequency, duty cycle, and dead-time configuration.

πŸ“– Documentation

Comprehensive documentation is available in the Documentation/ folder:

🀝 Contributing

Contributions are welcome! Whether it's adding new examples, improving documentation, or reporting bugs:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/YourFeatureName)
  3. Commit your changes (git commit -m 'Add your feature')
  4. Push to the branch (git push origin feature/YourFeatureName)
  5. 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.

πŸ“„ License

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.

πŸ†˜ Support

Resources

Getting Help

  • Issues: Check existing GitHub Issues or create a new one
  • Discussions: Use GitHub Discussions for questions and knowledge sharing

Troubleshooting

  • Compilation Errors: Check Debugging Tips
  • Hardware Issues: Verify connections and power supply
  • STM32CubeIDE Problems: Update to the latest version

Tutorials

Reference Manuals:

πŸ—ΊοΈ Roadmap

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.

πŸ“ Citation

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

πŸ‘¨β€πŸ’» Author

Anmol Govindarajapuram Krishnan

πŸ™ Acknowledgments

  • 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! ⭐

About

A guide to power electronics with the STM32 NUCLEO-G474RE, featuring projects using STM32CubeIDE and MATLAB

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published