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.
Condition
Problem
Observation
Is there anything that I can try to resolve this issue?
To be precise, PWM3A and PWM2A are out of sync in the range of +/-80ns. Sysclk frequency is 100MHz, so it seems that out of sync happens between 0 to 8 sysclk cycles.
Hi Justin,
Have you tried to map when the CLA task starts and ends? Are you using any shadow loading or are you using immediate mode?
Moving the exactly same code to run on the CPU1
Does this mean you update the epwm configuration values within the ADC ISR or within an EPWM ISR?
Best Regards,
Marlyn
Hi Marlyn,
I am using shadow loading. I only have ADC ISR which also triggers CLA at the end of the loop. However, yes, the epwm configuration values are updated in the ADC ISR.
Have you tried to map when the CLA task starts and ends?
What do you mean by that?
Thanks,
Justin
Justin,
The period, compare, and phase registers should be updated at a known good point in the switching cycle. One suggestion is to write the new PWM register values to dummy variables first, within the CLA task. Once new register values are calculated and written to dummy variables, the PWM ISR should be enabled. The PWM ISR will then trigger at a known good point in the cycle. PWM ISR can be disabled from within the ISR at the end of its code.
What I had meant by map the CLA task was to possibly toggle a gpio at the beginning and end of the task and see how that lines up with your epwm output.
Best Regards,
Marlyn
This thread was resolved offline. Below is the resolution:
The root cause for the observed jitter was the distribution of updates to EPWM2A and EPWM3A across different PWM cycles in some cases resulting in to the misalignment of the edges. As the execution time of ADC ISR surpasses the boundary point (TBCTR = 0) so there is a possibility that write to EPWM2A happens before the boundary while writes to EPWM3A happens after the boundary. In that case, the new shadow value will loaded to the active register for EPWM2A at TBCTR=0 while EPWM3A will still contain the older value resulting into the inconsistency between the two.
To avoid this issue, the key idea is that writes for both EPWM2A and EPWM3A need to be scheduled in the same PWM cycle. This could be done by triggering the ADC ISR early (if that’s allowed by the system) so that it finishes the execution before the boundary. Or the other way could be by offloading some part of the code to CLA for faster execution or by reshuffling the sequence of routines inside the ISR.
Best Regards,
Marlyn