This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Resolved

TMS320F28335: ADC sampled sine wave, incorrect FFT

Prodigy 110 points

Replies: 6

Views: 166

Part Number: TMS320F28335

I am a newbie to TI's DSP. Working with TMS320F28335 to find Harmonics in 50 Hz signal and generate PWM accordingly.  Tride example program _RFFT_ADC_RT in CCS6. Measured sampling period by  toggling pin  and it is coming 1.136 KHz(?). Also getting integer value  in bin [0]=258.221008.(?). The AC signal is shifted by 1.5 V DC and given to the ADC. If I plot waveform from the samples it is perfectly coming as a shifted sine wave.Need some suggestions what I am doing wrong? 

  • Manish,

    Would it be possible to attach the graph plots of the sampled waveform and note what you expect vs what you are seeing?

    Also, you mention you are measuring the ADC sample rate at 1.136kHz, is that what you expected or is this also incorrect?

    Will look for your reply before suggesting the next step.

    Best,

    Matthew

    Helpful Links:

    Getting Started     

    Application Specific

    More Resources

    C2000 Training Portal Electric Vehicles All C2000 Reference Designs
    C2000 MCU Development Tools Industrial Drives
    C2000 Home Page Power Control

     

  • Attaching required details. FFT+TMS320F28335.docx

  • Dear Sir, here is the graph of input samples. I have toggled one of the I/O and measured time in ADC_ISR which I observed 0.886 msec for each samples.input sinewave.docx

  • In reply to Manish Girase:

    Manish,

    I don't understand what you mean by "Measured sampling period by  toggling pin ". Per the example project you reference, the ADC's sampling frequency is 48kHz. So unless you changed project settings, this should be the sampling frequency.

    bin[0] is the DC component of the signal in the spectral domain, so it will not have an obvious relationship to the DC offset of the input signal.

    Think of the formula of the Discrete Fourier Transform. X(k) = Sigma n=0 to N-1 (x(n) exp(-j 2 pi k n / N)).

    DC bin corresponds to X(0) = Sigma n=0 to N-1 (x(n)). Intuitively, you can see here that if you had a perfect sinusoid without a DC offset, this sum would be 0. With a DC offset, this sum would be the DC offset. However, that assumes there there are an exact number of sinusoidal cycles of the input within the FFT_SIZE chosen (N). This is true if the input frequency is an exact multiple of the FFT's spectral resolution, which is fs/2/N (where fs  = sampling frequency).

    So, assuming all the conditions above are met, then bin[0] = DC offset. Then the question becomes, what is the DC offset? That has to do with the ADC range. So if you have a 12-bit ADC with values ranging from 0-4095, I believe a DC offset of 1.5V should correspond to 2048. Once again, this assumes 3V gets the ADC to saturate, and not 3.3V. You'll have to look at the ADC spec in our device datasheet to confirm this.

    Let me know if this makes sense. Also, if you could, please try changing the FFT_SIZE and seeing if bin[0] changes (and tracks FFT_SIZE in some way), or if it stays constant. This would be interesting to know. I don't expect it to change but if it does, I would need to dig into the library to find out why.

    Thanks,

    Sira

  • In reply to Sira Rao80:

    Thank you Sira for your step by step explanation and guidance.  After respective corrections in the program I got proper results. Please you can close this thread.

    Regards

    Manish

  • In reply to Manish Girase:

    Manish,

    Good to know. Could you provide a brief explanation of what changes solved your problem, just so it provides the right context and closure to this thread?

    Thanks,

    Sira

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.