We working on a motor control application. In this application motor control algorithms and parameters are run and calculated in an interrupt generated by CTU at every 100us as our PWM is configured to be 10KHz.
We've seen this interrupt to miss the timing of every 100us; in other words, it is delayed.
The below picture is the waveform generated using a GPIO set to high as program control enters the ISR and the same GPIO set to low as program control exists the ISR. The cursor B is where actual ISR should have been serviced but is instead serviced at the cursor A position accounting to delay of 50us.
I connected debugger and the stack to see where is this happening and I found an exception in IVOR4_Handler. I think this related to the problem explained above.
1. How do I know what is causing this exception?
2. I read through IVOR4 exception briefly in e200z4RM.pdf as suggested in another post and I found the following statement.
"An external input interrupt may be delayed by other higher priority exceptions or if MSR[EE] is cleared
when the exception occurs."
In my configuration, interrupt ADC_I_CTU_0 (#713), interrupt ERR_I_CTU_0 (#714) and interrupt MRS_I_CTU_0 (#700) are all configured with highest priority (Priority 11 and there exist no interrupt with higher priority).
Question is, are these all related? Does interrupt related to MRS_I_CTU_0 needs to have different priority given the statement above?
Any suggestion/solution is highly appreciated. Many thanks in advance.