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: Overcoming spurious zero crossing events with ECAP module

Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE

I have configured ECAP module for measuring grid frequency. It is setup to capture count value between two rising edged of the square wave.  Initially it was tested with clean signal from function generator. In actual application we have used a comparator circuit that converts input grid Sine voltage to square wave output.  This square wave has many spurious transitions near the zero crossing points. Due to this issue the ECAP module is picking very high frequency edges near the zero crossings and thus giving us erroneous readings. Please refer to the following snapshot of zero crossing signal captured from oscilloscope:

Please let me know if there is a software based solution to overcome this issue.

  • Hi Asad,

    The GPIO has input qualification that you can utilize. However looking at the noise on your signal, that might not be enough. The F280025 device has an inbuilt comparator (CMPSS module) with more extensive filtering that should get rid of the noise you are seeing. If you haven't already finalized your design, you can forgo your external comparator and use the internal one.

    Another solution is to route your current comparator signal through our internal comparator (so you can use the internal filtering) and then to the ECAP. Let us know if you have more questions.

  • Hi Frank, 

    Thanks alot for proposing solutions. Our hardware boards are already manufactured so we would prefer going with the second option. Please give some details about this method. Should we be routing the x-bar input to the internal comparator and assigning the output of the comparator to the eCAP1?. Can you refer any relevant example in C2000Ware.

  • Hi Asad,

    If you want to use the internal comparator with the ECAP, the chain is Analog Input -> CMPSS -> ECAP. The input signal will have to come from an analog input pin and not a GPIO.

    I think the best solution for your situation here is hysteresis because any form of filtering will introduce latency in your signal while hysteresis will not. The internal comparator does have hysteresis. Does your external comparator have inbuilt hysteresis? Or is this something you can add to your board?

    Have you given the GPIO input qualification a try? Since the GPIO input qualification is software, I would recommend you at least check this first to see if it works. The input qualification is described in the GPIO chapter of the TRM.

  • Dear Frank,

        You reply has helped us in resolving the issue. We initially tries with input qualification but it did not work. Then we added hysteresis to our external comparator by adding a resistor between the output and reference input. This resolved the issue. Thank you very much for your excellent support.

  • Hi Asad,

    Glad to hear you resolved the issue. Let us know if you ran into any more problems.