Skip to content

Commit 6244e93

Browse files
asm5878kartben
authored andcommitted
drivers: timer: Fix interrupt management in stm32 lptim timer
Fix interrupt management issue in stm32 lptim timer Signed-off-by: Alessandro Manganaro <[email protected]>
1 parent e5ded3d commit 6244e93

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/timer/stm32_lptim_timer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
244244
counter_get_value(stdby_timer, &stdby_timer_pre_stdby);
245245
lptim_cnt_pre_stdby = z_clock_lptim_getcounter();
246246

247+
LL_LPTIM_DisableIT_ARROK(LPTIM);
248+
LL_LPTIM_ClearFlag_ARROK(LPTIM);
249+
NVIC_ClearPendingIRQ(DT_INST_IRQN(0));
247250
/* Stop clocks for LPTIM, since RTC is used instead */
248251
clock_control_off(clk_ctrl, (clock_control_subsys_t) &lptim_clk[0]);
249252

@@ -552,6 +555,7 @@ static int sys_clock_driver_init(void)
552555
LL_LPTIM_ClearFLAG_ARRM(LPTIM);
553556

554557
/* ARROK bit validates the write operation to ARR register */
558+
autoreload_ready = true;
555559
LL_LPTIM_EnableIT_ARROK(LPTIM);
556560
stm32_lptim_wait_ready();
557561
LL_LPTIM_ClearFlag_ARROK(LPTIM);

0 commit comments

Comments
 (0)