cancel
Showing results for 
Search instead for 
Did you mean: 

Program debug getting struck in Hardfault handler and HAL_Delay()

sireevenkat1
Senior

Hi,

I am working with STM32G491RET6 custom board and for debugging I am using segger jlink debugger with STM32 Cube IDE 1.13.0. Everything working correctly like flashing and debugging.

1.But I don't know what happened suddenly while debugging program getting struck in either Hardfault_handler() or in below function.

__weak uint32_t HAL_GetTick(void)

{

return uwTick;

}

2.While debugging I get to know that only one time its going inside while loop next
time its going to either Hardfault handler or HAL_GetTick function.
3.I changed the jlink debugger also I am facing same issue.I took new project in cube ide I only checked GPIO toggle with that also same issue I am facing

4.With Development board same program working perfectly. Can anyone suggest what's going wrong .


Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

> I am working with STM32G491RET6 custom board

> With Development board same program working perfectly.

So probably an error or issue in your custom board. Can you show the schematic? Ensure power is supplied, properly decoupled, ensure VCAP pins have appropriate capacitors.

https://www.st.com/resource/en/application_note/an5093-getting-started-with-stm32g4-series--hardware-development-boards-stmicroelectronics.pdf

 

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

View solution in original post

4 REPLIES 4
Tinnagit
Senior II

HAL_GetTick, it cannot take you to Hardfault_handler. 

You should go to there by some hardware feature go wrong.

while it go to Hardfault_handler, do you can continue debugging or the debugging also error too.

I guess that it may happen from your external oscillator or your power which it can let your controller reset while operating.

Have the Hard Fault Handler output actionable data, and then identify and root cause those issues.

If waiting likely to spend bulk of time in delay functions. Instrument your code so you know the flow and where it is without stopping it constantly. 

Check clocking, PLL settings, flash wait states. Check HSE_VALUE. 

Try running without changing clocking source. 

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

> I am working with STM32G491RET6 custom board

> With Development board same program working perfectly.

So probably an error or issue in your custom board. Can you show the schematic? Ensure power is supplied, properly decoupled, ensure VCAP pins have appropriate capacitors.

https://www.st.com/resource/en/application_note/an5093-getting-started-with-stm32g4-series--hardware-development-boards-stmicroelectronics.pdf

 

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

Hi,
Thanks everyone for suggestions. Issue was resolved. Issue was with custom board. Soldering got shorted in custom board it causes the power connections to short.