cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_Delay counter wrap problem. in HAL_Delay current timer count is read first (tickstart = HAL_GetTick()) and the function waits till (while((HAL_GetTick() - tickstart) < wait)) the difference is equal or greater than given value. What happens if

Parmin Nayani
Associate III

current tick count is say 0x0fffffffff (just 15 short of an over flow) and if my delay (wait) is say 20. Running count will rollover after 15 ticks and becomes 0. The new comparison will 0-0x0fffffff. Will the delay still work? I guess not. Your valuable comments please? Thank you.

10 REPLIES 10

Hi LCE,

Yes good suggestion. I will check by changing systick counter.