When you want to do FFT on a 100 kHz signal with a sampling rate of 1MS you only get 10 samples per period.

For a sine wave this is not a big problem, but when you use a square wave you will get all kinds of interference problems.

Especially when both are not complete in sync as when you do 90 kHz with 1 MHz sampling rate.

- 1.png (5.14 KiB) Viewed 1748 times

- 2.png (4.65 KiB) Viewed 1748 times

Both above samples are from a 90 kHz square wave

1st notice it is not a square wave anymore it is more like a trapezium, because of the slow sampling compared to the frequency of the square wave.

2nd the first has a half period time of 5 us witch is about 100 kHz and the second has a half period time of 6 us this is because the scope is sampling with 1 us intervals so there will never be 5.55 us (witch is 90 kHz), the constant variation of the period time will kill the FFT calculation as shown in your pictures.

I I set the FFT range to 10 MHz (witch gives 20 MS sampling rate) and zoom in on the first 500 kHz of the FFT the image is what you would expect.

Also notice the scope image, the square wave is a square wave again.

If you want more detail on the zoomed part of the FFT you can increase the number of bins so you get the image below.

I used 0.5 Mbins for this one

Benno.