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.

TMS320F280025C: ECap

Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG

Hi I want to use ecap module in mcu for speed measurement of my motor. I want to find time between rising and falling edge of hall signal for that. So how can I do that using ecap module? I saw example in C2000ware but couldn't understand it properly.

Also I don't understand how to configure any gpio we want to use in ecap module. Can you please help me regarding this.

  • Hi,

    We do have an C2000Ware example which configures an ECAP to measure the time difference between rising and falling edge of an EPWM. For your application, you can pick that code as a base point, remove the EPWM configuration, connect the ECAP pins to read data from the hall signals. 

    Example location: <C2000Ware_XX/driverlib/f28002x/examples/ecap/> -- ecap_ex2_capture_pwm

    Aditya

  • I have seen that example but in that function GPIO16 is configured as Capture input.

    I want to use another GPIO like GPIO24. I tried to get capture on this pin by setting INPUT_XBAR1 and pin set as 24 but my code is not going into ISR of this example. Please suggest me a solution to get capture on pin other than given into example(like GPIO24).

    Regards.

  • Can anyone help me regarding this?

  • Hi,

    Are you using Sysconfig based code? In sysconfig GUI, you simply need to update the GPIO16 selection under INPUTXBAR tab to GPIO24.

    If you have written the code, you can update the code as 

        XBAR_setInputPin(INPUTXBAR_BASE, XBAR_INPUT7, 24);
    Thanks,
    Aditya
  • Hi Aditya,

    Thanks for the response. 

    As per your suggestions my code is working now!!

    but my confusion is,

    1)  As per the datasheet GPIO16 is  OUPUT Xbar7 and GPIO24 is OUPUTXbar1 then why it doesn't work with this function? [ see below]   

    XBAR_setInputPin(INPUTXBAR_BASE, XBAR_INPUT1, 24) 

    2)Can we use any XBAR_INPUT to any GPIO?

    Best regards,

    Shivam

  • Shivam,

    The XBAR that you mentioned about is the OUTPUT XBAR which is used to take the input from the MCU to the GPIO pins OUTSIDE. For INPUT XBAR, please find the snippet from the TRM below:

    The Input X-BAR has access to every GPIO and can route each signal to any (or multiple) of the IP blocks previously mentioned.

    Hope this helps.

    Thanks,

    Aditya