Question
Bug HAL_delay() off by 1ms
By coincidence I discovered a bug in HAL_delay().
__weak void HAL_Delay(uint32_t Delay)
{
uint32_t tickstart = HAL_GetTick();
uint32_t wait = Delay;
/* Add a period to guaranty minimum wait */
if (wait < HAL_MAX_DELAY)
{
wait++;
}
while((HAL_GetTick() - tickstart) < wait)
{
}
}
Since HAL_MAX_DELAY is 0xFFFFFFFFU you always get a 1 ms bonus. Please fix it ST this is pretty sloppy. I wonder how you test your software.
This is for MCU package STM32Cube_FW_L4_V1.13.0.
