Diagnosing a Fault ISR

There are times that you may upload a code into your launchpad and the launchpad just suddenly stops running after some time or almost instantly. If you are with the board still connected to the PC in debug mode and you pause the code you see that it's stuck in a infinite loop inside the function "FaultISR".

Now this is a interrupt that is generated when a Fault occurs. This faults are fatal and if the code is left running, it can cause an unpredictable behavior so a Fault interrupt is generated, entering the FaultISR and looping forever. This stops the code and allows to stop any code from running for examination.

For very good info there is a very good document from TI Diagnosing Software Faults in Stellaris® Microcontrollers. It is for Tiva predecessor, the Stellaris, but it's mostly if not everything, applicable.

So first, you have to find out if your code is in a FaultISR, some of you may not know how.

Very simple, when you debug your code you press play to run the code, like any other code. Now when you think the code is stuck (or actually see some behavior that shows that) you press pause, there you can see which line of code the program is on. It can be already inside a while(1) in FaultISR, if not, press play again and repeat the process until you find out where the code is stuck - the use of breakpoints will help you with that. If the reality is that the code is stuck somewhere else then you have a problem other than a Fault.