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.

Problem in FFT in TMS320F28335

Other Parts Discussed in Thread: CONTROLSUITE

Hi all,

      Can somebody explain the meaning of frame rate and sampling frequency in the FFT window. I am trying to get the FFT of a sine wave which I have stored in an dynamic array.

  • Hi Brijendra,

    The sampling frequency is how fast you acquire your samples. Typically you sample an analog signal with an ADC at some frequency- the sampling frequency. For the FFT, it provides the frequency resolutions. For e.g. for a N=1024 sample FFT with a sampling frequency of fs = 1024Hz, each point on my fft represents a frequency change of fs/N = 1Hz.  

    In your case you already have the sine wave in memory . A digital sine is generated using a normalized frequency(to the sampling frequency) as its argument. For e.g. I arbitrarily set my sampling frequency to be fs = 100KHz, and I want to generate a sine sequence of 1024 points at a frequency of fo=10KHz, I would do it as follows:

    for(n = 0; n<1024; n++){

       x[n] = sin(2*pi*(fo/fn)*n);

    }

    So i have 1024 points of a sine wave which i feed into my N=1024 pt FFT and i should see peaks at m1 = (fo/fs)N = 1024/10 ~ 102 and m2 = N - m1 = 1024-102 = ~922 (corresponds to the alias at fs-fo = 90KHz). I think i have that right.....if not someone will definitely correct me.

  • Hi Vishal,

           Thanks for the reply. I understood the concept of sampling frequency in FFT.

    I am trying to implement a phase locked loop (PLL) which will take a sine wave(like grid voltage through ADC) as input and will give the output which is a sine wave in synchronous with the input wave. My main problem is how to get the FFT of output wave (because there may be harmonics present in the input wave whose effect I want to see in the output of PLL) . Since I dont have any DAC, I tried to store the output wave in an array of 50 length and tried to see the FFT in the graph window of CCS3.3. My sampling frequency is 50KHz and input wave frequency is 50Hz. In the graph window I plotted the FFT of output wave which is shown below: I am not able to understand what message does it convey. Since I have a 50 Hz fundamental component in the output. So it should have shown one component at 50Hz frequency.

  • Hi Vishal,

           Thanks for the reply. I understood the concept of sampling frequency in FFT.

    I am trying to implement a phase locked loop (PLL) which will take a sine wave(like grid voltage through ADC) as input and will give the output which is a sine wave in synchronous with the input wave. My main problem is how to get the FFT of output wave (because there may be harmonics present in the input wave whose effect I want to see in the output of PLL) . Since I dont have any DAC, I tried to store the output wave in an array of 50 length and tried to see the FFT in the graph window of CCS3.3. My sampling frequency is 50KHz and input wave frequency is 50Hz. In the graph window I plotted the FFT of output wave (FFT frame size-50, FFT Acquisition buffer size-50, FFT order-8, sampling frequency-50Hz) but I am not able to understant what message it is conveying. It has no component at 50Hz frequency which it should I have as input wave is of 50 Hz frequency. Could you or somebody please help me in understanding the FFT in graph window of CCS 3.3.

    Thanks,

    With Regards,

    Brijendra

  • Ahh, Sorry....completely misunderstood your question :-).

    Ill transfer this post to the Code composer studio forums where one of the CCS experts can comment.

    Just FYI, there are DSP libraries in controlsuite  (controlsuite/dsp/libs) that have FFT routines which you can use. This way, you compute the FFT as part of your code and graph the output buffer (as a normal plot).

  • Brijendra,

    It seems your screen capture did not come through. Would you mind resending it?

    Regards,

    Rafael