AnsweredAssumed Answered

STM32F746 Disco HardFault

Question asked by Gerber on Apr 30, 2017
Latest reply on May 22, 2017 by Gerber

Hi,

Creating a EmWin application based on a STM32F746 Disco, using OpenSTM32. I toke the STemWin example application as a starting point. Occasionally (once every 1-3 hours of operation) I'm running into a Hard Fault (stm32f7xx_it.c -> HardFault_Handler()).

 

The default HardFault_Handler doesn't give me a root cause. I use the description below to further extent the HardFault_Handler.
https://blog.frankvh.com/2011/12/07/cortex-m3-m4-hard-fault-handler/

 

I have implemented the code below in startup_stm32f746xx.s.

HardFault_Handler:

  TST LR, #4

  ITE EQ

  MRSEQ R0, MSP

  MRSNE R0, PSP

  B hard_fault_handler_c

 

Now when a hard fault occurs the MCU is stuck at line “TST LR, #4”, not sure what I’m doing wrong. Maybe this assembler code is not compatible with Cortex M7?

 

What is the best and fastest way to track down the actual hard fault root cause on a Cortex M7?

Thanks. 

Outcomes