Skip to main content
APlot.1
Associate II
March 19, 2021
Question

STM32H742VG HardFault()

  • March 19, 2021
  • 6 replies
  • 1261 views

Dear comrades!

I have encountered a problem while debuging my STM32H742VG project.

I am falling into HardFault just after system init and do not know any reason why it is happening.

I am starting my MCU with HSI clock and debugign with a STLink v2 debugger.

Could anyone help me with solving the problem please?

This topic has been closed for replies.

6 replies

Tesla DeLorean
Guru
March 19, 2021

Use a Handler that outputs actionable data, and with an understanding of the registers/state inspect the offending code in a disassembly.

Super early check stack alignment and RAM used.

T​urn off "run to main" and walk in the code.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
APlot.1
APlot.1Author
Associate II
March 19, 2021

Thank you - I will try this.

But first I would like to ask you if there is an easier way 'cause I have never tried to solve problems via disassembly.

Maybe a blank-default way to start th MCU? I just think that there is something very simple I am forgeting to turn on at the start...

Tesla DeLorean
Guru
March 19, 2021

You could walk your code and look for errant pointer. Check malloc/new​ don't fail, returning NUL pointers.

Check alignment issues.

Check the FPU is enabled.

Check it is linking the right libraries.​

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