2025-01-15 09:59 AM - last edited on 2025-01-15 10:04 AM by Andrew Neil
Hi everyone,
I'm new to STM32CubeIDE and encountering an issue with my code. It seems to halt at the following loop:
while ((HAL_GetTick() - tickstart) < wait)
{
}
I've attached the .ioc file for reference. Can someone help me identify why the program gets stuck here and suggest a fix?
Thanks in advance!
2025-01-15 10:03 AM
Have you not properly configured the HAL tick?
What if you use HAL_Delay() ?
Did you see this note - found in many (most? all?) of ST's examples:
@note Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds)
based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from
a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower)
than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.
@note The application need to ensure that the SysTick time base is always set to 1 millisecond
to have correct HAL operation. -