2016-02-10 04:21 AM
Hi,
I am using STM32F439 Eval board. I am trying to understand Micro. supported exceptions. I want to know, Is there anyway to come back to normal operation once we get any exception.lets assume i am doing division operation and divisor happen to be ''ZERO''. so in this case, i would get usage fault exception and corresponding handler will get invoked.now in Handler i am clearingDIVBYZERO bit(by writing 1).
So as per my understanding,i cleared the flag now i am suppose to go back to my normal routine(lets say main()). but it is not happening, it is coming back usage fault handler.
so now i have following questions1. how to come out of exception? are there any other bits i am suppose to clear?2. or once any exception comes, i cant go back to normal routine. only sw reset or POR will help me.Thanks in advance... #hardfault #stm32 #stm32f #fault-exception #m42016-02-10 06:02 AM
What do you expect it to do when you return? Crash and fail somewhere else?
You can presumably dig into the stack, examine the faulting instruction, fix registers, advance the PC, pop up a level, or implement some throw/catch structured exception handler. All would require a significant appreciation of the problem, and the processor.In the division by zero case, you really need to just fix your code so it identifies these issues before they fail, and you provide a valid exit strategy there to deal with it. In that sense it is better for the handler to output diagnostic info, and have you fix the bugs before releasing the code.