cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any bug in code HAL_Delay() not works?

parth kothiya
Senior

HAL_Delay() function gives infinite delay.

i am toggle led using delay.

below my simple project files.

5 REPLIES 5

It needs the SysTick or other TIM source to interrupt and count.

It therefore has some interrupt and priority issues if miss used under interrupt context or callbacks.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

You can inspect the source for HAL_Delay and verify it's doing the right thing. It doesn't need to be treated as a black box.

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

as you said i removed HAL_Delay() function and i monitor variable uwTick maimum value of variable is 406 then variable is automatically set to 0 you can see in below image.

that's the problem but why it get automatically reset to 0

so i check reset pins of MCU automatically pulled low continuous time interval so my MCU get RESET i don't know why its automatically pulled low?

0693W00000HqkMUQAZ.bmp

TDK
Guru

I didn't say to remove HAL_Delay.

Monitor RCC_CSR register at startup to determine the cause of reset.

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

I read rcc_csr before halinit function

It shows internal watchdog timer reset bit set

​I haven't set any watchdog timer in my program.

i preform full chip erase and then i read RCC_CSR it gives same value.