AnsweredAssumed Answered

Hard Fault with "STemWin_HelloWorld" Example.

Question asked by Andrew Hazelton on Oct 11, 2017
Latest reply on Oct 11, 2017 by Clive One

Compiler:           IAR Workbench v8.11.3

Graphics:           STemWin

Hardware:          STM32746G Discovery Board

HAL Version:     V1.8.0

Demo Project:   C:\STM32Cube_FW_F7_V1.8.0\Projects\STM32746G-Discovery\Applications\STemWin\STemWin_HelloWorld

 

Problem:

I have created a simple project based on the “STemWin_HelloWorld” example for the STM32746G Discovery Board. I have created two screens with a button on each. The button on each screen loads the other screen, and visa-versa. If you switch back and forth the screens a couple of times the program gets stuck in the “void HardFault_Handler(void)” routine.

From the viewing, the System Control Block Registers with the debugger I can see that the following bits are set.

BusFault Status register

BFSR -> BFARVALID

BFSR -> IMPRECISERR

UsageFault Status register

UFSR -> UNALIGNED

UFSR -> UNDEFINSTR

Different combinations of these bits are set each time you reset the MCU. From reading the manual it appears that a bad instruction is causing the fault but I am unable to narrow down as to where. Can anyone please assist in stopping the program going into the “void HardFault_Handler(void)” routine?

 

Please un-zip the attached project into the below directory:

C:\STM32Cube_FW_F7_V1.8.0\Projects\STM32746G-Discovery\Applications\STemWin\

Outcomes