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.

TMS320F28379D: TMS320F28379 APWM on eECAP questions

Part Number: TMS320F28379D

Hi champs,

customer wants to configure eCAP unit 1 as APWM.

His board runs at 10MHz, internal 200 MHz, PWM is routed to GPIO28 via C-Bar.

It seems to run as expected, but PWM frequency is slightly different to what is expected,

Period is calculated PRD = PeripheralClock / Frequenz

1)      aimed frequeny: 131,25 kHz

200000000 / 131250 = 1523,80952… 

We set period value to 1523, which calculated backwards gives frequency :  200000000/1523 = 131,319 kHz  

Measured with Osci on pin 131,246 kHz

 

2)      Setting period to 1524, calced backwards frequency 200000000/1524 = 131,233 kHz  

Measured on Oszi on Pin 131,160 kHz

 

3)      Setting period to 1525, calced backward freq: 200000000/1525 = 131,147 kHz  

Measured at Pin 131,074 kHz

So we see a systematic deviation between measuremnt and calced value of 73 Hz!

Q: is this a systematic, understanding or tolerance related error ?

Because customer is using an scope to measure frequency, which is probably not exact enough, I asked him to use a frequency counter instead to validate his observings.

Any explanation ?

  • Hi DJ,

    Can you have the customer verify their system frequency using XCLKOUT? If the 10 MHz input to the PLL is not exactly 10.0 MHz this may introduce some error into the calculation. The customer should be able to view the 10 MHz directly if they setup XCLKOUT and check the frequency before enabling the PLL.

    After we have verified that we can further investigate the APWM.

    Regards,
    Kris

  • DJ,

    I think the equation you are using needs a small tweak. Try doing the calculation as FREQ/(PRD + 1). That gets much better correlation with your results (a difference of 13 Hz).  The +1 is because the counter starts at 0 and resets the cycle after CTR=PRD.

    This is what we document as the calculation for the EPWM in up-count mode only which is effectively what you're doing with the CAP. I've requested to add this into the CAP chapter. You can have the customer reference Figure 14-6. Time-Base Frequency and Period in the F28379D TRM for the EPWM calculation.

    Let's still check the system frequency though as I believe that will account for the rest of the deviation.  Multiplying your numbers back out 131,074 * 1525 = 199.887 MHz.  If we divide that by 20 to get your 10 MHz true frequency it comes out to 9.994 MHz.  So depending on the oscillator the tolerance could very well be introducing the 13 Hz deviation.


    Regards,
    Kris

  • Kris,
    There were 2 reason for inaccuracy:
    - Basic oszillator was no 100% correct
    -you are right, your formula is correct PRD = (PeripheralClock / Frequenz) - 1!
    Now world is perfect again!
  • Great! Glad we could help.

    Kris