From 23f03c8030433cee832c8a47f666fdb31c85d6ac Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 6 Feb 2023 15:48:11 +0100 Subject: [PATCH] drivers: timer: stm32u5 lptimer waits for DIER complete On the stm32U5, when modifying the DIER register of the LPTIM peripheral, a new write operation to can only be performed when the previous write operation is completed and before going-on. Signed-off-by: Francois Ramu --- drivers/timer/stm32_lptim_timer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/timer/stm32_lptim_timer.c b/drivers/timer/stm32_lptim_timer.c index f27b07182cb..bb4e460ec6d 100644 --- a/drivers/timer/stm32_lptim_timer.c +++ b/drivers/timer/stm32_lptim_timer.c @@ -435,6 +435,11 @@ static int sys_clock_driver_init(void) /* ARROK bit validates the write operation to ARR register */ LL_LPTIM_EnableIT_ARROK(LPTIM); stm32_lptim_wait_ready(); +#ifdef CONFIG_SOC_SERIES_STM32U5X + while (LL_LPTIM_IsActiveFlag_DIEROK(LPTIM) == 0) { + } + LL_LPTIM_ClearFlag_DIEROK(LPTIM); +#endif LL_LPTIM_ClearFlag_ARROK(LPTIM); accumulated_lptim_cnt = 0;