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.

Speed of comparator in squaring up a 3.8MHz signal for a frequency counter

Other Parts Discussed in Thread: MSP430G2553

I want to use the comparator (of an MSP430G2553) to square-up a 200mV signal at up to 3.8MHz in a frequency-locked loop oscillator. This would require toggling at close to the maximum speed to drive the counter). Before I try it, any thoughts on whether it would work? Otherwise I'll need an external Schmitt trigger to square up the waveform.

  • I don't exactly understand what you want to do, but using the comparator requires CPU interaction. And a 4MHz signal means that you have 4 CPU clock cycles per wave to handle the event. Which is by far not enough to do anything.

    Well, you could use the comparator to get a square wave output, then re-route this output into a timer for counting. And do your FLL work with a capture result from a reference, at a much lower frequency. This could work. The comparator response time is 120ns. Which could be enough for your 3.8MHz signal.

    A problem could be the reference for the comparator. The internal reference nodes are much too high for your use. You'll need ~0.1V for your 0.2V signal. So you'll need an external reference for comparison.

  • I have a differential signal of 0.2V P-P which I can feed into the comparator + and - inputs (capacitively coupled so it can be DC adjusted wherever suits), which should square it up. I thought it was possible to feed that in to the counter register of TimerA, as you describe, and set an interrupt when the counter passes zero, when I can look at my wall-clock and compute the frequency. No CPU interaction should be necessary for the counter to count. Am I wrong in thinking that the comparator output can be used that way?

  • Clifford Heath said:
    I have a differential signal of 0.2V P-P which I can feed into the comparator + and - inputs (capacitively coupled so it can be DC adjusted wherever suits)

    Just don't float inputs. You need to "center" both inputs between VCC and GND using resistors.

    Clifford Heath said:
    No CPU interaction should be necessary for the counter to count. Am I wrong in thinking that the comparator output can be used that way?

    Yes, everything sounds good. - If you follow advice of JMG to feed comparator output into timer INCLK as external clock. Then you just CCR- capture timer using reference clock and you got frequency counter :)

  • Ilmars said:

    I have a differential signal of 0.2V P-P which I can feed into the comparator + and - inputs (capacitively coupled so it can be DC adjusted wherever suits)

    Just don't float inputs. You need to "center" both inputs between VCC and GND using resistors.

    [/quote]

    Exactly - as I said, "so it can be DC adjusted", as in the attached fragment (the phase splitter is also running on 3.2v).

    I was already confident that the counter is fast enough - but wasn't sure from the data sheet that the comparator would be. With your re-assurance, I'll try it and see,

**Attention** This is a public forum