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.

LAUNCHXL-F28379D: How to detect high frequency zero crossing detection, using CMPSS module?

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE, LM311

Hi,

I'm trying to detect the zero crossing of two different 80kHz square waves using the F28379D. Once I read the zero crossing, I will make some decisions (set a GPIO and reset another).

I tried to use the ADC module, but it is too slow, and it causes too much delay. But I was told here in this forum that I could use the CMPSS module, but I can't find any exemples that I could use as a reference.

My question is: how fast the CMPSS module can be? Can I use the ADC ports to use this module?

Does anyone has a similar exemple or know where I can find one?

Thanks!

  • Sorry about the title.
    "How to detect high frequency zero crossing, using CMPSS module?"- It's the right title.
  • Hi Leonardo,

    Yes, the CMPSS will be perfect for this. It has a typical response time of 30ns (33MHz), provided you use the async output so a 80KHz signal shouldn't pose an issue. However, the CMPSS doesn't have any post-processing block and can only tell you whether or not a signal crossed a level. However, in your case, it looks like the post-processing you are looking for is just a set or clear of GPIO? If that's the case, you might be able to just you the trip output of the CMPSS directly. You can also invert it if the direction is not what you want. We have CMPSS examples in C2000Ware. Please take a look at them and let us know if you have any questions. And yes, the ADC and CMPSS features on a pin can be used simultaneously.
  • I don't know if I'm searching wrong, but I can't find any examples at the C2000Ware for zero crossing, at least not for F28379D.

    I'm looking at the example of the resource explorer (CSS). Is the cmpss_asynch_cpu01.c the best example for this application? I can't find where to choose what port will be used to read the signal. Where do I choose? I want to read two signals: one at ADC A2 and the other at ADC B2.

    Thanks!
  • Leonardo,

    Both CMPSS examples in C2000Ware (cmpss_asynch, cmpss_digital_filter) would work as a starting point for this. We don't have a zero-crossing specific example but it's equivalent to finding when a signal crosses some point so both examples should suffice. Keep in mind that our device is a single supply device so if your input signal to the CMPSS is changing from neg-to-pos voltage, you would need to shift it to gnd and pos. Please read through the "Analog Subsystem" chapter in the TRM for a better understanding of which pins go to which modules. ADCA2 goes to CMPSS1 Positive Input and ADCB2 goes to CMPSS3 Positive Input.
  • Thanks for the fast response!

    I'm already using a LM311 to change the "positive and negative" signal to a "high and low" signal. The high state (positive) is 2.5V, and the low state (negative) is 400mV. I could even detect any voltage between 0.4V and 2.5V, because, it's the equivalent of the zero crossing of the sinusoidal signal that I'm reading.

    I will look the examples and try to figure it out how to detect the zero crossing.

    The CMPSS can trigger a PWM, is that correct? I could use this PWM signal to make decisions of my project. I need to block a switch at the exact moment that the current on it is zero. I'm using a current sensor and a LM311 to detect the polarity of the current.

    Thanks!
  • Ok, that's good. If the signal is already all positive, then the rest should be fairly straightforward. Yes, the CMPSS can trip the EPWM. The "cmpss_asynch" example in C2000Ware actually also does that too.