STM32 gpt_lld_polled_delay race condition Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
openglfreak
Posts: 1
Joined: Wed Oct 19, 2022 6:01 am
Been thanked: 1 time

STM32 gpt_lld_polled_delay race condition  Topic is solved

Postby openglfreak » Wed Oct 19, 2022 6:15 am

Hello,

this is a re-hash of this topic, it seems like on my MCU the fix from there (that is upstream) was not enough.

Disabling the timer before updating its registers fixes the bug again for me:

Code: Select all

diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c b/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c
index f7c449edb..d6433a3b1 100644
--- a/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c
+++ b/os/hal/ports/STM32/LLD/TIMv1/hal_gpt_lld.c
@@ -1121,6 +1121,7 @@ void gpt_lld_stop_timer(GPTDriver *gptp) {
  */
 void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval) {
 
+  gptp->tim->CR1 = STM32_TIM_CR1_UDIS;
   gptp->tim->ARR = (uint32_t)(interval - 1U);   /* Time constant.           */
   gptp->tim->EGR = STM32_TIM_EGR_UG;            /* Update event.            */
   gptp->tim->SR  = 0;                           /* Clear pending IRQs.      */

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32 gpt_lld_polled_delay race condition

Postby Giovanni » Sun Nov 20, 2022 9:51 am

Hi,

Fixed as bug #1241.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: Bing [Bot] and 12 guests