HardFault_Handler Error

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.


What MCU/Processor/Board and compiler are you using?

What LVGL version are you using?

What do you want to achieve?

I sometimes get HardFault_Handler() during code execution, why? Both stack size and heap size are sufficient.

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

  • What kind f platform do you use?
  • Do you se something interesting with a debugger?
  • Please enable LVGL’s logging.
  • If you use an OS be sure to read this

STM32CubeIDE is in use.
I don’t know what to watch with a debugger.
What should I watch after enabling logs?
I’m using it by connecting the board to the OS.

In the debugger if you are lucky you will see a call stack and you can see from where the hard fault was “called”.