Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17253 Discussions

how to measure SNR and power spectrum of a signal practically?

Altera_Forum
Honored Contributor II
5,797 Views

Dear all Hi; 

I've implemented sigma delta ADC on cyclonII DE1 FPGA. 

the analog input is digitized at the multi-bit output (some pics attached) 

now I want to evaluate the output by measuring the Signal to Noise Ratio (SNR) and ENOB and power spectrum but I dont know how to do that in practice? 

using which software or which device ? 

and how to get the diagrams for SNR and Power spectrum? 

 

 

 

 

can anybody guide me? 

Thank you
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
4,520 Views

 

--- Quote Start ---  

Dear all Hi; 

I've implemented sigma delta ADC on cyclonII DE1 FPGA. 

the analog input is digitized at the multi-bit output (some pics attached) 

now I want to evaluate the output by measuring the Signal to Noise Ratio (SNR) and ENOB and power spectrum but I dont know how to do that in practice? 

using which software or which device ? 

and how to get the diagrams for SNR and Power spectrum? 

 

 

 

 

can anybody guide me? 

Thank you 

--- Quote End ---  

 

 

you need first to understand the ADC terms which may vary from vendor to another. Here is a good guide.: 

http://www.analog.com/static/imported-files/tutorials/mt-003.pdf 

 

You will need to: 

pass single tone through ADC. 

apply fft offline on captured data (with say hann window to uncover noise floor) 

make your compuations. You need to do computations rather than visually assess spectrum. 

you need take into account your fft resolution(which adds false 10log(resolution/2) to SNR). 

measure SNR as the difference between top of tone and noise floor which should be reasonably flat(exclude harmonics)  

The above link defines terms very well.
0 Kudos
Altera_Forum
Honored Contributor II
4,520 Views

 

--- Quote Start ---  

 

I've implemented sigma delta ADC on cyclonII DE1 FPGA. 

the analog input is digitized at the multi-bit output (some pics attached) 

now I want to evaluate the output by measuring the Signal to Noise Ratio (SNR) and ENOB and power spectrum but I dont know how to do that in practice? 

using which software or which device ? 

and how to get the diagrams for SNR and Power spectrum? 

 

can anybody guide me? 

 

--- Quote End ---  

 

 

Here's an example of ADC characterization: 

 

http://www.ovro.caltech.edu/~dwh/carma_board/digitizer_tests.pdf 

 

Here's more notes of similar material: 

 

http://www.ovro.caltech.edu/~dwh/correlator/pdf/esc-104paper_hawkins.pdf 

http://www.ovro.caltech.edu/~dwh/correlator/pdf/esc-104slides_hawkins.pdf 

http://www.ovro.caltech.edu/~dwh/correlator/pdf/lfsr_tutorial.pdf 

 

For testing your design, you can capture a series of samples of a sinusoid or noise signal (see the LFSR document for a noise generator). 

 

You can then use a package like MATLAB or Octave to create histograms of samples. Those histograms can then be summed to create a cumulative distribution function (CDF). The CDF can then be inverted to determine 'where' the ADC decision logic changed codes. This provides the stair-case voltage-to-digital code transfer function of the ADC. From that plot you can generate INL/DNL curves. 

 

If you generate the input signal using a DAC with more bits than then ADC, you can generate a noise signal with a notch. The depth of that notch in the digital power spectrum is determined by the 'noise power ratio' (NPR). The ideal NPR for different bit widths is in here ... 

 

http://www.ovro.caltech.edu/~dwh/wbsddc/correlator_efficiency.pdf 

 

Just look at the pictures in these references, and then start writing some code to analyze your data. As you write your code, you'll start to find the useful bits in these documents. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
4,520 Views

dear Kaz and Dave; 

thanks for your replies and stuffs you sent to me, as to somewhat I am new in practical engineering I will go through your stuffs; hope to deal with my problem with your guidance  

Thank you :)
0 Kudos
Altera_Forum
Honored Contributor II
4,520 Views

 

--- Quote Start ---  

you need first to understand the ADC terms which may vary from vendor to another. Here is a good guide.: 

http://www.analog.com/static/imported-files/tutorials/mt-003.pdf 

 

You will need to: 

pass single tone through ADC. 

apply fft offline on captured data (with say hann window to uncover noise floor) 

make your compuations. You need to do computations rather than visually assess spectrum. 

you need take into account your fft resolution(which adds false 10log(resolution/2) to SNR). 

measure SNR as the difference between top of tone and noise floor which should be reasonably flat(exclude harmonics)  

The above link defines terms very well. 

--- Quote End ---  

 

 

 

 

kaz I read the file you uploaded here it was very usefule but now would we check in details 

that what are the process?: 

-suppose i pass my analog input to fpga now I have 16-bit output 

1) how to apply FFT on my captured data? 

some papers suggest use signal tap(i dont know how) or spectrum analyzer. 

2) what computation should I make? 

I just want to have my own circuit SNR and Power spectrum graph (somethings like the files I attached in this post) 

 

would you please answer me these 2 questions? 

 

Thank you
0 Kudos
Altera_Forum
Honored Contributor II
4,520 Views

 

--- Quote Start ---  

kaz I read the file you uploaded here it was very usefule but now would we check in details 

that what are the process?: 

-suppose i pass my analog input to fpga now I have 16-bit output 

1) how to apply FFT on my captured data? 

some papers suggest use signal tap(i dont know how) or spectrum analyzer. 

2) what computation should I make? 

I just want to have my own circuit SNR and Power spectrum graph (somethings like the files I attached in this post) 

 

would you please answer me these 2 questions? 

 

Thank you 

--- Quote End ---  

 

 

You can't use analogue spectrum analyser because you have left the analogue domain. You need to capture a good representative stream of data 

may be by signaltap. Then use a tool like matlab to do the processing. You will need some background to do this.  

If you capture your data may be you get some help from the forum thereafter.
0 Kudos
Altera_Forum
Honored Contributor II
4,520 Views

Thanks kaz 

now I captured my 16 bit output by signal tap (the files of captured data and text file crated by signal tap were attached) 

and also I found MATLAB code that plots the FFT spectrum of a desired test tone and will computes SNR, SINAD, THD and SFDR. 

Matlab codes are as bellow: (also the pdf file contain the codes were attached) 

 

 

does any body know how can I introduce my captured data file to Matlab code to plot fft for me? 

 

 

 

%The following program code plots the FFT spectrum of a desired test tone. Test tone based on coherent sampling 

criteria, and 

%computes SNR, SINAD, THD and SFDR. 

%Copyright Au/Hofner, Maxim Integrated Products, 120 San Gabriel Drive, Sunnyvale, CA94086 

%This program is believed to be accurate and reliable. This program may get altered without prior notification.; 

disp('HP16500C LA 100/110 State Card'); 

filename=input('Enter file name or press RETURN to accept data from LA via GPIB/HPIB ) : '); 

if isempty(filename) 

filename = 'listing'; 

end 

fid=fopen(filename,'r'); 

numpt=input('Number of Points in FFT? '); 

fclk=input('Sampling Frequency (MHz)? '); 

numbit=input('ADC Resolution? '); 

%Discard first 13 lines of the LA listing (LA header), as they don't contain valid data. 

for i=1:13, 

fgetl(fid); 

end 

[v1,count]=fscanf(fid,'%f',[2,numpt]); 

fclose(fid); 

v1=v1'; 

code=v1(:,2); 

%Warning: ADC output may be clipping - reduce input amplitude 

if (max(code)==2numbit-1) | (min(code)==0) 

disp('WARNING: ADC OUTPUT MAYBE CLIPPING - CHECK INPUT AMPLITUDE!'); 

end 

figure; 

plot([1:numpt],code); 

title('TIME DOMAIN') 

xlabel('SAMPLES'); 

ylabel('DIGITAL OUTPUT CODE'); 

Dout=code-(2^numbit-1)/2; %Re-center the digitized sinusoidal input 

Doutw=Dout; 

Dout_spect=fft(Doutw); 

Dout_dB=20×log10(abs(Dout_spect)); 

figure; 

maxdB=max(Dout_dB(1:numpt/2)); 

plot([0:numpt/2-1].×fclk/numpt,Dout_dB(1:numpt/2)-maxdB ); 

grid on; 

title('FFT PLOT'); 

xlabel('ANALOG INPUT FREQUENCY (MHz)'); 

ylabel('AMPLITUDE (dB ) ' ); 

a1=axis; axis([a1(1) a1(2) -100 a1(4)]); 

fin=find(Dout_dB(1:numpt/2)==maxdB ) ; %Find the signal bin (DC represents bin=1) 

span=max(round(numpt/200),5); %Determine span of input frequency on each side 

spanh=2; %Search span for harmonic distortion components on each side 

spectP=(abs(Dout_spect)).× 

(abs(Dout_spect)); %Determine power level 

Pdc=sum(spectP(1:span)); %Determine DC offset power level 

Ps=sum(spectP(fin-span:fin+span)); %Determine signal power level 

Fh=[]; %Vector storing frequency and power components of signal and 

harmonics 

Ph=[]; %HD1=signal, HD2=2nd harmonic, HD3=3rd harmonic, etc. 

%Find the harmonic frequencies/power within the FFT plot 

for har_num=1:10 

tone=rem((har_num × (fin-1)+1)/numpt,1); %Note: tones > fSAMPLE are aliased back 

if tone>0.5 

tone=1-tone; 

end 

Fh=[Fh tone]; 

%For this method to work properly, make sure that the folded back high order harmonics do not overlap with DC and 

signal 

%components or lower order harmonics. 

har_peak=max(spectP(round(tone×numpt)-spanh:round(tone×numpt)+spanh)); 

har_bin=find(spectP(round(tone×numpt)-spanh:round(tone×numpt)+spanh)==har_peak); 

har_bin=har_bin+round(tone×numpt)-spanh-1; Ph=[Ph sum(spectP(har_bin-1:har_bin+1))]; 

end 

Pd=sum(Ph(2:5)); %Total distortion power level 

Pn=sum(spectP(1:numpt/2))-Pdc-Ps-Pd; %Extract noise power level 

format; 

A=(max(code)-min(code))/2numbit %Analog input amplitude in mV 

AdB=20×log10(A) %Analog input amplitude in dB 

SNR=10×log10(Ps/Pn) %SNR in dB 

SNR=10×log10(Ps/Pn) %SINAD in dB 

SINAD=10×log10(Ps/(Pn+Pd)) 

disp('THD - HD2 through HD5'); 

THD=10×log10(Pd/Ph(1)) %THD in dB 

SFDR=10×log10(Ph(1)/max(Ph(2:10))) %SFDR in dB 

disp('SIGNAL AND HARMONIC POWER (dB ) ' ); 

HD=10×log10(Ph(1:10)/Ph(1)) 

hold on; 

plot(Fh(2)×fclk,0,'mo',Fh(3)×fclk,0,'cx',Fh(4)×fclk,0,'r+',Fh(5)×fclk,0,'g×',Fh(6)×fclk,0,'bs',Fh(7)×fclk,0,'bd',Fh(8)×fclk,0,'kv', 

Fh(9)×fclk,0,'y^'); 

legend('SIGNAL','HD2','HD3','HD4','HD5','HD6','HD7','HD8','HD9'); 

hold off; 

 

any guidance is really appropriated I dont know how to get fft plot ?
0 Kudos
Altera_Forum
Honored Contributor II
4,520 Views

your capture is in ones and zeros. Can you get the data values as bus instead of individual bits setting the format to signed.

0 Kudos
Altera_Forum
Honored Contributor II
4,520 Views

 

--- Quote Start ---  

your capture is in ones and zeros. Can you get the data values as bus instead of individual bits setting the format to signed. 

--- Quote End ---  

 

 

Hello to all,  

 

Refering to these two lines: 

"disp('HP16500C LA 100/110 State Card'); 

"filename=input('Enter file name or press RETURN to accept data from LA via GPIB/HPIB ) : '); 

 

I do not have access to HP16500C, so I do not know how the data is written/organized by this tool.  

In order to do postprocessing (using data from other sources: Cadence), I have replaced the lines with this one:  

"filename=load('data.csv');" 

But my "data.csv" format is not the same as the data from HP16500C. 

 

From the previous posts, kaz said that this format is incorrect: 

-1024 0 0 1 0 1 1 0 0 0 1 1 1 0 1 1 1  

-1023 0 0 1 0 1 1 0 0 0 1 1 1 0 1 1 1  

-1022 0 0 1 0 1 1 0 0 0 1 1 1 0 1 1 1 

and it should be ""bus format and signed" 

 

Could someone please send me a sample ? (I have from some considerable time been trying to run this code). 

 

Thank you,  

Vlad
0 Kudos
Altera_Forum
Honored Contributor II
4,520 Views

 

--- Quote Start ---  

your capture is in ones and zeros. Can you get the data values as bus instead of individual bits setting the format to signed. 

--- Quote End ---  

 

 

Dear Kaz hello; 

kindly I have question regarding this thread: 

I succeeded to capture my 8-bit data and evaluate them by SNR and ENOB; 

know I have a question that for an 8-bit ADC for low-speed industrial applications what is the accepted minimum ENOB for interested bandwidth? 

because for my integrated ADC that only use a sinc filter as filter/decimation stage, ENOB for lower frequencies starts from 6.4 and for highest frequency in the bandwidth is 4.9 are these values acceptable or must be improved? 

thank you;
0 Kudos
Reply