I am using EPWM1 module to trigger interrupt at valley(TBCTR = 0) for Every 100us.
My EPWM Period is 10KHz and PWM Base Clock is 150 MHz, I am using triangle PWM(UPDOWN Count mode)
In this case I am toggling the GPIO inside the ISR routine, Every 10th pulse(Every 1ms ) I am getting a 20us delay in the ISR trigger.
I made sure that I am not running any other higher priority interrupt at every 1ms (10th pulse ).
This issue is there only when I trigger the Interrupt @TBCTR = 0, When I trigger the Interrupt at peak ie TBCTR = PRD , I don't see any delay in the ISR trigger, ISR gets executed every 100us properly.
I tried different PWM module other than EPWM1, the issue still persists when I trigger ISR at TBCTR= 0.
When I trigger the Interrupt at TBCTR = some count (count for 1us, count for 2us ) the drift time on every 10th pulse reduces. As I move the ISR trigger far away from TBCTR = 0, the drift eventually disappers.