2024-09-04 10:18 PM
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.
Your support is much appreciated!
Thanks & Regards
RiverDI user
2024-09-05 01:24 AM
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.
2024-09-05 03:09 AM
@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
2024-09-05 03:23 AM - edited 2024-09-05 11:15 PM
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:
When I checked the registers r6 and r12, r12 seems to be an invalid memory location:
Regards
RiverDI user
2024-10-16 06:33 AM
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?
2024-10-16 07:18 AM
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.