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.

ECAP FREQUENCY MEASUREMENT -TMS320F28379D

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi,

   Using Ecap pin measuring frequency  ,  PWM signal generated in GPIO 0 (PWM pin) for various frequency (1k to 50Khz) by using Ecap pin i can find out accurate frequency which i have generated in PWM pin.

Same function going with function generator ,generating square wave with  various frequency (1kz,10 khz,100khz) I couldn't get the correct frequency by ECAP pin .

My ECAP Configuration are :

        ECap1Regs.ECEINT.all = 0x0000;         /* Disable all capture interrupts */      \
        ECap1Regs.ECCTL1.bit.PRESCALE=1;                                                 \
        ECap1Regs.ECCTL1.bit.FREE_SOFT=2;                                                \
        ECap1Regs.ECCLR.all = 0xFFFF;         /*  Clear all CAP interrupt flags*/        \
        ECap1Regs.ECCTL1.bit.CAPLDEN = 0;     /* Disable CAP1-CAP4 register loads*/      \
        ECap1Regs.ECCTL2.bit.TSCTRSTOP = 0;   /*Make sure the counter is stopped*/       \
        ECap1Regs.ECCTL2.bit.CONT_ONESHT = 0;  /* continous*/                            \
        ECap1Regs.ECCTL1.bit.CAP1POL = 1;      /* Falling edge*/                         \
        ECap1Regs.ECCTL1.bit.CTRRST1 = 1;      /* Difference operation*/                 \
        ECap1Regs.ECCTL2.bit.SYNCI_EN = 0;     /* disable sync in*/                      \
        ECap1Regs.ECCTL2.bit.SYNCO_SEL = 3;  /* Pass through*/                           \
        ECap1Regs.ECCTL1.bit.CAPLDEN = 1;     /* Enable capture units*/                  \
        ECap1Regs.ECEINT.bit.CEVT1=1;                                                    \
        ECap1Regs.ECCTL2.bit.TSCTRSTOP = 1;   /* Start Counter*/                         \
        ECap1Regs.ECCTL1.bit.CAPLDEN = 1;      /* Enable CAP1-CAP4 register loads*/      \
        ECap1Regs.ECCTL2.bit.STOP_WRAP=0;

       freq=((200000000)/ECap1Regs.CAP1)

     ECap1Regs.ECCLR.bit.CEVT1=1;

     ECap1Regs.ECCLR.bit.INT = 1;
     PieCtrlRegs.PIEACK.all = PIEACK_GROUP4;

Is there any configuration missing to get accurate value ?

we can measure accurate value for external  pulse signal by Ecap pin?

Thanks in advance

Thanks & Regards,

Rani

  • Rani,

    C2000ware SDK provides an example which uses Input X-Bar. Please refer to the example, and let me know if you have any question.

    C:/ti/c2000/C2000Ware_3_03_00_00/device_support/f2837xd/examples/cpu1/ecap_capture_pwm_xbar