×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

FFT on 10Bits

FFT on 10Bits

FFT on 10Bits

(OP)
Hi,
I am using a logic analyzer to view the output on a 10bit ADC and have to verify that the ADC is working correctly by taking the output and reconstructing the input 20kHz square wave by using FFT in matlab.  I am having trouble performing fft on a series of 10bits at a time instead of the serial bit stream and thus i'm getting lots of noise.  How do i run fft on a series of 10bit numbers instead of a series of 1-bit numbers? Thanks.

RE: FFT on 10Bits

whaat...???

An FFT (or even a Discrete Fourier Transform) on 1-bit numbers would be...well, pretty useless.

RE: FFT on 10Bits

Why do you need to use the FFT function in Matlab?  The output of the ADC is the bianry representation of the analog input.  All you need to do is convert the binary number to decimal and apply the appropriate scaling.

RE: FFT on 10Bits

I agree with Melone on this, given the information from the poster, unless there is more to it than whats posted. You could also feed the AD results into your program or spreadsheet and plot the results to see what the sampled waveform looks like.

RE: FFT on 10Bits

There is no point in testing an ADC with a square wave analog input unless you are running the edge speed up to the maximum possible rate to check the ADC’s risetime characteristics. Use a sinewave so you exercise the ADC over lots of input levels.

A good way of seeing if an ADC is working is to write the data into a DAC and look at the DAC output on a scope. This is only a coarse test but checks basic functionality. If you genuinely want to look at the edge response of the ADC then you might consider decimating the data before reconstructing it in a DAC. You can then alias the waveform deliberately by suitable choice of input signal frequency and sample rate to get a nice slow reconstruction speed.

You say that you are going to "reconstruct the square wave" by using an FFT. The time domain data when FFT’ed will give you a frequency domain plot, much like you would get on a spectrum analyser. This will have a dominant tone at the fundamental with decreasing odd harmonics as the frequency is increased. When the harmonic frequency "hits" the end of the FFT it will reflect back into the FFT as a sequence of aliassed harmonics. Basically this just gives a hideous mess which won’t tell you much at all.

RE: FFT on 10Bits

(OP)
i'm using a square wave because the output of a custom radio chip is going to be a noisy square wave. and i don't have access to a DAC so thats why i'm trying other methods of getting the original signal.  if there are more suggestions i'm happy to listen and thank you guys for responding.

RE: FFT on 10Bits

You mentioned "to verify that the ADC is working correctly by taking the output and reconstructing the input 20kHz square wave by using FFT ".  You can verify the ADC is working (assuming you have verified everything else is already working) by plotting you ADC converter output.  From your wording it sounds like you might have an issue with converting the serial 10-bit stream into a series of numbers.  Is this true?  You would not have to use an FFT to reconstruct the signal.  The signal "reconstruction" would be done by the conversion of the 10 individual bits into a number.  Is this a signed number, or unsigned?  Is the leading bit the MSB or the LSB?  Once you know both of those answers (well I guess you don't really need to know the sign issue), you can convert. However, if you have some "extra" bits in the stream, you need to pick out the ones you want.  IIS (or I2S) is a standard for the audio world that explains some of these items much better than I have here.

An FFT would be able to give you insight into the quality of your signal once you have the time domain data correct.

RE: FFT on 10Bits

(OP)
VisiGoth, thanks for your response.
I wrote a matlab script that converts the serial bitstream into decimals representing 10bit numbers and then plots it.  The number is unsigned with the LSB as the leading bit.  the thing is, plotting the numbers (10bit stream converted to decimals) i don't get the original square wave it shows slightly rounded highs but no lows.  it might be a sampling issue.  the signal is a 20kHz wave and the sampling rate of the ADC is 172ksps.   

RE: FFT on 10Bits

172 kHz is OK for a human to look at a sine wave at 20 kHz.  It gives about 8 sample points per cycle.  However, on a square wave with the fundamental at 20 kHz, the third harmonic is at 60 kHz, which is below the Nyquist rate of 86 kHz.  If you are looking at the Fourier Transform the 5th harmonic (there should be no even harmonics theoretically) at 100 kHz is above the Nyquist rate and thus would show up folded at 86-(100-86)= 72 kHz.
I do not understand what you meant by no lows.  Could you post a few samples in ascii from your MATLAB time domain? That might help.  It sounds like you did the hard part, about getting samples from your logic analyzer converted into decimal.

I am guessing you might be dissatisfied with the information you are getting.  However, your HW may all be good.  You may want to find a way to increase your sample rate, or test (for the purpose of A/D HW verification) with a reduced fundamental of your square wave.  Even the 5th FFT line is the 11th harmonic at 220 kHz, requiring a sample rate above 440 kHz.  If you can generate a 2 kHz square wave the time domain and the frequency domain may look nicer.

jsolar

RE: FFT on 10Bits

(OP)
Here is a simple ascii of my matlab time domain.

^
|     ----    ----
|    /   |   /   |
|   /    |  /    |
|  +     | +     |
|  +     | +     |
|  +     | +     |
|  +     | +     |  ................(repeats)
|  +     \ /     |
|
|
----------------------------------------->
|

if that isn't too clear, they just look like a capacitor charging and followed by a sudden discharge.  I will try increasing the sample rate. Thanks.

RE: FFT on 10Bits

Very good.  It looks like you have very strong pull down.  This sounds typical and therefore expected.  Good work, I think you are done with the objective of verifying the A/D is working.  If you want more fidelity in a time domain plot, you could use some side information to your advantage in an fft then ifft reconstruction method (as you mentioned in your first post).  Since you know you are generating at least the odd harmonics (from the fact that you know you are making a square wave).  After you take the fft take the pickets that you know should be foldovers of the 5th, 7th, and 9th harmonic.  Zero stuff the fft by 2:1, then add in the conjugate of the 3 pickets (at the corect locations, which won't be exactly on a picket unless you can modify your sample frequency to be an exact multiple of your fundamental) to perform an "unfolding".  Next perform an ifft on this modifed data and you will see a clearer picture of what your continuous time domain data really is.
Good Luck.

RE: FFT on 10Bits

(OP)
Thank you very much for your assistance.  I really appreciate it.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources