Posted on February 22, 2018 at 14:22The original post was too long to process during our migration. Please click on the attachment to read the original post.
There's usually a reason, it is a gross fault. Look at the CODE that is faulting, not the handler. If you have console output consider implementing a Hard Fault Handler does more than a while() loop.
Consider if the stack is too small for your auto/local variables, or you run out of heap and don't check if malloc() returns NULL pointers. Look for wayward pointers accessing out of range memory.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Thanks for your answer Cleve. But, as you can see in the code, there are no variables defined, not even one! I don't think that is about stackoverflow. The code is so simple that I can't think of anything other than a bug causing this. Are there any possible reason for Hard Fault you know?
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
There is always a reason - you just don't know it yet. Step through the code and see when it gets to the fault handler. Usually a peripheral isn't enabled.