2020-06-27 06:11 AM
Hi,
Is HAL_Delay() implemented with SysTick() interrupt ?
Is it safe to use HAL_Delay() in while loop main.c
with other ( low priorities ) interrupts?
Thanks
--
Karan
2020-06-30 12:53 AM
I do not use HAL_Delay() in interrupts . I want to use HAL_Delay() in main with interrupts
2020-06-30 01:37 AM
What is it that still prevents you from using it?
2020-06-30 02:12 AM
Hi,
If I use HAL_Delay() in main and other high priority interrupts ?
Got below errors..
As Pavel A. (Community Member) Said :
"As @berendi (Community Member) replied, in main just call HAL_Delay. Unless you need delay while interrupts are disabled. Or unless you want more precise delay (microseconds). Just try it. Do not change the systick priority."
I don't want to disable my high priority interrupts.
--
Karan
2020-06-30 02:27 AM
> If I use HAL_Delay() in main and other high priority interrupts ?
> Got below errors..
Fix them, integer overflow and array indexing problems, have nothing to do with interrupts, delays, or priorities.
> I don't want to disable my high priority interrupts.
Then what is the problem?
2020-06-30 03:22 AM
Take a step back and ask yourself: where are the time critical actions (that needs to kick in within 1 msec)
Interrupts should remain very brief. If you do things that take time within an interrupt, something is wrong in the implementation.
HAL_Delay has "1 msec jitter" to be very brief
Timer Output Compare can be used to generate any period measurement. The finer the time granularity, the higer frequency the timer runs.
If you need to drive LED Segment, why not use TIMER to generate a burst of clock pulses, and use another output compare channel(s) (interrupts?) to flip the data GPIOs if the LED clock frequency is few kHz ? The implementation depends on the timing constrains of the system and the timing/latency constrains within the microcontroller. This is what SW tools won't help much. It's called SW profiling.
2022-09-24 04:04 AM
Quote: This is why HAL_Delay() should not be used in an interrupt routine.
A blocking call have to be avoided in ANY interrupt routine in any circumstances!