cancel
Showing results for 
Search instead for 
Did you mean: 

Hard fault handler.

utamb
Associate II

I am facing hard fault handler isssue.

I was wondering if someone will help me to resolve it.

I am unable to find the cause.

I am using STM32F4 series controller and while free run it is going to hard fault handler.

I checked the corresponding register and I found Precise data access error in bus fault status register.

How to resolve this error I don't know please help.

2 REPLIES 2
turboscrew
Senior III

First, check the LR. It should contain "exception return code". It should be mostly 'FF's, like 0xFFFFFFFD.

The last digit tells the return stack and return mode. If the last digit is 1, it pulls the return stack frame from main stack and returns to handler mode.

If the last digit is 9, it pulls the return stack frame from main stack and returns to thread mode, and if D means process stack and thread mode.

Next, find the return address from the return stack: SP + 0x18.

Maybe that helps? It's probably busfault escalated into hard fault because bus faults are not enabled. That happens often, if you access address that is in the "reserved" area. You can check the BFAR register for that.

>>How to resolve this error I don't know please help.

Look at the faulting instruction(s) and the processor registers. Determine what memory you're touching that is causing it, and what your code at the failure point is doing.

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