Translate

Monday 1 April 2013

Running at 200MSPS


200 MSPS working now

I'm finally sampling at 200 MSPS. for some reason I'm an expert to misunderstand datasheet.
This morning... I read carefully the ADC's datasheet and I wrote correct UCF file for my Xilinx device.
look by yourself:

10 MHz square wave

The waveform compared with the same inoput signal published in my previous post looks much more like a square wave, obviously as I can only have the first 3 harmonics... it can't get better than that, even if I increase the input bandwidth. Therefore I'm really satisfied. 



Next:
1) assemble and test channel 2
2) finish to design the USB isolation module (I don't want to damaged my PC)
3) to complete the SW!

Sunday 31 March 2013

FFT and Spectrum Analyzer

How to use an oscilloscope as Spectrum analyzer...

I start to love my oscilloscope. I honestly can't say I have used something that works so well.
I have just finished to add the FFT functionality... and I was amazed with the results, accuracy and speed!
I'm sampling only @100MSPS , 2K buffer. 

1 MHz Sine wave

By applying 1 MHz sinewave, as you can see the spectrum analyzer is correctly indication 1 MHz. The smae indication you can get with the time cursor, but is not so funny with it. 


 after I have applied 1 MHz, I have then applied 2 MHz, 3MHz, and so  up to 40 MHz.
and the spectrum analyzer always gives the correct results:

2MHz sine wave


4 MHz sine wave




 10 MHz Sine wave


20 MHz Sine 



30 MHz sine




Square wave!

The square wave is the most interesting to watch from a spectrum point of view. As you probably know the square wave has got only odd harmonics, e.g. the 1st, 3rd , 5th etc.
Let see the spectrum on a 1 MHz and a 10 MHz square wave:

1 MHz Squarewave

As you can see, the spectrum analyzer correctly report the 1st, 3rf, 5th, 7th, etc. 



10 MHz Square-wave

a 10 MHz square-wave, and we can still see  all the odd harmonics! the Oscilloscope works very well!


 100 KHz Square-wave

100 KHz the spectrum analyzer still works OK, but the resolution is poor. the is due to the fact that with 2048 bytes of buffer, the minimum resolution I can get by sampling at 100 MHz is 100MHz/2048 = 48.8 KHz (approx)... so I was thinking that in the next prototype I will probably add more ram.... maybe changing the FPGA or adding extra ram on the board..



Friday 29 March 2013

Vertical and Horizontal cursors

Adding more functionality on the Oscilloscope

Horizontal and vertical cursors

Designing a digital oscilloscope that is actually useful for a designer seems to be an hard task today for many company. Probably one reason is that the person who write the specs... most of the time.... is not a designer... It could be a very clever chap but sometime  doesn't use the oscilloscope very often.
For example one of the most useful function on a modern oscilloscope is to be able  to make horizontal and vertical measurement. Now while most oscilloscope have this functionality, a functionality very useful is to bring an horizontal cursor back to the screen, without the need to turn 100 times the knob, or without the need to zoom out, then bring the cursor in the middle, then zoom in, and so on.
I have added a simple button that does that for me! 
In many oscilloscope, for some reason the cursors interface is quite a mess, you need to press a button to switch between he cursor and when you press one more time you need to do again and again...
why make the life difficult?
see the GUI below and you immediately understand how it works.



Se you at next time.


Thursday 28 March 2013

AN oscilloscope that I would use in the lab

Getting better and better

The Oscilloscope it start to be good enough to bring it in the lab with me.
On the screen the user has all the information he needs.
I have slightly changed the look as well. 
I'm so happy to have started this project! I still can't believe I have done this!



Next time... I will:
adding the menu for Cursors, Measure, Math (with the FFT).

Tuesday 26 March 2013

a working USB Occilloscope

The oscilloscope SW is very fast!

Last week end I finally found  a working solution for the interpolation algorithmic and tonight I decided to work on the SW side to make the SW very responsive. I'm very impressed how the GUI react with the commands considering the amount of work is doing to calculate the interpolation of a waveform.
I'm also impressed with the linearity displayed from the sinc(x) exp(-x^2/3) algorithm.
So now my task for the next day is to assemble the second channel on the PCB and to finish the SW.




Sunday 24 March 2013

The Oscilloscope is growing up

More waveform

I made a bit more work on the interpolation algorithm, I haven't finished yet... but for the time being I will stop for now to work on the interpolation algorithm as I have achieved some good result today.
So the Oscilloscope is still sampling only at 100 MHz! (200 MHz next week end I guess).
Let see some waveform:

 

1 MHz Sinewave

Not too bad I think... it is still possible to see some issues due to common mode noise that probably goes inside the input ( 1MHz) of the oscilloscope and is displayed, as at moment the oscilloscope is still not isolated from the PC I must leave with it until I isolate it.


 1 MHz squarewave

Not too bad I think, considering that the square wave is the function with lots of  harmonics   .


5 MHz sine wave 

not too bad I think


5 MHz square wave

Not too bad considering I'm sampling at 100 MHz!




10 MHz sine wave

pretty good!



10 MHz square wave

Not too bad  considering that the input is a 10 MHz square wave and I've got only 10 samples to rebuilds.
I wish to thanks all the person  that are following this blog  for the excellent suggestions on how to design the interpolation algorithm. When you buy an oscilloscope and you read sinc(x) interpolation. Don't believe it  without a good windowing you have overshoot all over the place. in my case I'm using a sin(x)e(-x^2/3) interpolation, the Gaussian works pretty well in reducing the overshoot. 



What to do now?

1) improve the SW

2) finish to design the isolator ( the noise should further reduce)

3) sample at 200 MSPS ( so far I haven't done because of a mistake of mine in choosing the clock pin of the FPGA)




















Saturday 23 March 2013

Still problems on the interpolation

I love DSP but I'm bad at it!


It looks like I'm a bad SW designer... 
I'm still not sure I understood how to interpolate a raw data from the FPGA buffer to the screen.
In the picture below I have in yellow the raw data from the FPGA, and in red the interpolated data using the sinc(x) algorithm.
Now how you can see, there is nothing that suggest why I should have all that ringing.


In order to show the problem even better I have zoomed the image(see below): in red I still have the interpolated data, while in yellow I have the raw data.
From the raw data, I can see some small ringing that for some reason get amplified in red when I interpolate .
For example if you look at that negative edge... it doesn't look right isn't it? 


the above GUI is written using Lazarus . The function that create the interpolated data is :


function sinc_interpolation(buff: TCH_BUFF; Fsample: float; t: float): float;
var
  i: integer;
  sum: float = 0;
  x_nt: float;
  Ts: float = 0;

begin

 {
  x(t) = sum [ Xn sinc(pi/T(t-nT))] sum all the n...
  }

  Ts := 1 / FSample;  // sample time
  sum := 0;
  for i := 1 to BUF_SIZE - 2 do // remember to fix the bug inside the FPGA
  begin
    x_nt := buff[i] * sinc((t - i * Ts) / Ts);
    sum := sum + x_nt;
  end;
  Result := Sum;

end;  
When I call that function I set:
 Fsample = 100000000.0; (100 MHz)
t = time I want to diplay on the screen ( I start to calculate t  starting from the middle of the buffer)
and buff is the buffer from the FPGA

Do you think the code  above is correct?
any comment is welcome.