2021-12-02 12:07 PM
I am working with stm32H743 MCU, sometimes when I add a function, its calling caused a hard fault, when I move the function to another place in the code, the fault is resolved.
What can be the reason?
2021-12-02 02:03 PM
The location of the function is not likely to be a direct cause of the hardfault, but if there are bugs in the code, it may alter how/when these bugs show up.
Stay objective. Don't focus on the location of the function. Instead, determine the cause of the hard fault by looking at SCB registers or using the fault analyzer in STM32CubeIDE. Memory issues are a common cause of hard fault. Dynamic allocation failing, or writes out of bounds, or stack overflows.
2021-12-02 11:41 PM
Thanks for your response
2021-12-02 11:46 PM
Thanks for your response. Well, it's clear to me that I can research this and find the cause by using the debugger, Im using KEIL environment with ST-LINK debugger and there is also a KEIL document here https://www.keil.com/appnotes/files/apnt209.pdf that shows what to look for and how to deal with hard-fault issue, I just wanted to save time, maybe someone has already encountered this and can save me The investigation, I'm sure it's something simple ... ;)