diff --git a/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c b/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c index 75c19f6b2..29173a8b5 100644 --- a/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c +++ b/os/hal/ports/STM32/LLD/TIMv1/gpt_lld.c @@ -752,10 +752,10 @@ void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval) { gptp->tim->ARR = (uint32_t)(interval - 1); /* Time constant. */ gptp->tim->EGR = STM32_TIM_EGR_UG; /* Update event. */ - gptp->tim->SR = 0; /* Clear pending IRQs. */ gptp->tim->CR1 = STM32_TIM_CR1_OPM | STM32_TIM_CR1_URS | STM32_TIM_CR1_CEN; while (!(gptp->tim->SR & STM32_TIM_SR_UIF)) ; + gptp->tim->SR = 0; /* Clear pending IRQs. */ } #endif /* HAL_USE_GPT */