Skip to content

HAL Library Development Notes - Environment Setup

Note: This tutorial is based on the STM32F429IGT6 board by STM32.

Software Installation

Keil MDK

Refer to the article Keil MDK Configuration Guide for details.

Java Runtime Environment

This is the Java environment required for STM32CubeMX. Download and install it from the official website.


Download and install STM32CubeMX from the official website.

Project Configuration


Create a new project, select the microcontroller, and save the project.

SYS Configuration

Pinout & Configurations - System Core - SYS

Change the Debug option to Serial Wire (see the article CubeMX and CubeIDE Pitfalls for the rationale).

RCC Configuration

Pinout & Configurations - System Core - RCC

Configure it according to your board's specifications.

For example, refer to the board's schematic:

Board Schematic

Set both HSE and LSE options to use external crystal oscillators:

Clock Settings

Clock Tree Configuration

Configure the clock settings in the Clock Configuration interface.

Clock Configuration

Follow these steps based on the image above:

  1. Enter the values for the two leftmost frequencies based on the parameters of the onboard external crystal oscillator.
  2. Check the HSE box since the external crystal oscillator has higher frequency and precision than the internal oscillator.
  3. Check the PLLCLK box to use PLL (Phase-Locked Loop) multiplication for higher frequencies.
  4. Enter the value for HCKL, usually based on the maximum recommended frequency shown below, and press Enter. It will automatically calculate the prescaler and multiplier values.

Project Management Options Configuration

Project Management Options

Project Management Options

Differences Between HAL Library and Standard Library

To enhance portability, the HAL library includes three additional features compared to the standard library: handles, MSP functions, and callback functions. For more details, refer to the content in the cited links at the end of this document.

References and Acknowledgments

Original: This post is protected by CC BY-NC-SA 4.0 agreement, should be reproduced with attribution.

This post is translated using ChatGPT, please feedback if any omissions.