Just as a side question, do you always do diagnostic output via printf() even in your ISR? You shouldn’t.
EDIT: Why not? That’s been answered about a bazillion times before, but just for completeness’s sake:
-
Owing to the Heisenberg effect, you should generally not use printf anywhere if you need to analyse real time behavior (in terms of stack usage and additional cycles, it significantly changes the runtime behavior of your application). In your case, the interrupt stack may overflow and/or the timing (which by definition is crucial in ISRs) will be severely affected.
-
Unless you have full control over the full control flow of your printf() routine, you risk that it does things down the call chain that are not allowed in ISRs such as attempting to claim muteces.