STM32G4 HAL and Low-Layer Drivers

An introduction to STMicroelectronics' comprehensive software suite for STM32G4 microcontrollers.

Introduction to STM32Cube

STM32Cube is an initiative by STMicroelectronics designed to significantly enhance developer productivity by reducing development effort, time, and cost across the STM32 portfolio. This comprehensive ecosystem includes:

  • STM32CubeMX: A graphical software configuration tool for generating C initialization code via visual wizards.
  • Embedded Software Platform: Delivered per series (e.g., STM32CubeG4 for STM32G4), providing a complete embedded software package.
  • HAL (Hardware Abstraction Layer): An abstraction layer ensuring maximized portability across the STM32 portfolio, with APIs available for all peripherals.
  • Low-Layer (LL) APIs: A fast, lightweight, expert-oriented layer closer to the hardware, available for a select set of peripherals.
  • Middleware Components: Including RTOS and USB.
  • Embedded Software Utilities: Delivered with a full set of examples.

HAL Driver Features

The HAL driver layer offers a simple, generic set of APIs for interacting with application upper layers. Key features include:

  • Cross-family portable APIs covering common and specific peripheral features.
  • Support for three programming models: polling, interrupt, and DMA.
  • RTOS compliance with fully reentrant APIs and systematic use of timeouts.
  • Multi-instance support for concurrent API calls for multiple peripheral instances.
  • User-callback functions for peripheral initialization, de-initialization, interrupt events, and error events.
  • An object locking mechanism for safe access to shared resources.
  • Timeouts for all blocking processes.

Low-Layer (LL) Driver Features

LL drivers provide hardware services directly mapped to peripheral capabilities. They offer:

  • An expert-oriented layer with optimized performance but less portability.
  • Direct register manipulation, requiring a deep understanding of MCU and peripheral specifications.
  • APIs are not provided for peripherals where optimized access is not critical or requires complex software configuration.

Complementary Nature of HAL and LL

The HAL and LL drivers are designed to be complementary, covering a wide range of application requirements. HAL offers high-level, portable APIs, while LL provides optimized, low-level access.

Development Standards

The HAL and LL driver source code is developed in Strict ANSI-C, ensuring tool independence. It is checked with the CodeSonar® static analysis tool and is fully documented, adhering to the MISRA C®:2012 standard.

Further Information

For detailed information on specific peripherals, driver structures, functions, and usage examples, please refer to the full documentation available on the STMicroelectronics website.

PDF preview unavailable. Download the PDF instead.

dm00610707-description-of-stm32g4-hal-and-lowlayer-drivers--stmicroelectronics Antenna House PDF Output Library 6.5.1119 (Windows (x64)); modified using iText 2.1.7 by 1T3XT C2 v4.2.0220 build 670 - c2 rendition config : Techlit Active

Related Documents

Preview STM32F4 HAL and Low-Layer Drivers User Manual
This document, UM1725, provides a comprehensive overview of STMicroelectronics' STM32Cube ecosystem, focusing on the Hardware Abstraction Layer (HAL) and Low-Layer (LL) drivers specifically designed for the STM32F4 microcontroller series. It details driver structure, features, and usage for efficient embedded software development.
Preview STM32WB HAL and Low-Layer Drivers User Manual
This user manual provides a comprehensive guide to the STM32WB HAL (Hardware Abstraction Layer) and low-layer drivers. It details the STM32Cube ecosystem, driver architecture, APIs, and data structures, enabling developers to efficiently build applications for STM32WB microcontrollers.
Preview Description of STM32H7 HAL and Low-Layer Drivers User Manual
This user manual (UM2217) provides a comprehensive description of the STMicroelectronics STM32H7 Hardware Abstraction Layer (HAL) and Low-Layer (LL) drivers. It details the STM32Cube ecosystem, driver features, API programming models (polling, interrupt, DMA), and support for single-core and dual-core Arm Cortex-M7 and Cortex-M4 architectures, aiding developers in efficient STM32H7 microcontroller application development.
Preview STM32CubeF3 User Manual: Getting Started with STM32F3 Series
Explore the STM32CubeF3 firmware package with this comprehensive user manual. Learn about its architecture, features, middleware components, and how to get started developing applications for STM32F3 series microcontrollers.
Preview Getting Started with STM32CubeG0 for STM32G0 Series User Manual
This user manual provides a comprehensive guide to getting started with the STM32CubeG0 MCU Package from STMicroelectronics. It covers the package's features, architecture, and how to use its various components, including STM32CubeMX, HAL and LL drivers, and middleware. The document details how to set up projects, develop applications, and utilize the provided examples for the STM32G0 series of microcontrollers.
Preview STM32CubeMX for STM32 Configuration and Initialization C Code Generation - User Manual
This user manual provides a comprehensive guide to STM32CubeMX, a graphical tool for STM32 products. It covers configuration, initialization, and C code generation for STM32 microcontrollers, including features like microcontroller selection, pinout configuration, clock tree setup, and middleware integration. The document also details project management, code generation options, and various tutorials for practical application.
Preview Getting Started with STM32CubeH7RS for STM32H7Sx/7Rx MCUs
This user manual provides a comprehensive guide to getting started with the STM32CubeH7RS MCU Package. It details the STM32Cube initiative, the features of the STM32CubeH7RS MCU Package, its architecture, and how to develop applications using it.
Preview STM32Cube MCU Package Examples for STM32WB Series - STMicroelectronics Application Note AN5155
This application note provides a comprehensive overview of the STM32CubeWB MCU Package, detailing the rich set of firmware examples, applications, and demonstrations available for the STM32WB Series microcontrollers. It guides developers on utilizing the package's features, including HAL, LL, and BSP drivers, for various embedded system development tasks.