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.
STM32CubeMX
Download and install STM32CubeMX from the official website.
Project Configuration
Initialization
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:
Set both HSE
and LSE
options to use external crystal oscillators:
Clock Tree Configuration
Configure the clock settings in the Clock Configuration
interface.
Follow these steps based on the image above:
- Enter the values for the two leftmost frequencies based on the parameters of the onboard external crystal oscillator.
- Check the
HSE
box since the external crystal oscillator has higher frequency and precision than the internal oscillator. - Check the
PLLCLK
box to use PLL (Phase-Locked Loop) multiplication for higher frequencies. - 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
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
- Explanation of the STM32 System Clock RCC
- Board Initialization: Complete Configuration of the RCC Clock Tree
- Comprehensive Summary of STM32 HAL Knowledge
- It's Clear Now: A Comprehensive Summary of STM32 HAL Knowledge
Original: https://wiki-power.com/ 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.