2014-06-22 08:47 AM
Hi everybody
I am trying to get a control system with a PD controller and a Kalman filter up and running on my STM32F429 discovery board.The Kalman filter receives data gathered by two sensors and calculates an estimate, this estimate is then used by the PD controller to calculate the necessary actions for the reaction wheels.I tested every part of my code separately and everything works fine. However when I want to run the complete system the discovery board jumps in the HardFault handler as soon as it enter the Kalman filter function.I do need a lot of global and temporary variables to get all of the calculations completed but I did check the Kalman Code on a separate program on my pc and it works just fine.Any ideas how I could find the error causing the Harfault Handler to appear? The compiler does not displays any errors and running the complete code without the Kalman function call does work. I am using Keil uVision5 and my experience with programming is quite low.Any help would be appreciated!Greetings Ben G. #discovery #stm32 #fault-handler #stm32f42014-06-22 12:23 PM
Get yourself a Joseph Yiu type Hard Fault handler, dump out the core and processor registers at the fault, and look at the assembler view code that is faulting.
Determine what memory is being accessed, why that might be out-of-range, and if stack related if that is a result of exceeding it's size, or from corruption elsewhere. For Keil the stack is typically very small, and allocated in startup_stm32f4xx.s (or whatever) Compliers can only tell you about syntax errors, not errors in your logic or over use of memory.