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.

TMS320F28335: Phase differences between two signals

Genius 9880 points
Part Number: TMS320F28335

Hi Team,

My customer is trying to use two ECAP modules for capturing two signals and they were able to capture signals. Now, they want to findthe phase difference between the two signals. Is the ECAP using the same counter for each? Is it possible? If yest, they want to want to know how to do it.

Thank you.

Regards,
May

  • Is the ECAP using the same counter for each?

    No, but they use the same system clock input so using two ECAPs with the same counter configuration will count in step.

    how to do it

    After synchronizing two or more ECAPs via the SYNCIN signal, the difference between the capture value of the ECAPs will be proportional to the phase difference.

  • Hi Team,

    Customer configured the synchronous selection registers for both ECAP are as follows.
    But still they were not able to find the correct phase difference.

    ECap1Regs.ECCTL2.bit.SYNCO_SEL = 1;
    ECap1Regs.ECCTL2.bit.SYNCI_EN = 0;
    ECap1Regs.ECCTL2.bit.SWSYNC = 1;

    ECap2Regs.ECCTL2.bit.SYNCO_SEL = 2;
    ECap2Regs.ECCTL2.bit.SYNCI_EN = 1;

    Thank you.

    Regards,
    May

  • Can you share full configuration of eCAP1 and eCAP2?

  • Hi Santosh,

    Please see code below.

    code(1).txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    //###########################################################################
    //
    // FILE: Example_2833xEPwmUpAQ.c
    //
    // TITLE: ePWM Action Qualifier Module using Upcount mode Example
    //
    //! \addtogroup f2833x_example_list
    //! <h1>ePWM Action Qualifier Module using Upcount mode (epwm_up_aq)</h1>
    //!
    //! This example configures ePWM1, ePWM2, ePWM3 to produce a waveform with
    //! independent modulation on EPWMxA and EPWMxB. The compare values CMPA
    //! and CMPB are modified within the ePWM's ISR. The TB counter is in upmode.
    //!
    //! Monitor the ePWM1 - ePWM3 pins on an oscilloscope.
    //!
    //! \b External \b Connections \n
    //! - EPWM1A is on GPIO0
    //! - EPWM1B is on GPIO1
    //! - EPWM2A is on GPIO2
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Thank you.

    Regards,
    May

  • May,

    I am trying to run it on my setup. I will get back to you Monday/Tuesday.

    Thanks & Regards,

    Santosh

  • Hi Santosh,

    Thank you, we are looking forward for your feedback on this.

    Regards,
    May

  • May,

    You can use timer and two eCAP module to capture the phase difference. Start timer to eCAP1 ISR, and then stop timer at eCAP2 capture. The timer count can be used as phase difference.

    Regards,

    Santosh