Announcement

Collapse
No announcement yet.

Square wave frequency - frequency of the "leading edge"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Square wave frequency - frequency of the "leading edge"

    Dear colleagues,

    I am trying to figure out what really determines the frequency of the signal that you can observe in the spectrum analyzer, for example. For the sine wave, it is obvious and clear.
    Let's say that we have a perfect sine wave of a frequency f (50Ohm output) feeding the 50Ohm impedance transmission line terminated with 50Ohm load. In the spectrum analyzer, we would see only one harmonic of the f frequency, and that is clear.
    For the case of the square wave, in reality, there is no clean square or edge, we have rounded corners. Depending on the signal output strength, transmission line impedance, load (and other properties), that corner shape (and rise/fall time) will wary, this is how I see it.

    One example from my side is that I had one device on the certification testing, we were good in the radio emissions testing for all signals, except in one (STAT_GPIO from the MCU). During the testing, we had only one low-to-high transition on that GPIO, and as soon as the transition happens, the signal analyzer reports harmonic at 320MHz (and some other higher harmonics). That signal was not repetitive, surely not at 320MHz frequency because there was only one signal transition. My foolish guess was that for those GPIOs we don't really need LP filtering since they are not repetitive and happens once per hour for example (I was so wrong). Our fix was instead of making that pin an output, we configured it as an input and activating either pull up or pull down, whether we need HIGH or LOW. That worked because it was a weak pull, and the strength of that action was much lower now.

    One more way to make it more clear to me, but not fully is the following example. Let's say that we have a sine wave of the f frequency like on the image:

    Spectrum analyzer would see an f frequency, pretty clear. One note, I see ^ leading and trailing edges even though is the sine wave.
    Now take a look at the next image:


    The leading and trailing edges are exactly the same as on the previous image, but "stretched", and the spectrum analyzer would see the same f frequency. My assumption is, that is what makes the "frequency" parameter of the signal, or am I wrong?

    So, what determines the signal frequency? Because once I know it, I know how to filter it.

    Thank you in advance!
    Best regards!

  • #2
    I have seen number of good videos on this topic e.g. https://youtu.be/eC36AqL5mw8

    Comment


    • #3
      Thank you, this is really helpful since it's a theory through the experiment. One good addition to the video is the effect of the rise/fall times of that square wave and seeing that the harmonics amplitudes are changing.
      It is clear how we can synthesize the square wave out of the sine waves, but I need to analyze the square wave and determine the harmonics.

      From the video, at the end, the author puts an ideal 1 MHz square wave and the first harmonic is of course 1 MHz. But for example, if we instead put a 1 KHz square wave with a 10% duty, where the rise and fall times are exactly the same as the one from the 1 MHz, we should then expect the same harmonics because the leading and trailing edges are the ones that determines the frequency, not the steady states. I think that one experiment from my side will emerge soon

      Thanks

      Comment


      • #4
        Eric Bogatin has made a couple of video's - like this one https://go.teledynelecroy.com/l/48392/2020-10-06/8267m6
        The 'frequency' of the signal is determined by the rise/fall time (10->90%). You could use the IBIS model for this too.
        Sometimes the MCU also has the ability to change the output drive capacity or speed. Set it to the lowest your application is ok with.

        Comment


        • #5
          You are right, Eric Bogatin has made really good videos, I watched that webinar that you have shared, thanks.
          I have also found several articles that are claiming that the frequency is determined by the rise/fall time and I still want to do some experiments, but I am still researching.
          Also, Alan Wolke (w2aew) has a lot of extremely good videos for the signal integrity and many other topics.

          https://design.iconnect007.media/ind...see%20Note%201).

          https://incompliancemag.com/article/...clock-signals/

          Comment


          • #6
            Ok, so I have done some testing on my side, results are partially expected and they are attached and presented in the following.

            Equipment used is the PC (Rigol Ultra Station software), Signal Generator Rigol DG1022Z, Oscilloscope Rigol DS1054Z, and Spectrum Analyzer Rigol RSA3015E-TG. In addition to that, I was using the coax cable RG-58, BNC T-Connector, and the 50 Ohm termination.

            I have used three waveforms: sinewave, squarewave, and "modified" sinewave. First, the connection was from SG to OSC, then SG to SA, so we can see the signal's shape and other parameters.

            The first downloaded to SG was a 3MHz sinewave, which was then observed on the SA, and as you can see, only the first harmonic is visible.
            Click image for larger version  Name:	sine.png Views:	7 Size:	129.5 KB ID:	17742 Click image for larger version  Name:	screen2.png Views:	6 Size:	76.7 KB ID:	17746 Click image for larger version  Name:	screen1.png Views:	6 Size:	77.5 KB ID:	17743

            After that, I have modified that original sinewave in a way to get the "square" wave but keeping the rise and fall edges. Effectively, I divided the frequency by 3 but kept the edge timings.
            My expectation was that I will see the same 3MHz harmonic, because of the edges, but I have no clue where these additional harmonics came from. Specifically, the 1MHz, 5MHz, 7MHz and so on, basically all except the 3MHz.The waveform editing was not by freehand but by editing the values in the CSV file.
            Click image for larger version  Name:	sine-square.png Views:	7 Size:	110.3 KB ID:	17741 Click image for larger version  Name:	screen6.png Views:	6 Size:	77.2 KB ID:	17744 Click image for larger version  Name:	screen9.png Views:	5 Size:	77.9 KB ID:	17747

            Finally, I had a simple square wave with the steepest edge possible and the results are quite obvious. Harmonics all over the place.
            Click image for larger version  Name:	DS1Z_QuickPrint6.png Views:	6 Size:	13.3 KB ID:	17745 Click image for larger version  Name:	screen7.png Views:	5 Size:	77.3 KB ID:	17748 Click image for larger version  Name:	screen8.png Views:	5 Size:	78.3 KB ID:	17749

            So these are the results so far, I still don't get the root cause for the harmonics on the "sine-square" wave but I hope that someone will see what I am failing to do right now.
            Attached Files
            Last edited by marko.brelak; 05-31-2021, 03:14 AM.

            Comment


            • #7
              Do note that it is a "signal generator" and not a "digital output". The signal generator calculates how to make up the signal and may use discontinues pulses (of certain frequencies).

              Playing with some numbers:
              Click image for larger version

Name:	2021-05-31 17_22_10-Sine Wave.png
Views:	26
Size:	82.2 KB
ID:	17752

              Although, I would not expect to see a 1MHz sine in a 3MHz signal.

              The effects seen in your original post are naturally also depending on the physical situation (trace impedance, length, termination, etc.)

              Comment


              • #8
                qdrives , you are right, as you said the signal generator will calculate and synthesize the designed signal. Maybe with the sinewave, it has some cleaner way to generate it so we have only one/first harmonic. Btw, the Ultra Station software will let you design the signal using 8192 points/mS (I think), so the output signal might not be that clean.
                If you have any idea for the new test that will be beneficial for this topic I will gladly perform it on my side using the aforementioned equipment. In a meantime, I will continue with this and probably soon will have a PCB with MCU and some basic comm interfaces on it. The idea is to have a very simple board and observe real case scenarios and try different filtering methods. During the certification testing of my devices, it all went well using the "rule of thumb" approach for SCH and PCB design, but I want to put some real numbers and results, both for me and the other engineers.

                Cheers

                Comment


                • #9
                  "... try different filtering methods " - have you seen this video https://www.youtube.com/watch?v=CDJn-35W8sg ?

                  Comment

                  Working...
                  X