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.

TM4C1294NCPDT analog comparator interrupt issue

Hi Amit Ashara

Good afternoon.

I finally could start properly the analog comparator. The problem was in the internal reference. Using proper value, the C2O output began to show the square wave as expected.


But, a new issue appeared. There is a burst of pulses in the both edge of the square wave of C2O output:

The result is that multiples interrupts are occurring at rise and fall edges of square waves.

You said in previous e-mail  that internal comparator could have lack of histeresis, is that correct?

Those bursts could be lack of histeresis in internal comparator?

Thanks,

Sergio

  • Hello Sergio,

    Yes, that is what it seems. If you change the threshold of comparison, then the position of the burst will change and that will confirm the issue.

    A digital filter would be required that can be done with a timer and the existing C2O pin. Based on the worst case slope of the signal and frequency of edge triggers, create an interrupt on the rising edge or falling edge of the signal. When the interrupt is asserted, start a timer in one shot mode to sample the signal after the time it becomes stable (in worst case). Then sample the signal N times with shorter timer burst. If the signal retains the value N/N times the signal can then be output on another GPIO by writing a 1 or 0.

    Regards
    Amit
  • Hi Amit

    So, cb1 was right. It is better to use external comparator indeed.

    Anyway, we had to try.

    Thank you.

    Sergio
  • Just for the records.

    60Hz zero-crossing using internal analog comparator is a FAILURE.

    Sergio
  • Hello Sergio

    Yes, using an external comparator with hysteresis would always give you guard band.

    Regards
    Amit
  • Sergio Kamakura said:
    So, (   ) was right. It is better to use external comparator indeed. 

    I don't believe there's a, "Right or Wrong" - just that the external device (analog comparator) proves far more flexible - enables any "snap-hysteresis" action/level you desire - AND can achieve the (required) voltage level shift you earlier specified.    And is so much faster & easier to implement.

    And - requires ZERO "new learning" - meaning when you switch MCUs (via vendor here or other's "break-thru") you may avoid (yet another) bout with the "internal - yet very complex - AND limited" MCU implementation...