
Watch all course videos to build a solid foundation, then install STM32CubeIDE and download sample code to practice with the STM32G474 microcontroller for power electronics.
Install STM32 Cube IDE, download STM32 G474 example projects, and learn register-level programming alongside APIs, while setting up kits and safety basics.
Learn to download and install stm32 cube ide, create and activate your STMicroelectronics account, choose a workspace, install sd link and j-link drivers, and explore the information center.
download and organize stm32 cube g4 example projects for the nucleo-g474re board, locate the examples folder, and use gpio, adc, uart, and spi samples as references.
obtain the STM32 G474 microcontroller and Nucleo G474 board documentation, including the datasheet and technical reference manual, to learn pin information and peripheral details.
Import and run the GPIO toggle project for the STM32G474 development board using the STM32 Cube IDE, and learn to clean and build the code to flash the LED.
download the compiled gpio toggle project onto the nucleo g474 board and run it to observe the onboard led toggle. verify power and successful download using the debug process.
Learn the gpio io toggle project on the stm32g474 board, verify led flashing, and navigate stm32 cube ide project structure, including binaries, includes, startup, and hal drivers.
Explore STM32 project files, including source .c and header .h with prototypes, the HAL library, and GUI code generation for main.c, plus hex mapping to 16 and 32 bit registers.
Learn electronics safety for STM32 projects, including powering off before changes, avoiding energized circuits, and validating designs with paper analysis or SPICE simulations before hardware.
Configure gpio pins in the gpio module and set them as digital outputs to drive leds. Use C programming and gpio register configurations on Nucleo G47 kit with external breadboard.
Explore the stm32g474 microcontroller and its peripherals for power electronics, including gpio outputs, pwm gating, adc inputs, timers, phase-locked loop grid synchronization, and grid-connected converter control.
Explore the gpio module of the stm32g474, covering ports a to f, pin multiplexing, and how to configure pins as outputs with mode, speed, pull, and output type.
Enable timers for gpio by turning on the ahb and apb bus enables on the STM32G474; most modules are disabled by default to save power.
Explore the GPIO configuration registers for STM32G474, including mode, output type, speed, and pull-up/pull-down, and learn to set pin levels with ODR and BSRR using read-modify-write.
Connect LEDs to GPIO pins via external boards, choose three pins from three ports, use a series resistor to handle forward voltage drop and protect the GPIO with Ohm's law.
Learn to create a new stm32 project in stm32cubeide for the stm32g474 nucleo board, configure gpio pins as digital outputs, and generate demonstration code to blink leds.
Explore creating a new STM32G474 project, wiring LEDs to GPIO pins, and managing pin availability and timers. Understand how main.c and main.h organize code, and how header dependencies guide compilation.
Explore the header file that defines configuration registers for the stm32 g4 series and learn how memory-mapped structures map to peripherals via direct register access with pointers, not HAL libraries.
Learn to map header pins to mcu gpio pins using stm32 cube ide documentation. Extract relevant chapters from the technical manual, data sheet, and nuclear board, and review pin layouts.
map gpio pins on stm32g474, select unused pins pc10, pb9, and pa10, and configure three leds as outputs by enabling gpio clocks via RCC registers.
Configure gpio pins by setting mode to general purpose output. Adjust output type, speed, and pull resistors for pa10, pb9, and pc10, and set bits to drive leds.
Configure gpio pins as outputs, disable pull-ups, and illuminate leds; perform a clean build, verify zero errors, and prepare the code for execution on the stm32g474 development board.
Download and run the code, verify pa10, pb9, and pc10 connections with a common ground, then observe leds glow as gpio outputs high via the bit set reset mechanism.
Conclude this section by summarizing gpio setup with stm32 cube ide, header files, and peripheral registers, and emphasize wiring leds with resistors and correct polarity before timers and interrupts.
Begin a new section on timer configuration for precise sampling in power electronics, covering system clock setup, timer interrupts, and the variety of timers, including dual-use pwm timers.
Explore the STM32G474 clocking system, comparing internal 16 MHz and external 24 MHz oscillators, PLL outputs P, Q, R, RTC with 32.768kHz, up to 170 MHz, and auto code generation.
Explore how the system clock uses oscillators and the PLL, and why gradual frequency ramping avoids processor resets, while the course omits detailed PLL clock registers.
Explore Stm32g474 timers, including basic timers 6 and 7 for interrupts and adc triggers, and advanced and general purpose timers for pwm, with a high resolution pwm timer for precision.
Enable clocks for timer six and timer one via APB registers. Configure timer control register one, and set prescaler and auto reload to define timing and update events.
Enable the pb1 enable bit to activate timer six, configure its control, prescaler, auto reload, and status registers, compare with timer one, and note the update interrupt flag handling.
Explore how the nvic in stm32g474 manages peripheral interrupts, including maskable and non-maskable interrupts, and uses 16 priority levels to ensure high-priority events are serviced first.
Learn STM32CubeIDE clock configuration to set the system clock with PLL, prescalers, and high-speed clock or external crystal. Generate code and use resolve clock issues for a stable clock.
Learn to configure STM32G474 clocks and timers using the device configuration tool, enabling the HTC clock and PLL, and generate code to toggle GPIO pins at set timer intervals.
Enable the timer clocks on apb1e and apb2, configure timer 1 control and interrupt registers (cr1, dier) and set the prescaler and auto reload to achieve a one second interval.
Configure timer six to a two-second period by mirroring the timer one setup, enable its update interrupts, and prepare for the interrupt service routine.
Enable and prioritize interrupts with the NVIC, then implement two ISR handlers that toggle GPIO A10 and GPIO B9 using a volatile status toggle mechanism, and clear timer flags.
Compile the project after fixing a declaration mistake, use a volatile external variable to share data, and clear interrupt flags to prepare the STM32G474 setup for the microcontroller kit.
Download and run the project on the stm32g474 microcontroller, note red led flashes and blue led does not due to two gpio pins, then debug the code in the editor.
Debug STM32G474 projects in Cube IDE by inspecting live registers, SFRs, and timer configurations; fix RCC clock enable errors and verify timer interrupts for reliable operation.
Conclude the section by recapping the system clock setup and pll, exploring timers and interrupts in stm32g474, and previewing pwm and high-resolution timer topics.
Explore pulse width modulation on the STM32G474 using timer modules, including high resolution, advanced control, and general purpose timers, to generate gating pulses with dead time for power electronics.
Explore how the STM32G474 PWM modules—high resolution timer and advanced control timers—configure period, counting mode, and compare and capture functions to drive multiple power converters at different switching frequencies.
Enable the STM32G474 high resolution timer module, configure its master timer and six sub-timers for pwm, manage counting modes, updates, buffering, and synchronization with external signals.
Configure the high resolution timer module to generate gating pulses with compare and set/reset registers, using a master counter to drive six timers and twelve outputs in power electronics.
Enable the high resolution timer module interrupts by setting the rci bit to trigger on reset or rollover at the start or end of each pwm cycle.
Learn how to insert dead time between the HRTIM outputs, enable dead time, and configure rising and falling dead times using DTR/DTF and the prescaler for safe power device operation.
Configure the advanced control timer as a pwm module, selecting up, down, or up-down counting and center-aligned mode, using CCRs and OC outputs for gate pulses.
Configure the advanced control timer as a pwm module, insert dead time between complementary signals using dtg, dgf, and asymmetric options, and verify gating signals with an oscilloscope.
Set up a STM32G474 project and generate demonstration code for pwm on the Nucleo board. Extract high resolution timer documentation to reuse timer1, timer8, and timer20 code.
Configure the high resolution timer (HRTIM) timer one as a pwm module, enable it on APB2, and enable pre enable and update at reset for a 5 kHz switching frequency.
Configure the stm32g474 high resolution timer to generate five kilohertz pwm by setting the period and duty ratio with the compare register and gating outputs, using a 170 mhz clock.
Configure the Hrtim to generate gating pulses using cmp1–cmp4 to set and reset outputs, drive output one at cycle start, and reset when counter equals duty, with output two complementary.
Learn how to enable hrtim outputs by updating the owner register, then configure gpio pins pa8 and pa9 as high-resolution timer alternate function 13 to drive gating pulses.
Map pa8 and pa9 to hrtim channel a1 and a2 by configuring alternate function 13 and enabling the timer clock.
Configure the high resolution timer (HRTM) in continuous mode for a 5 kHz switching period, then generate gating pulses using set/reset logic and cmp registers.
Compile and build a basic HRTIM PWM project on the STM32G474 microcontroller, confirming zero errors and warnings, and measure the PWM output with an oscilloscope using safe breadboard connections.
Execute the basic HRTIM project on the STM32G474, verify output gate pulses from HRTIM channels, and prepare to add dead time for safe half-bridge operation.
Learn to insert dead time between complementary gate pulses with the HRTIM, enabling dead time, configuring out XR and DTR/DTF, and selecting a DTG prescaler for safe, non-overlapping switching.
Learn to compile an HRTIM project with deadtime on the STM32G474 microcontroller, configure out zr and rt zr, and observe automatically complementary outputs, and hexadecimal and binary conversions.
Execute the hrtim project on the stm32g474 to generate complementary gate pulses with dead time, observe the timing on an oscilloscope, and configure period, duty cycle, and a dead-time prescaler.
Configure TIM1 as a pwm for power electronics on the stm32g474, reusing high-resolution timer setup, enable auto-reload preload, and prepare period and CCR buffering for pwm modes.
Configure TIM1 channel 1 in output compare mode using CMR1 for PWM mode 1 or 2 with preloaded CCR1, and enable complementary outputs via CC1E and CC1N.
Learn how to configure TIM1 for advanced control on STM32G474: enable channel 1, set complementary outputs, manage the master output enable and update events, and prepare for pin assignment.
Assign two pins for timer1 channel one and its complementary channel to observe gate pulses. Enable clocks and set pc0 to af2 and pb13 to af6 for timer1 channel pins.
Configure TIM1 pwm on stm32g474 with period, channel 1 duty, and complementary outputs; map channel 1 to pc0 and channel 1n to pb13, compile, start timer1, and verify gate pulses.
Debug and correct a misconfiguration where pb13 is set as timer channel 1 by fixing the register from gpio c to port b, then recompile to prepare for waveform viewing.
Configure timer 1 as a pwm module on the stm32g474 to generate complementary pwm signals and multi-channel gate pulses. Insert dead time to create practical half-bridge switching for power converters.
Insert dead time between the TIM1 complementary PWM outputs for a power converter by configuring the BDA and BDD registers, setting DTG, and optionally using RT R2 for asymmetric timing.
Execute the complete TIM1 PWM project on the STM32G474, observe dead time between complementary waveforms, and enable interrupts to map a 0-1 duty ratio to a timer period.
Enable and configure interrupts for the high resolution timer and timer one to drive dead time pwm, handling rollover and update events for experimenting with sine-triangle modulation.
Implement interrupt service routines for the high resolution timer and timer 1 pwm, define headers, scale duty ratios to a 34,000 period, saturate at 0.97, and update compare registers.
Clear interrupt flags by writing to the high-resolution timer's clear register at the end of each pwm cycle, then load a new compare value for the next period.
Initialize a simple test to verify interrupts and PWM duty cycle changes on the STM32G474, incrementing duty ratios in the ISR to simulate gradual gate pulse width changes.
Execute your final pwm project on the STM32G474 by downloading code and observing changing pulse widths as the compare register updates every interrupt. Observe how dead time can prevent pulses.
Configure the high resolution timer in up-down count mode using the UDM bit and udmh, then use two compare registers for set and reset events to achieve sine-triangle duty modulation.
Configure TIM1 in up-down count mode, center-aligned, to generate a triangular waveform for PWM modulation in a DC–AC converter, and set update events and compare interrupts.
Compile the STM32G474 project with PWMs configured in up-down count mode. Then execute it on the microcontroller to observe the waveforms, ensuring there are no warnings or errors.
Demonstrates running pwm on STM32G474, comparing up-down vs up-count mode and how dead time alters pulse width; explains configuring high resolution and advanced control timers for multiple gate pulses.
Conclude the pwm section by comparing the high resolution timer and advanced control timer modules for stm32g474. Demonstrate triangular and sawtooth carriers and generating complementary gate pulses with dead time.
Explore the STM32G474’s five ADC modules with up to 19 inputs each, enabling closed-loop power electronics through flexible triggering, sensors, and interrupt-driven data processing.
Initialize the stm32g474 adc module by enabling selected adc blocks, setting the clock and prescaler, leaving deep power down, calibrating, enabling the voltage regulator, and awaiting the ready flag.
Configure the ADC in discontinuous mode for power electronics; select channels, set sampling times, and define conversion sequences using CFG, SMP, and SCR registers, with external or software triggers.
Configure sampling time and measurement sequences on the STM32G474 ADC, then start conversion in discontinuous mode via software or external trigger, storing 12-bit results in the data register.
Learn how to safely condition analog signals for the stm32g474 adc by scaling to 0–3.3 v with op-amps and saturation circuits, using a gpio-based sawtooth test signal.
Adjust the Vref on the NUCLEO-G474RE by moving jumper JP8 from the 3.5v position to 3.3v, ensuring adc measurements stay within a 3.3v signal range.
Set up an ADC-triggered-by-PWM project on the STM32G474, using high-resolution and advanced control timers to trigger the ADC, and configure clocks to 170 MHz.
Copy and adapt code from previous pwm projects to set up ADC on one of five modules and generate rectangular waveforms with timer six, including ADC triggers and timer configurations.
Audit and clean copied stm32g474 code, enable timer six and timer one with interrupts, and prepare the adc sawtooth inputs using a pin map to avoid conflicts in power electronics.
Configure the STM32G474 ADC input clock by enabling the clock, using the system clock with a prescaler of four in synchronous mode, and exiting deep power down ahead of calibration.
Configure the stm32g474 adc module by exiting deep power down, setting the adc clock from the system clock, enabling the voltage regulator, and calibrating to remove zero offsets before use.
Enable the adc module, wait for the ad ready bit, clear it, and configure sampling times via smp r1 for two channels to balance conversion time with control timing.
Configure the two-channel regular conversion for adc1 by selecting pb0 (adc1 input 15) and pb1 (adc1 input 12), encoding SCR1 as 0xf301.
Configure the ADC for discontinuous mode with software trigger, select ADC input 12 and 15 on pins B0 and B1, and implement an end-of-conversion interrupt service routine.
Start ADC conversions from the high resolution timer ISR using a software trigger, then prepare for a hardware trigger while sampling multiple channels per PWM cycle.
Configure TIM6 to generate a 50 Hz rectangular waveform by toggling PC2 and PC3 with a calculated prescaler and time interval, providing a sawtooth-like signal to ADC1.
Compile the project, fix warnings, and verify sawtooth waveform generation from a rectangular waveform via the rc circuit on pc2 and pc3 using timer six, staying within 0-3.3 v.
Verify sawtooth waveforms from RC circuits connected to GPIO PC2 and PC3 on the STM32G474, using current-limiting 2.2 kΩ resistors with 3.3 µF and 4.7 µF capacitors.
Verify the STM32G474 ADC operates by feeding two analog signals into pins B0 and B1 for two channels, then monitor the ADC data register in debug mode using saturation circuitry.
Learn to read 12-bit ADC results from the data register, convert them to a 0–3.3 volt value, and verify accuracy by toggling pins and inspecting oscilloscope waveforms.
Configure GPIO outputs, pa0 and pa1, to verify ADC conversions by comparing the 12-bit result (0–4095 at 3.3 V) with a threshold and toggling pins, overlaying with the sawtooth waveform.
Compile the project to verify ADC accuracy, generate pulses, compare them with capacitor waveforms on an oscilloscope, and fix extern variable declarations for a clean build.
Verify adc conversions on the stm32g474 by measuring analog signals with pins and oscilloscope crossovers. Confirm adc accuracy, set up interrupts, and plan pwm-triggered adc in the next lecture.
Configure external triggers to start adc conversions from timer outputs, using external enable and selection bits for rising-edge detection; connect Timer A update to adc trigger to avoid software interrupts.
Configure the high resolution timer to generate an ADC start of conversion trigger. Set timer A update source for ADC1 and trigger at the pwm end.
Configure ADC to listen to HRTIM trigger one, enable rising-edge triggers, and set discontinuous mode for two channels. Start the ADC startup conversion and verify via the special function register.
Configure timer one as an ADC start of conversion trigger by selecting timer one trigger output two, using the update event to synchronize ADC conversions without software interrupts.
Configure TIM1 to trigger ADC start of conversion and verify timer–ADC communication by enabling and later disabling the trigger, ensuring ADC responds only when TIM1 fires.
Conclude the adc module setup for the stm32g474, detailing software- and timer-triggered conversions, testing with sawtooth waveforms, and using an adc interrupt to store data for a control loop.
Tailor timing of control algorithms and adc triggers with the control timer and resolution timer, and generate sawtooth and sine-triangle pwm on gpios for power electronics engineers.
The STM32G474 microcontroller, a powerful and highly sought-after chip within the STM32 G series, is widely used in the power electronics industry. This course is designed for power electronics engineers who are beginners in embedded systems, providing them with a solid foundation in the functionality of microcontrollers and their integration into power electronics applications.
Through clear, approachable explanations, the course covers the key features and peripherals of the STM32G474 microcontroller, helping learners understand its role in real-world applications. The course emphasizes commonly used modules in power electronics: GPIOs (General Purpose Input/Output), timers, Pulse Width Modulation (PWM), and Analog-to-Digital Converters (ADC).
The curriculum includes hands-on experiments using the NUCLEO-G474RE development board (priced at just USD 20!), which features the STM32G474RE microcontroller and all its peripherals made accessible through convenient headers for easy experimentation. Learners will gain practical experience through simple, engaging projects, helping them build confidence in applying their knowledge to real-world scenarios.
The course is structured to allow learners to set up an affordable home lab for under USD 150, using cost-effective components. The course also introduces STM32CubeIDE, a free tool from STMicroelectronics that simplifies development with auto code generation and detailed register-level configuration of peripheral modules. Learners will explore how to download example projects, access technical documentation, and leverage powerful development tools for optimal learning.
By the end of this course, you will have a comprehensive understanding of the STM32G474 microcontroller, be able to design and implement basic power electronics systems, and gain hands-on experience with the NUCLEO-G474RE development board.