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.

TMS320F28069: ECap module APWM mode precision

Part Number: TMS320F28069


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

  • Hi Andy,

    Are you using a launchpad or controlCARD? The SYSCLK should be the one affecting the precision of the APWM for example if SYSCLK is 200Mhz, resolution to eCAP will be 5ns. I am not sure why reducing the period down to a value of 1 will help improve ppm error. 

    Do you know the PPM of the external clock? Can you try and verify this with the XTAL on the launchpad or controlCARD?

    Best,

    Ryan Ma 

  • Hello Ryan,

    We are measuring the ppm on our product instead of on the development board launchpad or controlCARD. The measured ppm of the 20Mhz external crystal we are using is 31.5. 

    Andy

  • Hi Andy, 

    Assuming your SYSCLK is 90Mhz, and your ppm is 31.5 the period reduction of 1 is the correct period value to use for CAP1. Here are the calculations for it 

    This is using the equation from the TRM:

    Hope this helps!

    Best,

    Ma