2017-09-09 03:59 PM
I generated my code with cubemx, and when i call function HAL_Delay it somehow causes an infinite loop,
anyone Know how to solve this problem?, using Keil IDE. thank you all
#cube-hal2017-09-11 12:50 AM
The problem is most probably that the HAL_Delay() is called from an ISR of the same (or higher) preemption priority as the SysTick interrupt. In this case the SysTick IRQ cannot preempt the current ISR, which would be essential to be able to update the global ms counter. The root cause might be that you insert a delay in a Callback, which are always called from an interrupt handler. It is generally not recommended to perform waiting inside of an ISR, but then again the HAL library does it (see e.g. SPI), so...
I have previously proposed a better, polling mode implementation of HAL_Delay() in
, if you place this function without the __weak attribute in your code (the current HAL prototype is 'void HAL_Delay(__IO uint32_t Delay)', so make sure you define it like this), the compiler should use this version instead of the original, and you shouldn't run into this problem again.