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.

Question related to FFT Sample output plots.

Expert 1940 points

Hi,

I am trying to run some TI sample FFT code from  DSPF_sp_fftSPxSP_d.c on a dra7xx dsp core.

I am using dsplib_c66x_3_4_0_0 library and building the sample code in CCS6.

When I try to run this sample code via debugger and plot the values of ptr_x_cn_orig ( I modified my code to copy 'ptr_x_cn' to 'ptr_x_cn _orig' ) using the graph tool in CCS6, I can see two sine waves, one with 50Hz and the other with 100Hz frequency being provided as input to DSPF_sp_fftSPxSP_cn() function.

I am able to plot a graph of the FFT output as well. I am attaching all the graphs below.

DualTimeA-1 - Input 100Hz

DualTimeB-1 - Input 50Hz

DualTimeA-2 - Output showing 100Hz freq component

DualTimeB-2 - Output showing 50Hz freq component

  

The following are the settings for input and output graphs respectively.

Input:

     

Output:

Now my question is, I am not sure if the FFT output received is valid?

When I look at the FFT output of a sine wave in LabView, I see that the output shows both the freq component and its mirror as positive. I do not see any freq component with negative amplitude. But in the output of the sample code, I see that there is a frequency component( Mirror component) with negative amplitude. This is the case for both the frequencies.

Am I missing some graph setting? Do my CCS graph settings look right?

Can I use dual time graphs in CCS to plot FFT outputs?

Are these FFT output valid? How can I validate them?

Let me know if any more information is needed.

Thanks.

  • Hi Girish,

    I am trying to run some TI sample FFT code from DSPF_sp_fftSPxSP_d.c on a dra7xx dsp core.

    DRA7xx devices are not supported in C66xx keystone forum.

    Thank you.
  • dra7xx is also using C66xx dsp core right? And my question is more on C66xx dsp core, so I thought this would be the right forum.
    If that is not the case, could you point me to right place to post my question?

    Thanks!
  • Hi Girish,

    I am checking internally and will get back to you. Thank you for your patience.
  • Any leads on who can respond to this post?
    I am still waiting to get some input on these FFT output graphs.
  • Hi Girish,
    I have not got response from them. My suggestion would be to post the same on Automotive device forum.
  • Girish Tummala said:
    When I look at the FFT output of a sine wave in LabView, I see that the output shows both the freq component and its mirror as positive.

    The FFT of a sine wave yields a result that is purely imaginary, with one pulse positive and the other negative.   What you are observing in LabView is clearly the magnitude of the FFT.

    Girish Tummala said:

    Am I missing some graph setting? Do my CCS graph settings look right?

    Can I use dual time graphs in CCS to plot FFT outputs?

    Are these FFT output valid? How can I validate them?

    Your results look like they're correct, but given that your output will have both a real and imaginary component.  Since the real part is all zero for a sine wave did you just not plot it at all?

    You might consider adding one additional step to compute magnitude^2 (i.e. real^2 + imag^2) if that's the main thing you're interested in.  That would likely give you better correspondence with LabView.

  • Actually, I was just looking at the source code you posted in this other thread:

    https://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/446949/1616256#1616256

    Now this makes a little more sense to me.  I thought you were doing two separate FFTs on two separate sine waves.  Now I see that it's actually a single complex FFT on a signal of sin(50t) + j*sin(100t).

    sin(50t) <--> -j*pi*[delta(w-50) - delta(w+50)]

    jsin(100t) <--> pi*[delta(w-100) - delta(w-100)]

    So that means the resulting real part will actually have frequency components at +/-100.  The imaginary part will have components on +/-50.  I noticed that you reverse the order in which you were outputting the real and imaginary for the results.  That was actually not correct as it is expected that the real part will be the 100 Hz signal and the imaginary part will the the 50 Hz signal.