Hello,
I am running the TMS320F28069 with the system clock 90Mhz. The clock source is from the external 20Mhz crystal.
I am trying to output the PWM signal with ECap module by setting it to the APWM mode. The following is part of the ECap initialization code:
ECap2Regs.ECCTL2.bit.APWMPOL = 1;
ECap2Regs.ECCTL2.bit.CAP_APWM = 1; // Put us in PWM mode
ECap2Regs.ECCTL2.bit.SYNCI_EN = 0;
ECap2Regs.ECCTL2.bit.SYNCO_SEL = 1; // CTP = PRD
ECap2Regs.ECCTL2.bit.STOP_WRAP = 0x01;
ECap2Regs.ECCTL1.bit.CAPLDEN = 1; // Enable CAP1-CAP4 register loads
ECap2Regs.ECCTL2.bit.CONT_ONESHT = 0;
I am trying to generate PWM signal with a period of: 40us/60us/80us/100us/200us/400us. I measured the period of the signal with the frequency counter. The ideal ppm error is 0, however I got a pretty large ppm error:
| Expected output period | 40us | 60us | 80us | 100us | 200us | 400us |
| ECap2Regs.CAP4 (on time) | 1738 | 2638 | 3538 | 4438 | 8938 | 17938 |
| ECap2Regs.CAP3 (period) | 3600 | 5400 | 7200 | 9000 | 18000 | 36000 |
| Expected ppm | 0 | 0 | 0 | 0 | 0 | 0 |
| Measured ppm result | -282.8 | -190.4 | -144.1 | -166.2 | -60.7 | -33 |
When I reduced the period by the value of 1, I got significant better ppm error:
| Expected output period | 40us | 60us | 80us | 100us | 200us | 400us |
| ECap2Regs.CAP4 (on time) | 1737.000000 | 2637.000000 | 3537.000000 | 4437.000000 | 8937.00000 | 17937.00000 |
| ECap2Regs.CAP3 (period) | 3599.000000 | 5399.000000 | 7199.000000 | 8999.000000 | 17999.00000 | 35999.00000 |
| Expected ppm | 277.770000 | 185.185000 | 138.888000 | 111.111000 | 55.55000 | 27.77000 |
| Measured ppm result | 2.000000 | -5.300000 | -5.300000 | 12.100000 | -5.30000 | -5.30000 |
So, where I can find the details regarding the precision of the APWM?
How to get the best precision?
How to calculate the worst case error of the PWM?
Thanks,
Andy

