cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_Delay never exits even after increasing the priority of Systick to highest priority.

TH.16.336
Associate III

Hi all,

I am working with the Nucleo-F446ZE board.

I generated a project with CubeMx .

At this point the project is running fine with UART interrupts and data.

I debug the project and all is working.

I need to use a delay function in my project. SO I have used HAL_Delay(20); for example.

But it never exits from that function. Debugging at it came to know it stuck in below while loop.

 while((HAL_GetTick() - tickstart) < wait)

 {

 }

Any help?I am using the Delay function inside UART ISR. Please help.

5 REPLIES 5
KnarfB
Principal III

Using HAL_Delay in an ISR is rarely a good idea. Are you sure that the USART ISR prio is lower than SysTick?

TDK
Guru

Possibilities:

1) SysTick interrupt isnt set up or enabled

2) interrupts are disabled

3) priority of systick is less or equal to that of the uart. Note that priority of 0 is highest priority.

4) interrupts cannot preempt each other. Check priority grouping setting.

If you feel a post has answered your question, please click "Accept as Solution".
dbgarasiya
Senior II

check your interrupt settings

Looks like both interrupts priority was same.

This was causing the issue. Thanks for the reply. Now it's working.

Looks like both interrupts priority was same as 0.

This was causing the issue. Thanks for the reply. Now it's working.