November 2018 UM2321 Rev 1 1/82
1
UM2321
User manual
STM32CubeG0 demonstration firmware
Introduction
STMCube™ is an STMicroelectronics original initiative to make the developer’s life easier
by reducing development effort, time and cost. STM32Cube is the implementation of
STMCubeâ„¢ that covers the whole STM32 portfolio.
STM32Cube includes:
• STM32CubeMX, a graphical software configuratio
n tool that allows the generation of C
initialization code using graphical wizards.
• A comprehensive embedded software platform, delivered per Series (such as
STM3
2CubeG0 for STM32G0 Series):
– The STM32Cube HAL, STM32 abstraction layer embedded software ensuring
maximized
portability across the STM32 portfolio
– Low-Layer APIs (LL) offering a fast light-we
ight expert-oriented layer which is
closer to the hardware than the HAL. LL APIs are available only for a set of
peripherals.
– A consistent set of middleware components s
uch as FAT file system, RTOS, USB
PD
– All embedded software utilities, delivered
with a full set of examples
The STM32CubeG0 demonstration platform runnin
g on the STM32G081B-EVAL evaluation
board is built around the STM32Cube hardware abstraction layer (HAL) and low-layer (LL)
APIs, board support package (BSP) components, FatFS and USB PD middleware
components. This demonstration embeds several applications showing several features
supported by the STM32G081 device and using some of the peripherals present on the
STM32G081B-EVAL evaluation board and associated daughterboard. These applications
are:
• Low-power application
• Calendar application
• Image Viewer application
• Audio application
• Thermometer application
• Files browser application
• UCPD application
www.st.com
Contents UM2321
2/82 UM2321 Rev 1
Contents
1 STM32CubeG0 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2 Getting started with the demonstration . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1 Hardware requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Hardware settings of the STM32G081B-EVAL . . . . . . . . . . . . . . . . . . . . . 9
2.2.1 Legacy daughterboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.2 USB-C Power Delivery (UCPD) daughterboard . . . . . . . . . . . . . . . . . . 11
2.3 microSD status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4 Programming demonstration firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4.1 Using binary files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4.2 Using preconfigured projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3 Demonstration firmware package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.1 Demonstration repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.1.1 Demonstration loader folder organization . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.2 Legacy folder organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.3 UCPD folder organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2 Demonstration architecture overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2.1 DemoLoader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2.2 Legacy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2.3 UCPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2.4 HAL level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2.5 Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2.6 Middleware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 STM32G081RBT6 resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3.1 Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3.2 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.3.3 Internal memory size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.3.4 External memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4 Running the demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1 Demonstration startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.1 Normal processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1.2 Error cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25