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.

TMS320F28377S: VCU2 RFFT example code

Part Number: TMS320F28377S

Hi Champs,

I have two questions below of VCU2 RFFT example code,

The output buffer buffer2Q15[0] is DC and we can say this is DC offset of input signal, is it correct?

Where can we get the magnitude information of output buffer please?

Please advise your idea if any, thanks.

Regards,

Luke

  • Hi Luke,

    Luke Chen said:
    The output buffer buffer2Q15[0] is DC and we can say this is DC offset of input signal, is it correct?

    Yes this is correct

    Luke Chen said:
    Where can we get the magnitude information of output buffer please

    You need to calculate this. At the end of the RFFT operation, i.e. after the CFFT_unpack(), you end up with the first N/2-1 complex points of the spectrum. The reason for this is the fourier transform of a real-only input is conjugate symmetric, i.e. F(N-k) = F(k)*, k = 0 to N/2-1. This also means F(0) and F(N/2) only have a real part with a 0 imaginary part.

    So, in order to get the magnitude squared you will have to do something like this (pseudocode)

    for(i=0, j=0; i < N; )

       mag[j++] = buff2[i++]^2 + buff2[i++]^2;

    }

    If you would like the sqrt() of the above you will have to include the IQmath library and call the appropriate sqrt() 

  • Hi Vishal,

    Thanks for your response, I still have questions of vcu2 example code below,

    1. In 2837x_vcu2_rfft_256 example code, there are 256 real part items in buffer1Q15 array and CFFT_run128Pt treats this array as real + imaginary parts, like real1, imag1, real2, imag2.. and so on, is it correct?
    2. In this example code, I build a sine wave data(real part) and run, seems that the FFT output data is in buffer1Q15, not buffer2Q15. Is this correct?
    3. What is the FFT output format of this RFFT? Does it include real and imaginary parts?

     I also have questions of FixedPointLib 2833x_FixedPoint_RFFT example code and need your comments,

    1. The function prototype void RFFT32_brev(int32_t *src, int32_t *dst, uint16_t size); is different from document Fixed Point DSP Software Library. Is this software library for 16-bit FFT or 32-bit FFT?
    2. Is this software library also treats input data as real1, imag1, real2, imag2…and so on?
    3. Is this FFT output includes real and imaginary parts?
    4. The example code use function RFFT32_brev(), what means bit reversing for FFT?

     

    Thank you for help.

    Regards,

    Luke

  • Luke Chen said:
    In 2837x_vcu2_rfft_256 example code, there are 256 real part items in buffer1Q15 array and CFFT_run128Pt treats this array as real + imaginary parts, like real1, imag1, real2, imag2.. and so on, is it correct?

    Correct, It will treat a 256 pt real data as 128 pt complex, run a 128 pt CFFT and then "unpack" or "split" (there isnt an official name for this operation) the output to get half the spectrum of the real data. You only need half as the spectrum is conjugate symmetric

    Luke Chen said:
    In this example code, I build a sine wave data(real part) and run, seems that the FFT output data is in buffer1Q15, not buffer2Q15. Is this correct?

    No, it should be in buffer2Q15

    Luke Chen said:
    What is the FFT output format of this RFFT? Does it include real and imaginary parts?

    Yes, but only up to the N/2-1st bin, so 

    F[0].r, F[0].i, F[1].r, F[1].i, ...., F[N/2-2].r, F[N/2-2].i, F[N/2-1].r, F[N/2-1].i

    Luke Chen said:
    The function prototype void RFFT32_brev(int32_t *src, int32_t *dst, uint16_t size); is different from document Fixed Point DSP Software Library. Is this software library for 16-bit FFT or 32-bit FFT?

    Its 32-bit, the prototype in the doc is incorrect. I can file a ticket to rectify that

    Luke Chen said:
    Is this software library also treats input data as real1, imag1, real2, imag2…and so on?

    Yes, it does the same algorithm, runs an N/2 point complex FFT on the input, and then splits the output to get the specturm, up to the N/2 th bin

    Luke Chen said:
    s this FFT output includes real and imaginary parts?

    Yes, Any FFT output is complex.

    Luke Chen said:
    The example code use function RFFT32_brev(), what means bit reversing for FFT?

    Yes. you reorder the input in bit-reversed format before running the FFT on it