Question
HAL ticks and timer rollover
Posted on June 04, 2014 at 14:57
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 #i-want-to-smack-people