FreeRTOS Tick/Tickless via LPTIM
FreeRTOS Tick/Tickless via LPTIM
Use LPTIM for the FreeRTOS tick instead of the SysTick Timer for ultra-low-power applications.
This repository demonstrates integration and testing of the lptimTick.c gist on Nucleo-L476RG (STM32L476). The project uses STM32CubeIDE and its integrated code-generation tool (STM32CubeMX). However, lptimTick.c is compatible with any toolchain supported by FreeRTOS.
A separate repository, LPTIM-Tick-U5, is adapted to the STM32U family.
For a thorough evaluation, this project can be built without tickless idle, with the default tickless idle, or with the custom tickless idle provided by lptimTick.c. See branches for additional evaluation options.
Press the blue button to cycle between tests:
Tests 2 and 3 display live test results to a serial terminal. Connect to the STLink Virtual COM Port at 115200 8N1. Additionally, the LED blinks twice (instead of just once) in case of test failure.
Current readings shown are averages, not including the LED
With lptimTick.c (configUSE_TICKLESS_IDLE 2
)
Default tickless idle (configUSE_TICKLESS_IDLE 1
)
Tickless disabled (configUSE_TICKLESS_IDLE 0
)
configUSE_TICKLESS_IDLE
to 2
, and eliminate the preprocessor definition for xPortSysTickHandler
. If using LSI instead of LSE, define configTICK_USES_LSI
and configLPTIM_REF_CLOCK_HZ
(typically 32000
or 37000
), too.