The Designer's Guide Community Forum https://designers-guide.org/forum/YaBB.pl Design >> Mixed-Signal Design >> SAR ADC SNR variations for different FFT numbers https://designers-guide.org/forum/YaBB.pl?num=1506761516 Message started by niloun on Sep 30th, 2017, 1:51am

 Title: SAR ADC SNR variations for different FFT numbers Post by niloun on Sep 30th, 2017, 1:51am Hi everyoneI would like to calculate the dynamic specifications of an SAR ADC that I have designed in Cadence. I have imported the output data (D0~D8) of my SAR ADC from Cadence into Matlab to calculate the FFT.I have done this process for N=64 , N=512 and N=4096, and I don’t understand why the SNR is increased when the number of FFT points is increased?I have used an integer number of cycles, however, when I use a Hann window the extent to which the SNR varies for N=64 , N=512 and N=4096 declines considerably. 1- Does SNR change when we increase N (FFT number)? I think it shouldn’t change because total noise power is constant.2- Are we allowed to use both integer number of cycles and a Hann window? Thanks in advance

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by carlgrace on Oct 2nd, 2017, 8:50am The noise floor of the FFT itself declines when you use a longer FFT. If the SNR is improving as you increase the length of the FFT, that means that you are being limited by the FFT and not the ADC. When you get to the point the ADC is limiting SNR using a longer record won't improve SNR.You should consider using a prime number of cycles rather than just an integer. An integer is OK, but you may get some samples landing on top of each other which will make it appear like you have less data.Also, if you are using coherent sampling correctly (integer/prime number of cycles) using a Hann window should be needed (all your input power should fall into a single FFT bin).

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 3rd, 2017, 1:17am

Thanks so much for the answer.

carlgrace wrote on Oct 2nd, 2017, 8:50am:
 The noise floor of the FFT itself declines when you use a longer FFT. If the SNR is improving as you increase the length of the FFT, that means that you are being limited by the FFT and not the ADC. When you get to the point the ADC is limiting SNR using a longer record won't improve SNR.

I understand that noise floor declines when FFT size increases because of the formula below (-10log(n/2)):

But what I don’t understand is that the noise power must be distributed between noise bins (either 62 or 510) and the total power of the noise bins should be constant hence the snr must remain constant. I don’t find any theoretical reasons for total noise power variations and it is confusing me. What do you exactly mean by SNR being limited to FFT?

carlgrace wrote on Oct 2nd, 2017, 8:50am:
 You should consider using a prime number of cycles rather than just an integer. An integer is OK, but you may get some samples landing on top of each other which will make it appear like you have less data.

Yes I totally understand what you mean and I have used prime/integer number of cycles, “integer number of cycle” is a term used in Stanford lecture notes meaning the same thing you just explained:

carlgrace wrote on Oct 2nd, 2017, 8:50am:
 Also, if you are using coherent sampling correctly (integer/prime number of cycles) using a Hann window should be needed (all your input power should fall into a single FFT bin).

Fine, but according to Stanford lecture notes, windowing will distribute the sigbin power between some bins:

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by sheldon on Oct 3rd, 2017, 9:02am Niloun,  Comments:1) Carl's approach includes an integer number of clock and signal    periods, for example: 13 periods of the signal and 256 periods    of the clock. So, the signals will be periodic in the data record    used for the FFT2) The reason for using the approach Carl suggest is to assure that    the clock and signal are not harmonically related. For example,    if the clock is 100MHz and the signal is 10MHz, there are only    10 lsb levels tested in the simulation. So the SNDR/SINAD will    be correct, but the SNR and THD will be incorrect. Since all the    energy will be concentrated in 10 bins of the FFT 3) If you follow the guidelines that Carl suggests, you can use the    Rectangular window which means that there is no signal spreading4) For Delta Sigma, #1 is still applied but you will need to use a    window function                                                                     Sheldon

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 3rd, 2017, 9:53am

Thanks Sheldon

sheldon wrote on Oct 3rd, 2017, 9:02am:
 Niloun,1) Carl's approach includes an integer number of clock and signal    periods, for example: 13 periods of the signal and 256 periods    of the clock. So, the signals will be periodic in the data record    used for the FFT2) The reason for using the approach Carl suggest is to assure that    the clock and signal are not harmonically related. For example,    if the clock is 100MHz and the signal is 10MHz, there are only    10 lsb levels tested in the simulation. So the SNDR/SINAD will    be correct, but the SNR and THD will be incorrect. Since all the    energy will be concentrated in 10 bins of the FFT

I totally understand, I had done my calculations as you and Carl said, for example, when using 64 FFT points I choose Fin according to the formula below:
(Fin/Fs)=(cycles/FFTpoints)
If Fs=200K and I have 64 FFT points I choose cycles to be 7 so I will have: Fin=7/64*200K=21.875K
And if I choose 512 points and 51 cycles Fin will be 51/512*200K
But it’s not helping and ENOB improves when FFT number is increased.

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by sheldon on Oct 3rd, 2017, 10:13am Which goes back to Carl's other comment, that the noise floor of the FFT is above the noise floor due to quantization noise. You need to increase the number of FFT points until the noise floor is constant.

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 3rd, 2017, 10:35am

sheldon wrote on Oct 3rd, 2017, 10:13am:
 Which goes back to Carl's other comment, that the noise floor of the FFT is above the noise floor due to quantization noise. You need to increase the number of FFT points until the noise floor is constant.

As I know the noise floor of the FFT is the sum of SQNR (obligatory noise due to quantization) and processing gain(10log(N/2)), so theoretically FFT noise floor is always under SQNR. How is it even possible for the FFT noise floor to go beyond SQNR?
What kind of FFT limitation forces noise floor to go beyond SQNR?

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by sheldon on Oct 3rd, 2017, 4:05pm Niloun,    Oops, misspoke. You are confused. You are assuming that the FFT noise floor is the same as the total noise. The SNR calculation uses the total integrated noise across the Nyqvist band, from 0 to Fsample/2.As you increase and decrease the number of FFT points, you are raisingand lowering the noise in the individual FFT bins. However, the total noise, calculated by integrating across the band is constant.                                                                         Sheldon

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by sheldon on Oct 3rd, 2017, 4:12pm In answer to the last question, you can't do better than the quantization limited noise floor for the total noise of the  ADC. The resolution of the FFT is limited by the number of bits. However, by increasing the number of FFT bins, you can decrease the FFT noise floor. So, you can lower the FFT noise floor to as much as you want at the cost of increased simulation time. However, the SNR won't change because every time you make the FFT bin size smaller, you more bins.                                                                       Sheldon

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by niloun on Oct 4th, 2017, 12:02am I move the answer below.

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by sheldon on Oct 4th, 2017, 12:03am A plot to illustrate the point. Two FFTs: 256 point and 16384 points, the noise floor is different, however, the total integrated noise is the same and roughly equal to the expected quantization noise floor of a 10 bit ADC

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 4th, 2017, 12:07am

sheldon wrote on Oct 3rd, 2017, 4:05pm:
 Niloun,    Oops, misspoke. You are confused. You are assuming that the FFT noise floor is the same as the total noise. The SNR calculation uses the total integrated noise across the Nyqvist band, from 0 to Fsample/2.As you increase and decrease the number of FFT points, you are raisingand lowering the noise in the individual FFT bins. However, the total noise, calculated by integrating across the band is constant.                                                                         Sheldon

No I am not confused about that part, I know that noise floor is not the sum of noise bins.
Let me repeat the question I asked in the first place:
If the total noise power is constant and the SNR formula is :

%noise = [s(1:sigbin-1);s(sigbin+1:end)];
%snr = 10*log10( s(sigbin)^2/sum(noise.^2) )

Why does the practical SNR of my designed ADC increase when the number of bins is increased?
It is just the same amount of noise spread among more bins.
Carl said that I am being limited by FFT, I don't understand "being limited by FFT".

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 4th, 2017, 12:16am

sheldon wrote on Oct 4th, 2017, 12:03am:
 A plot to illustrate the point. Two FFTs: 256 point and 16384 points, the noise floor is different, however, the total integrated noise is the same and roughly equal to the expected quantization noise floor of a 10 bit ADC

Thanks, so is it the output of an practical ADC simulation or an Ideal sine or an oscilloscope?

I see that your total noise is roughly constant (Not much SNR variations).

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 4th, 2017, 12:40am

niloun wrote on Oct 4th, 2017, 12:16am:
 [quote author=sheldon link=1506761516/0#10 date=1507100582]A plot to illustrate the point. Two FFTs: 256 point and 16384 points, the noise floor is different, however, the total integrated noise is the same and roughly equal to the expected quantization noise floor of a 10 bit ADC

when I simulate an ideal sine in Matlab I see the same results and snr variations are negligible for N=64,128,25,...
But as I import the Cadence data into Matlab with the same code, I have SNR improvements with N increment, however, when I use a hann window these variations are vanished.

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by sheldon on Oct 4th, 2017, 12:58pm Niloun,   The noise should not increase with the number of bins, just guess, but there must be something in the way you do the calculation. Are you adding noise voltage or noise power?

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 4th, 2017, 11:59pm

sheldon wrote on Oct 4th, 2017, 12:58pm:
 Niloun,   The noise should not increase with the number of bins, just guess, but there must be something in the way you do the calculation. Are you adding noise voltage or noise power?

I use power as I said above:

%noise = [s(1:sigbin-1);s(sigbin+1:end)];
%snr = 10*log10( s(sigbin)^2/sum(noise.^2) )

When I use a Hann Window (which reduces signal discontinuity) there is negligible SNR variations, I guess it is something to do with that, If the calculations were wrong, ideal sine (only containing quantization noise) would also give wrong results.

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by RobG on Oct 8th, 2017, 4:43pm With coherent (prime) sampling and rectangular window I see only a dB or so of SNDR variation as I increase the number of samples. Perhaps it is your "integer sampling" instead of prime sampling that is throwing it off. I suppose the first few samples of your ADC could also be bad.

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 8th, 2017, 9:57pm

RobG wrote on Oct 8th, 2017, 4:43pm:
 With coherent (prime) sampling and rectangular window I see only a dB or so of SNDR variation as I increase the number of samples. Perhaps it is your "integer sampling" instead of prime sampling that is throwing it off.

Thanks RobG, I stated above that by "integer cycles" I mean integer/prime number of cycles. For example I use 7 cycles for N=64.

RobG wrote on Oct 8th, 2017, 4:43pm:

I have checked the digital output codes both manually and by Matlab, I don't see much difference between the first samples and the rest but maybe you are right I must try.

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by RobG on Oct 9th, 2017, 9:21am Sorry I missed that you were doing what I call prime sampling. I did not see where you told us how much it is varying - what is the change you are seeing? You seem to be doing everything correct as far as I can tell.

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by DanielLam on Oct 10th, 2017, 11:37am Hi Niloun,Can you post pictures of what your FFT's look like before and after increasing the number of bins? (say number of points > 1024). The examples where you say increasing the number of bins helps the ENOB.I am suspecting you might be getting spectral leakage. That might be why changing bins with a Hann Window does not change much.

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 10th, 2017, 12:14pm

RobG wrote on Oct 9th, 2017, 9:21am:
 Sorry I missed that you were doing what I call prime sampling. I did not see where you told us how much it is varying - what is the change you are seeing? You seem to be doing everything correct as far as I can tell.

For N=64 cycles=7

without windowing: SNR=22.7184 ENOB=3.4815
with windowing:     SNR=41.6099 ENOB=6.6196

For N=4096 cycles=409

without windowing SNR=38.1335 ENOB=6.0421
with windowing:     SNR=40.0398 ENOB=6.3588

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by DanielLam on Oct 10th, 2017, 12:21pm Hey Niloun,I asked for the pictures because it will tell us if you have spectral leakage or not. I can't just tell from the numbers.Basically, I am guessing your 64 pt FFT with rectangular window (what you are calling no window) looks like the 2nd picture on this page (triangular towards the bottom of the fundamental tone). https://www.maximintegrated.com/en/app-notes/index.mvp/id/1040

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 10th, 2017, 12:34pm

DanielLam wrote on Oct 10th, 2017, 11:37am:
 Hi Niloun,Can you post pictures of what your FFT's look like before and after increasing the number of bins? (say number of points > 1024). The examples where you say increasing the number of bins helps the ENOB.I am suspecting you might be getting spectral leakage. That might be why changing bins with a Hann Window does not change much.

For N=64 cycles=7 without windowing

For N=64 cycles=7 with a Hann window

For N=4096 cycles=409 without windowing

For N=4096 cycles=409 with a Hann window

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 10th, 2017, 12:35pm

DanielLam wrote on Oct 10th, 2017, 12:21pm:
 Hey Niloun,I asked for the pictures because it will tell us if you have spectral leakage or not. I can't just tell from the numbers.Basically, I am guessing your 64 pt FFT with rectangular window (what you are calling no window) looks like the 2nd picture on this page (triangular towards the bottom of the fundamental tone). https://www.maximintegrated.com/en/app-notes/index.mvp/id/1040

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by DanielLam on Oct 10th, 2017, 12:52pm Just to double check, your Fin has as many digit precision as possible right? For example, for Fin = 7/64 * Fs. That is the Fin input, and you are not using 0.11 * Fs as your Fin.Otherwise, I am a little stumped. Best advice I can give is to make an ideal ADC in matlab, and make sure that works. If that works fine, I'd suspect a rounding issue somewhere. I'm assuming these measurements were from a Cadence sim?

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by RobG on Oct 10th, 2017, 6:30pm Yeah, something's messed with the 64 pt sim. You shouldn't need windowing to get the noise floor down. My best guess is that the first few samples are corrupted (either the ADC or the way you are processing the data). Sometimes this can happen if your reference is settling, but that usually produces a skirt. It is really hard to debug from here. Let us know what you find out.

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 11th, 2017, 12:45am

DanielLam wrote on Oct 10th, 2017, 12:52pm:
 Just to double check, your Fin has as many digit precision as possible right? For example, for Fin = 7/64 * Fs. That is the Fin input, and you are not using 0.11 * Fs as your Fin.

Yes exactly, for instance when using N=64 and cycles=7 for Fs=200K, I choose Fin to be => 200k*7/64=21.875K

DanielLam wrote on Oct 10th, 2017, 12:52pm:
 Otherwise, I am a little stumped. Best advice I can give is to make an ideal ADC in matlab, and make sure that works. If that works fine, I'd suspect a rounding issue somewhere.

I have simulated an ideal sine (only including quantization noise) and this SNR decline didn't happen at all(with and without a window).

DanielLam wrote on Oct 10th, 2017, 12:52pm:
 I'm assuming these measurements were from a Cadence sim?

Yes, I have imported data from Cadence to Matlab.

Sounds that RobG is totally right, the first samples are corrupted, I will post the results below. Thanks so much for your help.

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 11th, 2017, 1:09am

RobG wrote on Oct 10th, 2017, 6:30pm:
 Yeah, something's messed with the 64 pt sim. You shouldn't need windowing to get the noise floor down. My best guess is that the first few samples are corrupted (either the ADC or the way you are processing the data).

Thank you so much, your suggestion worked, I simulated the ADC for N=64 and cycles=7, I ran it for a longer time (640u instead of 320u) then I used output data from 320u to 640u :

N=64, cycles=7, Fin=20K, Fs=200K

RobG wrote on Oct 10th, 2017, 6:30pm:
 Sometimes this can happen if your reference is settling, but that usually produces a skirt. It is really hard to debug from here. Let us know what you find out.

One of the professors in our department said that the circuit is trying to wake up in the first conversion cycles that's why the first few samples are corrupted. I don't understand "Circuit's trying to wake up"!

I am very thankful.

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by RobG on Oct 11th, 2017, 7:23am Glad that worked. Waking up just means initial transients in the reference and/or bias currents are settling out.

 Title: Re: SAR ADC SNR variations for different FFT numbers Post by DanielLam on Oct 11th, 2017, 9:49am Nice one Rob. The good old transient startup times.

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by niloun on Oct 11th, 2017, 11:35am

RobG wrote on Oct 11th, 2017, 7:23am:
 Glad that worked. Waking up just means initial transients in the reference and/or bias currents are settling out.

Thanks, since I haven't used voltage reference generators ( just a DC voltage as supply) and the implemented comparator is a dynamic StrongArm one without preamp and the rest are digital circuits it's a bit confusing me.

Title: Re: SAR ADC SNR variations for different FFT numbers
Post by Frank_Heart on Nov 16th, 2017, 3:23pm

sheldon wrote on Oct 3rd, 2017, 9:02am:
 Niloun,  Comments:1) Carl's approach includes an integer number of clock and signal    periods, for example: 13 periods of the signal and 256 periods    of the clock. So, the signals will be periodic in the data record    used for the FFT2) The reason for using the approach Carl suggest is to assure that    the clock and signal are not harmonically related. For example,    if the clock is 100MHz and the signal is 10MHz, there are only    10 lsb levels tested in the simulation. So the SNDR/SINAD will    be correct, but the SNR and THD will be incorrect. Since all the    energy will be concentrated in 10 bins of the FFT 3) If you follow the guidelines that Carl suggests, you can use the    Rectangular window which means that there is no signal spreading4) For Delta Sigma, #1 is still applied but you will need to use a    window function                                                                     Sheldon

Hi, Sheldon,

It sounds correct to me,

if the clock is 100MHz and the signal is 10MHz, there are only
10 lsb levels tested in the simulation.      So the SNDR/SINAD will
be correct, but the SNR and THD will be incorrect. Since all the
energy will be concentrated in 10 bins of the FFT

But why SNDR/SINAN is correct, while SNR/THD not?

Thanks
Feng