This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
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.
Chandana,
This is a very interesting effect.
What happens in you try to toggle your GPIO every 50us using the TBCTR= 0 event? Does the delay cut in half, does it remain the same?
Just thinking through the problem, I think this could come from some sort of interrupt preempting or it could be caused by a weird effect inside of the PWM module. I think the first one is more likely. What other code are you running? Do you have other interrupts enabled? Sure there are not higher priority interrupts, but a low priority interrupt could be finishing up around your TBCLK = PRD ISR and is keeping the PWM ISR from starting because interrupts are not nested by default.
Regards,
Cody
I try running the ISR at 50us and 200us, for 50us the delay occurs at every 20th pulse and for 200us it occurs at every 5th pulse( every 1ms )
I am using DSP/BIOS 5.1 and I have disabled all other interrupts.
If I trigger PWM Interrupt at TBCTR = COMPB, and as I slowly increase the value of COMPB the delay disappears.
What is the length of the delay at each ISR frequency?Chandana B V said:I try running the ISR at 50us and 200us, for 50us the delay occurs at every 20th pulse and for 200us it occurs at every 5th pulse( every 1ms )
What CMPB value does the delay completely disappear? As you increase CMPB what is the rate of decay of the delay? (is it linear, logarithmic, or something else ?)Chandana B V said:If I trigger PWM Interrupt at TBCTR = COMPB, and as I slowly increase the value of COMPB the delay disappears.
Regards,
Cody
Cody Watkins said:What is the length of the delay at each ISR frequency?
- 50us delay =?
- 100us delay =?
- 200us delay = ?
- 50us delay = ~7us
- 100us delay = 20us
- 200us delay = ~8us
What CMPB value does the delay completely disappear? As you increase CMPB what is the rate of decay of the delay? (is it linear, logarithmic, or something else ?)The delay progression is not consistent, I used COMPB = 105(which is 1.4us) to get the ISR at exactly 100us.
below is the delay for different COMPB values.
- COMPB = 105, delay = 0
- COMPB = 10 t0 40, delay = 20us
- COMPB = 50 t0 90, delay = 7us
- COMPB = 90 to 101, delay = ~1us
OK, thanks for the information.
Can you strip down your project to be as simple as possible and show the issue? Can you then send me the simplified code to test on my side?
Thanks,
Cody
Hi Cody,
Sorry for the delayed response. Attached is the sample of my project.
Chandana,
I do not have hardware to test this immediately on hand. I will take me a few days to get back to you, I will respond by Nov. 5th.
Regards,
Cody
Chandana,
I was able to look through the code, but I do not see where you are toggling a GPIO in the ISR. Where is that?
I see a GPIO that could toggle in the WatchDog, but nowhere else.
Regards,
Cody
Hi Cody,
Thanks for the reply.test_adc.7z
I am toggling GPIO in Control_ISR and adc_ISR in adc.cpp file.
I've updated the code with the changes.