STM32G4 Series Microcontroller High Performance MCUs

Table of Contents

STM32G4 Series Microcontroller

The STM32G4 series was introduced in June 2019 as an upgrade to the F3 series, offering enhanced performance and analog-digital capabilities. It features upgrades in terms of performance, peripherals, and security.

About STM32G4

The STM32G4 high-performance microcontroller is a unique next-generation creation by ST, featuring outstanding performance suitable for applications such as motor control, industrial equipment, digital power, high-end control, and more. It boasts a 170MHz Cortex-M4 core with integrated floating-point unit, single-instruction multiply-accumulate unit, Cordic (hardware-based trigonometric function calculation), high-speed comparators, high-speed operational amplifiers, high-speed ADCs, high-speed DACs, CAN FD support, online upgradeability, AES & information security support, integrated USB Type-C PD3.0, and combines high performance with low power consumption characteristics.

Architecture of STM32G4

The new architecture of the STM32G4 draws from the general DNA of the STM32F3 but incorporates innovative and optimized features to meet the specific needs of various markets. For instance, the inclusion of a mathematical accelerator significantly enhances performance in motor control FOC (Field-Oriented Control) applications. CAN FD greatly supports digital power applications in industrial settings. By integrating more analog and digital components on the die, STM32G4 can create denser, more powerful power supplies for server centers and cater to cost-effective consumer products requiring digital power solutions. STM32G4 also sets the path for future designs, such as the rise of silicon carbide (SiC) or gallium nitride (GaN) devices in the automotive sector, which demand more precise timers to accommodate higher switching frequencies. With its 12-channel high-resolution timers, STM32G4 can drive designs involving such components, enabling the development of cutting-edge electronic products.

Specifications of STM32G4

STM32G431x6/x8/xB devices are based on the high-performance Arm® Cortex®-M4 32-bit RISC core, operating at frequencies up to 170MHz. The Cortex-M4 core includes a single-precision floating-point unit (FPU) and supports all Arm single-precision data processing instructions and data types.

These devices provide two fast 12-bit ADCs (5 MSPS), four comparators, three operational amplifiers, four DAC channels (two external and two internal), an internal voltage reference buffer, a low-power RTC, a general-purpose 32-bit timer, two 16-bit PWM timers dedicated to motor control, seven general-purpose 16-bit timers, and a 16-bit low-power timer.

en.obn stm32g4 series ss2024
(Image Credit: ST)

The STM32G4 microcontroller in the LQFP64 package (Arm® Cortex®-M4 at 170 MHz) includes:

  • STM32G431RBT6: 128 KB Flash and 32 KB SRAM;
  • STM32G491RET6: 512 KB Flash and 96 KB SRAM;
  • STM32G474RET6: 512 KB Flash and 128 KB SRAM;
  • Fully compatible with STM32G473RET6 (512 KB Flash and 128 KB SRAM).
  • 1 user LED;
  • 1 user button and 1 reset button;
  • 32.768 kHz LSE crystal oscillator; 
  • 24 MHz HSE oscillator;
  • Circuit board connectors:
  • USB with Micro AB;
  • MIPI® debugging connector;
  • ARDUINO® Uno V3 expansion connector;
  • ST morpho extension pin header for full access to all STM32G4 I/O;
  • Flexible power options: ST-LINK, USB VBUS, or external power;
  • STLINK-V3E debugger/programmer with USB re-enumeration feature: large storage, virtual COM port, and debug port;
  • STM32CubeG4 MCU software package provides a comprehensive free software library and examples;
  • Support for various integrated development environments (IDEs), including MDK-ARM and STM32CubeIDE.

Dual Flash Memory Banks and Secure Storage Area

An essential feature of the STM32G47x MCU is dual flash memory banks. Essentially, the MCU divides the flash memory into two physical storage areas with read-write (RWW) capabilities. This allows for downloading, installing, and running new firmware without any interference. The system operates on one memory bank, while the other receives the new firmware. The system can then swap memory banks and seamlessly transition to running the new code. Developers can also protect the download operation using new security features available on the STM32G4, such as secure storage areas. These secure storage areas can store keys or parts of code for software routines and run them only once after a reset, making them invisible to user code thereafter.

A High-Resolution Timer and Three Advanced Motor Control Timers

The STM32G4 series is the first to include timers with resolutions lower than 200 picoseconds in the ST MCU architecture. One notable advantage is that the G4 can drive high-precision power supplies in LLC resonant topologies. With seven time bases available, developers can combine them for extremely fine modulation, and the timer also provides highly flexible pulse-width modulation (PWM). The high-resolution timer comes equipped with event handlers, making it easier for engineers to configure and invoke timers or use them to generate interrupts.

Features of STM32G4

Robust Performance

The STM32G4, based on the Arm® Cortex®-M4 core, supports the FPU and DSP instruction set, with a core frequency of up to 170MHz. This is a significant improvement over the 72MHz core frequency of the STM32F3 and STM32F1 series. Additionally, the STM32G4 introduces three hardware accelerators: ART accelerator (dynamic cache), CCM-SRAM (static cache), and a mathematical computation accelerator.

In terms of computational throughput, the STM32G4 is comparable to the STM32F4 series. As a member of the “mixed-signal” microcontroller domain, the STM32G4 provides novel and optimized features for both digital and analog applications. Its Cortex-M4 core operates at a maximum frequency of 170 MHz, with 213 DMIPS and a CoreMark score of up to 550. The product architecture incorporates numerous optimization improvements to enhance convenience and development capabilities during the design process.

STM32G4 Features
STM32G4 Features

Rich Built-In Analog-Digital Peripherals

One of the standout features of the STM32G4 is its rich set of integrated analog peripherals, including ADCs, DACs, operational amplifiers, and comparators. The STM32G4 series offers up to 25 analog peripherals in its highest configuration MCU.

Optimized Functions

In addition to its abundant analog peripherals, the STM32G4 also integrates optimized functions for signal processing. For example, the analog-to-digital converters include gain and offset compensation in hardware, reducing CPU load and improving performance. Similarly, the system can automatically and continuously handle hardware exceptions up to eight times. When the system samples signals beyond its watchdog window, a routine is typically designed to resample the signal to assess whether it’s a fault or a systemic issue. Due to the high level of hardware integration in the STM32G4, developers can manage exceptional events more efficiently.

Low Power Consumption

When a universal MCU faces low power requirements, the STM32G4’s dynamic power efficiency modes reduce power consumption by more than two times compared to competitive DSPs with similar performance.

On-Chip System Integration

With smaller packages and fewer external components, the STM32G4 integrates all analog functions on-chip, reducing board-level PCB size and Bill of Materials (BOM) costs.

New Mathematical Accelerators

The STM32G4 is the first STM32 to feature two mathematical accelerators: one for trigonometric calculations (Coordinate Rotation Digital Computer or CORDIC) and another for digital filtering functions (Filter Mathematical Accelerator or FMAC). CORDIC is particularly advantageous for vector operations, commonly used in motor control’s Field-Oriented Control (FOC). It also provides hardware acceleration for trigonometric functions frequently encountered in motor control, metrology, signal processing, and other applications. On the other hand, FMAC can be used for generating three-pole three-zero (3p3z) compensators (digital power), Sigma-Delta modulators, and noise shapers in signal processing. It also supports the implementation of two primary digital filters in signal processing: Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) filters.

New Mathematical Accelerators

The STM32G4 is the first STM32 to feature two mathematical accelerators: one for trigonometric calculations (Coordinate Rotation Digital Computer or CORDIC) and another for digital filtering functions (Filter Mathematical Accelerator or FMAC). CORDIC is particularly advantageous for vector operations, commonly used in motor control’s Field-Oriented Control (FOC). It also provides hardware acceleration for trigonometric functions frequently encountered in motor control, metrology, signal processing, and other applications. On the other hand, FMAC can be used for generating three-pole three-zero (3p3z) compensators (digital power), Sigma-Delta modulators, and noise shapers in signal processing. It also supports the implementation of two primary digital filters in signal processing: Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) filters.

Applications of STM32G4

The STM32G4, as a product based on the Arm Cortex-M4 architecture, targets mainstream MCU applications. It is primarily designed for motor control, industrial equipment, measurement instruments, high-end consumer applications, and digital power, offering a combination of digital and analog signal processing to meet users’ needs. Target markets include digital power conversion, encompassing wireless charging, telecom power, motor drive, LED control, welding machines, industrial applications, UPS systems, power factor correction, servers, data centers, photovoltaic inverters, and more.

STM32G4 Applications
STM32G4 Applications

Branches of STM32G4

STM32G4 Series Model
STM32G4 Series Model

STM32G4x1 and STM32G4x3 are geared towards general and motor control applications.

STM32G4x1 is the basic series, with an entry-level configuration of analog peripherals and single-flash memory bank. Supported flash memory sizes range from 32KB to 512KB.

STM32G4x3 is the enhanced series, offering more analog peripherals compared to the basic devices, along with dual-flash memory banks. Flash memory sizes are also increased, ranging from 128KB to 512KB, making it suitable for more advanced applications.

STM32G4x4 targets specific markets such as digital power and is the high-resolution series. In addition to the rich set of analog peripherals and memory resources available in the enhanced series, the STM32G4x4 series also includes high-resolution timers, a complex waveform generator, and an event handler, making it particularly suitable for digital power applications like digital switch-mode power supplies, lighting, welding, solar energy, and wireless charging.

STM32G4 Development Ecosystem

The STM32G4 continues to build on the STM32 and ARM Cortex-M4 ecosystem, offering hardware resources such as:

  • NUCLEO development boards for STM32G4 MCU support.
  • Full-featured evaluation boards: STM32G474E-EVAL and STM32G484E-EVAL, with onboard encryption and accelerometers.
  • One-stop motor control development tools: Nucleo motor control dedicated development board (P-NUCLEO-IHM03).
  • Discovery kits: B-G474E-DPOW1*, B-G431B-ESC1*.

These tools and resources enable developers to efficiently explore and develop applications with the STM32G4 microcontroller family.

STM32G4 Hardware Tools
STM32G4 Hardware Tools

STM32G4 software tools include: STM32CubeMX, IDEs compilation and debugging, and STM32 programming tools.

STM32G4 Software Tools
STM32G4 Software Tools

STM32G4 Development Board Project-Lighting up LED

The STM32G431 development board has a user button and LED light. According to the schematic diagram, LD2 is connected to PA5. If you want to light up the LED, PA5 should be high level. User button B1 is connected to PC13, and it is high level when pressed.

STM32G431 Development Board Schematic Diagram
STM32G431 Development Board Schematic Diagram

MCU Selector

The chip model used in this example is: STM32G431RBT6; 128KB flash and 32KB SRAM, with an operating frequency of up to 170MHz.

MCUMPU Selector-STM32G4 Series STM32G431RB STM32CubeMX
MCUMPU Selector-STM32G4 Series STM32G431RB STM32CubeMX

Clock Configuration

Clock Configuration-High Speed Clock(HSE) CrystalCeramic Resonator STM32CubeMX
Clock Configuration-High Speed Clock(HSE) CrystalCeramic Resonator STM32CubeMX
Clock Configuration Input frequency STM32CubeMX
Clock Configuration-Input frequency STM32CubeMX

GPIO Pin Configuration

GPIO Setting-Pins Configuration (PA5) STM32CubeMX
GPIO Setting-Pins Configuration (PA5) STM32CubeMX
GPIO Setting-Pins Configuration (PC13) STM32CubeMX
GPIO Setting-Pins Configuration (PC13) STM32CubeMX

Project Manager

Project Manager-Project Settings STM32CubeMX
Project Manager-Project Settings STM32CubeMX
Project Manager-Code Generator STM32CubeMX
Project Manager-Code Generator STM32CubeMX

LED and Button Pins Configuration

LED and Button Pin Configuration STM32CubeMX
LED and Button Pin Configuration STM32CubeMX

Button Function

				
					/*Get key value*/
uint8_t Get_KeyVal(void)
{
   uint8_t static stat=0;
   if(HAL_GPIO_ReadPin(USER_GPIO_Port,USER_Pin)==1 && stat==0)//Determine whether the button is pressed
   {
     HAL_Delay(20);//Delay debounce
     stat=1;
     if(HAL_GPIO_ReadPin(USER_GPIO_Port,USER_Pin))return 1;
   }
   else if(HAL_GPIO_ReadPin(USER_GPIO_Port,USER_Pin)==0)
   {
     stat=0;
   }
   return 0;
}
				
			

Main Function:

				
					uint8_t key;
   /* USER CODE END 2 */

   /* Infinite loop */
   /* USER CODE BEGIN WHILE */
   while (1)
   {
     /* USER CODE END WHILE */

     /* USER CODE BEGIN 3 */
     key=Get_KeyVal();
     if(key)
     {
       HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
     }
   }
				
			

Subscribe

Join our subscribers list to get monthly blog updates, technology news, case studies. We will never send spam, and you can unsubscribe at any time.

About Author

Picture of Aidan Taylor
Aidan Taylor

I am Aidan Taylor and I have over 10 years of experience in the field of PCB Reverse Engineering, PCB design and IC Unlock.

Need Help?

Don't hesitate - Get in touch today to find out how we can help take your project to the next level.

Table of Contents

Scroll to Top
welldone pcb manufacturer

Start to Achieve Your PCB Project