HAL LPTIM Overview ¶
Introducing LPTIM ¶
- group LPTIM_Introduction
-
STM32 low-power timers (LPTIM) provide ultra-low-power time base generation, periodic events, pulse counting, and low-frequency PWM while the device operates in low-power modes. They enable energy-efficient wake-up scheduling, low-speed signal measurement, and autonomous timing functions in battery-powered and power-constrained embedded systems.
The LPTIM HAL driver simplifies the configuration, initialization, and management of low-power timer operations by supporting polling, interrupt, and, where available, DMA modes, enabling flexible and efficient low-power timing control.
Additionally, it supports multiple LPTIM instances and features such as encoder mode, one-pulse mode, and external clocking, depending on the STM32 device, ensuring portability and consistency of low-power timing capabilities across different STM32 series.
Module and files ¶
The following diagram illustrates the LPTIM module and its associated files.
Component diagram ¶
The following diagram illustrates the software components involved in the LPTIM module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.
Configuration table ¶
The following table lists the configuration defines for the HAL LPTIM module, specifying their locations, default values, and descriptions:
- group LPTIM_Configuration_Table
-
¶
Configuration inside the HAL LPTIM driver: ¶
Config defines
Where
Default value
Note
USE_HAL_LPTIM_MODULE
hal_conf.h
1
Enable the HAL LPTIM module
USE_HAL_LPTIM_REGISTER_CALLBACKS
hal_conf.h
0
Allow the user to define custom callbacks
USE_HAL_LPTIM_CLK_ENABLE_MODEL
hal_conf.h
HAL_CLK_ENABLE_NO
Enable the gating of the peripheral clock
USE_HAL_LPTIM_USER_DATA
hal_conf.h
0
Add user data inside the HAL LPTIM handle
USE_HAL_LPTIM_GET_LAST_ERRORS
hal_conf.h
0
Enable retrieval of the last process error codes
USE_HAL_LPTIM_DMA
hal_conf.h
1
Enable DMA support inside HAL LPTIM
USE_HAL_CHECK_PARAM
hal_conf.h
0
Enable checking of vital parameters at runtime
USE_HAL_MUTEX
hal_conf.h
0
Enable semaphore usage in the HAL driver
USE_HAL_CHECK_PROCESS_STATE
hal_conf.h
0
Enable atomic access to process state checks
USE_ASSERT_DBG_PARAM
PreProc env
NONE
Enable parameter checks for HAL
USE_ASSERT_DBG_STATE
PreProc env
NONE
Enable state checks for HAL