June 2020 UM2492 Rev 2 1/25
1
UM2492
User manual
Getting started with STM32CubeG4 for STM32G4 Series
Introduction
STM32Cube is an STMicroelectronics original initiative to make developers' lives easier by
reducing development effort, time and cost. STM32Cube covers the whole STM32 portfolio.
STM32Cube includes:
• STM3
2CubeMX, a graphical software configuration tool that allows the generation of
C initialization code using graphical wizards.
• A comprehensive embedded software platform, delivered per Series (such as
STM32CubeG4 for STM32G4 Series):
– The STM32Cube HAL, STM32 abstraction layer embedded software ensuring
maximized portability across the STM32 portfolio.
– The low-layer APIs (LL) offering a fast light-weight expert-oriented layer that is
closer to the hardware than the HAL. LL APIs are available only for a set of
peripherals.
– A consistent set of middleware components such as RTOS, USB and FAT file
system.
– All embedded software utilities delivered with a full set of examples.
This user manual describes how to get started with the STM32CubeG4 MCU Package.
Section 1 describes the main features of the STM32CubeG4 MCU Package, part of the
STM32Cube initiative.
Section 2 and Section 3 provide an overview of the STM32CubeG4 architecture and MCU
Package structure.
www.st.com
Contents UM2492
2/25 UM2492 Rev 2
Contents
1 STM32CubeG4 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 STM32CubeG4 architecture overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Level 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Board support package (BSP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.2 Hardware abstraction layer (HAL) and low-layer (LL) . . . . . . . . . . . . . . . 8
2.1.3 Basic peripheral usage examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Level 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.1 Middleware components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.2 Examples based on the middleware components . . . . . . . . . . . . . . . . . 10
2.3 Level 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 STM32CubeG4 MCU Package overview . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1 Supported STM32G4 Series microcontrollers and hardware . . . . . . . . . . .11
3.2 MCU Package overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Getting started with STM32CubeG4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1 Running the first example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.2 Developing user application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2.1 HAL application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2.2 LL application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.3 Using STM32CubeMX to generate initialization C code . . . . . . . . . . . . . 20
4.4 Getting STM32CubeG4 release updates . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.4.1 Installing and running the STM32CubeUpdater program . . . . . . . . . . . 20
5 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.1 What is the license scheme for the STM32CubeG4 firmware? . . . . . . . . 21
5.2 Which boards are supported by the STM32CubeG4 MCU Package? . . . 21
5.3 Are there any examples provided with the ready-to-use toolset projects? 21
5.4 Is there any link with Standard Peripheral Libraries? . . . . . . . . . . . . . . . . 21
5.5 Do the HAL drivers take benefit from interrupts or DMA?
How can this be controlled? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.6 How are the product/peripheral specific features managed? . . . . . . . . . . 22