2026-04-20 2:46 AM - last edited on 2026-04-20 3:53 AM by mƎALLEm
We are currently using LPTIM1 to measure the time period. As this operation needs to be performed frequently, we are using the following APIs:
During this process, the LPTIM_Disable() function temporarily disables all interrupts using PRIMASK while waiting for the LPTIM_FLAG_ARROK and LPTIM_FLAG_CMPOK flags.
This global interrupt masking is causing data loss on LPUART1, which is operating at 115200 baud. As a result, we are encountering ORE (Overrun Error) due to missed UART interrupts.
Given this behaviour, we would like your guidance on the following:
We are concerned about maintaining real-time UART reception alongside frequent LPTIM reconfiguration.
2026-04-20 8:13 AM
Normally, it should be enough to clear LPTIM_CR.ENABLE.
Looking at LPTIM_Disable(), it cites the "Device may remain stuck in LPTIM interrupt when entering Stop mode" erratum as the reason for the complex procedure involving resetting the whole LPTIM and then painstakingly (and due to asynchronous clocks domains, potentially slowly) restoring its registers' content.
In other words, if you don't use STOP mode, you are probably OK with simply clearing LPTIM_CR.ENABLE instead of calling LPTIM_Disable() as it is now.
I am not ST.
JW
2026-04-24 2:09 AM
Hello @Makk
For the first question, we do not recommend removing the PRIMASK protection in LPTIM_Disable(). It is safer to keep the HAL behavior unchanged.
Recommended solution:
Use LPUART1 reception in circular DMA mode to avoid UART data loss during the brief interrupt-masked sections caused by frequent LPTIM reconfiguration.
Thank you!