This is a question regarding interrupt handling and priorities where it seems I misunderstood something.
Currently I'm using DMTimer2 to create an interrupt every 0,5 usec. Within its ISR I toggle a GPIO output to check interrupt frequency with an oscilloscope. This works fine, I get a clear rectangular waveform.
Now when I initialise USB-stack (which uses an interrupt too), the output waveform is not as clear as before, there are some glitches in it, it seems like the DMTimer-interrupt comes a bit too late sometimes.
My DMTimer2-interrupt uses a priority of 0 (which should be the highest priority) while the USB-interrupt comes with a priority of 120, which should be a very low value.
So my current understanding was this:
- the low-priority USB-interrupt can't override the DMTimer2-interrupt, means when the DMTimer-ISR is processed, USB can't come in between
- when the CPU is in USB-ISR and a DMTimer-interrupt happens, the USB-ISR itself is interrupted and the DMTimer-ISR is executed
But this understanding seems to be wrong, elsewhere my DMTimer2-interrupt could not be disturbed by USB-IRQs. So what is the real behaviour when using interrupts with different priorities?
Thanks!