cancel
Showing results for 
Search instead for 
Did you mean: 

False LPTIM CMPM Interrupts ( STM32L071)

DKilg
Associate

If the LPTIM CNT is close to the ARR value (0xFFFF) and i set the CMPM value, i receive the interrupt immediately (~1ms) instead of the time i set it. Because the LPTIM runs on 32kHz this happens every 2seconds for 4-5 interrupts.

I dont seems to find a workaround to fix this issue. Waiting for the LPTIM_FLAG_CMPOK flag to be ready , enabling disabling the interrupt, nothing helps.

STM32L071

__HAL_LPTIM_COMPARE_SET(&hlptim1, timeout + LPTIM_Read_Counter());	
while (!(__HAL_LPTIM_GET_FLAG(&hlptim1, LPTIM_FLAG_CMPOK)));
__HAL_LPTIM_CLEAR_FLAG(&hlptim1, LPTIM_FLAG_CMPM);
__HAL_LPTIM_ENABLE_IT(&hlptim1, LPTIM_IT_CMPM);		
 
__WFI();
		
__HAL_LPTIM_DISABLE_IT(&hlptim1, LPTIM_IT_CMPM);	

0 REPLIES 0