cancel
Showing results for 
Search instead for 
Did you mean: 

Hardfault handler error during long run

RiverDi_user
Associate III

Hello,

I am having a custom touchgfx application running on a RiverDI 5 inch display board with STM32. During the application run, the application halts at 'hardfault handler' randomly after few hours of run. These are the measure I tried to debug the issue, but none of them worked.

1. Increased the touchgfx task priority to high (from normal)

2. Increased the touchgfx task size

3. Set the CHECK_FOR_STACK_OVERFLOW to 2 in ioc

4. Modified the clock source

Everytime when the fault hits, there is no proper stack trace and the stack trace doesnt show the issue origin. The fault analyzer is showing PRECISERR in the window.

When I debugged further in assembly instructions, one time it faulted in vldr execution and next time it faulted in ldr execution. 

Is there a way I can get more information on the stack trace? The issue is not quickly reproducible, it reproduces randomly over 4 hours or above.


RiverDi_user_0-1725513156492.png

RiverDi_user_1-1725513216096.png

RiverDi_user_2-1725513295467.png

Your support is much appreciated!

 

Thanks & Regards

RiverDI user

5 REPLIES 5
Sarra.S
ST Employee

Hello @RiverDi_user, which STM32 are you using? 

Since the fault occurred during a vldr or ldr instruction, it may be an issue with loading data from memory, this could be due to an invalid pointer or an out-of-bounds access.

You'll also need to review the detailed fault handler (values of registers R0-R3, R12, LR, PC, and xPSR.) to reconstruct the call stack and identify the function and line of code where the fault occurred

This article might be very helpful: How to debug a HardFault on an Arm Cortex®-M STM32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


@RiverDi_user wrote:

the application halts at 'hardfault handler' randomly after few hours of run.


Similar:

https://community.st.com/t5/stm32-mcus-embedded-software/hardfault-udp-client/td-p/716640

 

Hi, 

I am using STM32U5A9 processor from built-in RiverDI 5 inch display. I was able to see the Fault Analyzer's BusFault address, but I could get anything from that address in the memory view. All the data was in ?????

When I debugged further, I saw like this in the debugger.

Disassembly hit in this command:

RiverDi_user_0-1725603149523.png

When I checked the registers r6 and r12, r12 seems to be an invalid memory location:

RiverDi_user_1-1725603211766.png

RiverDi_user_2-1725603305930.png

 

Regards

RiverDI user

Hello @RiverDi_user,

Could you please provide full screenshots on the call stack and the other errors? 
Are you using the Board Setup that is available in TouchGFX? Have you modified it if your using it?

Mohammad MORADI
ST Software Developer | TouchGFX

Output actionable data, in hex, so you can understand why it's complaining

Sanity check pointers you see failing, instrument so you can follow the issue back to the point of origin, or where it's first observable.

https://github.com/cturvey/RandomNinjaChef/blob/main/KeilHardFault.c

Ideally provide a means of seeing this in the end product so customer support can actually help locate issues rather than the product randomly lock-up with no means of diagnosis.

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