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.

FFT example on VCU-II

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

We are trying to evaluate C2000(F28377S launchpad) with VCU based FFT examples on CCSv6.1.
C:\ti\controlSUITE\libs\dsp\VCU\v2_10_00_00\examples\fft

With the example project "2837x_vcu2_rfft_512", the output data doesn't match the
to the data mentioned in "data_output.h".
We would like to know whether we get the exact values mentioned in the data_output.h
if the input data is "data_input.h"?

Best Regards
Kummi

  • Hi Kummi,

    Yes it should match within ERR_EPSILON, which is 3 for that example. Are you seeing a very different output?

  • Hi Vishal,

    Thank you so much for the reply.

    Yes the output is very different,
    Below is the comparison between data_output.h data and the
    actual output we get.

    goldenOutputQ15[]    RFFToutBuff[]
    -2                             812
    0                              575
    -2                             19
    1                              15
    -2                             18
    1                              16
    -2                             17
    2                              17
    -2                             16
    3                              18
    -3                             14
    ....
    ....

    Meanwhile could please let me know what is done in the CFFT_unpack(handleCFFT) function?

    Best Regards
    Kummi

  • did you have any trouble importing the project into CCS, did it give an error? Did you modify the example in any way? are you getting any build errors or warnings (post images if you can)?. Here are a few things to try/check

    1. make sure the buffer that holds the input is aligned to an N word boundary (see the linker command file in the example). check that its aligned after you build (see the address of the buffer in the .map file)

    2. rebuild the vcu2 library itself

    3. check that the twiddlefactors are in the right memory location?

    Kummi said:
    Meanwhile could please let me know what is done in the CFFT_unpack(handleCFFT) function?

    So the RFFT works as follows.

    1. Take the real N-point data, and treat it as N/2 point complex

    2. run an N/2 point complex FFT on it

    3. unpack (also called split) the output to get half the spectrum for the original real data. The theory behind this is here (). We only need half the spectrum because for real only data the spectrum is complex conjugate about the nyquist point

    F(k) = F*(N-k), for k = 0 to N/2-1

    The F(0) and F(N/2) bins are always real in this case.

  • Hi Vishal,

    Thank you very much for the detailed information.
    It was very helpful in understanding the concept.

    I am running the sample code as it is, no build error.
    It seems the sample code stores the output in the buffer1 instead of buffer2.
    The buffer2 data seems very different as shown below.


    and we get normal data in buffer1 and CFFT.pOutBuffer[i] as well.
    Should we look CFFT.pOutBuffer[i] for the output data instead of buffer2?

    One additional question:
    Is it possible to do 1024 point FFT with the sample code "2837x_vcu2_rfft_512"
    by changing the code as below?

        CFFT.init = (void (*)(void *))CFFT_init512Pt;
        CFFT.run  = (void (*)(void *))CFFT_run512Pt;

        handleCFFT = &CFFT;

        CFFT.init(handleCFFT);
        CFFT.run(handleCFFT);
        CFFT_unpack(handleCFFT);

    Please let me know if there is any 1024 point FFT example code with VCU.


    Best Regards
    Kummi

  • Kummi said:
    It seems the sample code stores the output in the buffer1 instead of buffer2.

    The FFT ping pongs between two buffers during its computation. for the 512 point RFFT, you are actually calling a 256 point CFFT (8 stages). So

    stage 1&2 start with buffer1 as input and buffer2 as output.

    stages 3,4 flip that - buffer 2 as input with buffer1 as output

    stages 5,6 : buffer1 input, buffer 2 output

    stages 7,8: buffer2 input, buffer 1 output

    So in this example you will see the final output in buffer1. The structure element, CFFT.pOutBuffer, will point to the output buffer.

    Kummi said:
    Should we look CFFT.pOutBuffer[i] for the output data instead of buffer2?

    Yes. Also after you do the "unpack" the output should match what is in "data_output.h"

    Kummi said:
    Is it possible to do 1024 point FFT with the sample code "2837x_vcu2_rfft_512"
    by changing the code as below?

    You can modify that example to do a 1024 point RFFT by making these changes

    1. #define NSTAGES 9

    2. 

    CFFT.init = (void (*)(void *))CFFT_init512Pt;
    CFFT.run = (void (*)(void *))CFFT_run512Pt;

  • Hi Vishal,

    Thank you.
    Understood clearly about the final output.

    Meanwhile, we are trying to do a 1024 point RFFT as per the
    modification you mentioned.

    When compared to the same FFT calculation on Excel Sheet Macro or
    a with a different maker MCU, the F2837xx's FFT output is bit small as shown below.
    We believe there is some cancellation of significant digits during the calculation.
    Please let me know your comments on this.



    Best Regards
    Kummi

  • Each stage of the VCU FFT does a divide by 2. so for a 1024 point complex the output is /1024. The division is necessary to prevent overflow from stage to stage. So certain bins of the FFT output will get truncated to 0 if their output is really small.

    If you ran the FFT from the FPU DSP library you will get results similar to what you get in excel.