STM32 CUBE IDE, HAL FROM EMBEDDED SYSTEMS.

INDANI SATYA SAI MOULI
3 min readMar 25, 2024

--

Introduction:

In this very blog I would like to discuss about STM32 CUBE IDE, Hardware Abstraction Layer (HAL), Application Code, Types of Priorities.

What is STM32 CUBE IDE ?

STM32CubeIDE is an all-in-one multi-OS development tool, which is part of the STM32Cube software ecosystem. STM32CubeIDE is an advanced C/C++ development platform with peripheral configuration, code generation, code compilation, and debug features for STM32 microcontrollers and microprocessors.

What is HAL ?

HAL (Hardware Abstraction Layer) is a set of high-level APIs provided for interfacing with the hardware peripherals. It abstracts low-level hardware details, simplifying development and portability across microcontrollers. HAL provides functions for tasks such as GPIO manipulation, UART communication, and timer control. It facilitates rapid prototyping and development of embedded applications by offering a consistent interface across various STM32 microcontroller families. HAL also integrates seamlessly with STM32CubeMX, a graphical configuration tool, to further streamline development workflows.

Application Programming Interface (API):

A set of functions and protocols that enable communication and interaction between software components and hardware peripherals. These API’s abstract low-level hardware details, allowing developers to write portable and reusable code. API’s in embedded systems often provide access to features such as GPIO control, serial communication, timers, and interrupt handling. They simplify software development by providing a standardized interface and hiding complex hardware interactions. API’s play a crucial role in facilitating the development of embedded applications by offering a layer of abstraction over hardware complexities.

Step by Step process of Application code in STM32 MiccroController:

From the above flow chart we can see different sections with different names which are ment to be main components for execution in the Application code.

STM32F1XX_HAL_DRIVER_LAYER: A function which initiates the program or specific task of the program which has to be executed.

Cortex Microcontroller Software Interface Standard (CMSIS CORE): which is also a type of container consisting of bunch of API’s accesses processor core functionalities/peripherals.

Core Peripheral Access Layer (CPAL): A pathway under CMSIS CORE which access processor core API’s and functionalities.

Processor Core: A processor core is the central processing unit (CPU) within a microcontroller or microprocessor, responsible for executing instructions and performing computations in an embedded system. It serves as the primary computational engine, processing data and controlling the operation of the system. It consist of NVIC, MSP, SYSTIC.

Nested Vector Interrupt Control (NVIC): A crucial component in many embedded systems, including ARM Cortex-M-based microcontrollers like those in the STM32 series. It manages interrupts by prioritizing and handling multiple interrupt requests efficiently. The NVIC supports nested interrupts, allowing higher-priority interrupts to preempt lower-priority ones, ensuring timely response to critical events while maintaining interrupt integrity.

MicroController Support Package (MSP): Provides libraries, drivers, and tools tailored for specific microcontroller families, simplifying development and enabling efficient utilization of hardware features in embedded systems. It offers standardized APIs and configurations to streamline software development for the targeted microcontroller platform.

SYSTIC Timer : A peripheral which generates an interrupt for every millisecond.

USART, I2C, CAN, Timer, GPIO, SPI are the functionalities which access API’s based on Microcontroller.

NVIC gives priority to the interrupt request’s.

Priorities can be divided into two types :

Preemption Priority : A priority when an interrupt must be executed immediately. It is classified into: High & Low

High Preemption Priority : An interrupt must be considered as very emergency task.

Low Preemption Priority : An interrupt can be put in the waiting list.

Sub Priority : A type of priority where tasks are arranged in the “Sequential order” based on emergencies.

--

--