AnsweredAssumed Answered

HAL ticks and timer rollover

Question asked by manderson on Jun 4, 2014
Latest reply on Jun 17, 2014 by Montassar BEN ROMDHANE
The HAL_GetTick() is used implement timeouts within the HAL library with code similar to:

      /* Get timeout */
      timeout = HAL_GetTick() + HSE_TIMEOUT_VALUE;
      
      /* Wait till HSE is disabled */  
      while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET)
      {
        if(HAL_GetTick() >= timeout)
        {
          return HAL_TIMEOUT;
        }      
      }

However there is no consideration for timer rollover which will occur after approximately 47 days. This will lead to unexpected behavior where a timeout will fire before the timeout period expires. Unfortunately similar timer code to this is used pervasively throughout the HAL.

On a related note is there an official bug tracker for the HAL library, or is this forum the suggested route for reporting bugs?

Matt

Outcomes