AnsweredAssumed Answered

HAL_Delay() not working.. help (newbie)

Question asked by Chan on Dec 4, 2015
Latest reply on Dec 4, 2015 by Chan
I tried using HAL_Delay(); I thought I can just use HAL_Delay(500); but it's not working.

the code is below. (from STM32cubeF4)
__weak void HAL_Delay(__IO uint32_t Delay)
  uint32_t tickstart = 0;
  tickstart = HAL_GetTick();
  while((HAL_GetTick() - tickstart) < Delay)
I found the first time tickstart = HAL_GetTick() is performed, the tickstart has the value 0. The second time, HAL_GetTick() returns some big value so it stays endlessly in while statement.

Is there something I should do before using HAL_Delay()?