Skip to main content
parth kothiya
Associate III
January 5, 2022
Question

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

  • January 5, 2022
  • 5 replies
  • 1264 views

HAL_Delay() function gives infinite delay.

i am toggle led using delay.

below my simple project files.

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
January 5, 2022

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
TDK
January 5, 2022

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""."
parth kothiya
Associate III
January 6, 2022

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
January 6, 2022

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""."
parth kothiya
Associate III
January 7, 2022

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.