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 on FFT library usage

Other Parts Discussed in Thread: TMS320F28069

Hello all,

First, I am not an FFT expert, but I was tasked with the creation of a piece of firmware for a customer's TMS320F28069 platform to generate an FFT analysis of their sample data.

We are collecting readings from the on-board 12-bit ADC and storing them into a buffer of size (N*2) long words using iterative calls to the RFFT32_brev_RT function from the library.  We utilized this approach because the call will automatically handle the bit-reversal for us as we collect data.  Because we ultimately require Q31 format data as an input to the FFT analysis, I am passing the ADC raw data to the “input” parameter of the RFFT32_brev_RT function after it has been shifted left by 19. 

QUESTION #1: Are we correctly configuring the input to the function to generate an output in Q31 format for subsequent FFT analysis?

Normally, data is continually collected until we have acquired the specified number of samples, indicated when the “acqflag” of the RFFT32_brev_RT function is cleared.  Note that my first test involves a 32 sample FFT analysis with “known” sample data and results acquired from the customer.  I am therefore using this “known” data in place of our ADC readings for this initial sanity check.  These data samples are shifted left by 19 and then used as the input for the RFFT32_brev_RT function.

Once all the input data has been “collected”, we should have an array of input data where our inputs are stored in the even locations of the array (real portion) and the odd array locations (imaginary portion) are zeroed out.  In addition, our data should now be in Q31 format and bit-reversed.

 QUESTION #2: Is the assumption of the resulting array format correct?

We then utilize the RFFT32 module to perform the real FFT calculations.  Because I am ultimately interested in obtaining the magnitude output, I subsequently call the magnitude library routine.  The psuedo code representing what we are doing is as follows:

 

    RFFT32 RealValueFFTstruct = CFFT32_32P_DEFAULTS;

    RealValueFFTstruct.ipcbptr = (long*)DEPTH_DETECT_FFT_ARRAY_BASE_ADDRESS;

    RealValueFFTstruct.magptr = (long*)DEPTH_DETECT_FFT_MAG_ARRAY_BASE_ADDRESS;

    // Run the Twiddle Factor initialization function

    RealValueFFTstruct.init( &RealValueFFTstruct );

    // Run the FFT calculation on the feedback data

    RealValueFFTstruct.calc( &RealValueFFTstruct );

    // Run the magnitude calculation function on the output data

    RealValueFFTstruct.mag( &RealValueFFTstruct );

 

QUESTION #3: Am I executing these functions in the proper order? 

QUESTION #4: Is there anything I need to do between the FFT calculations and the calculation of magnitude (e.g. data formatting)? 

The reason I ask is that I am not seeing magnitude results which match the customer’s results.  Documentation indicates the magnitude output array should be in Q30 format. 

QUESTION #5: Ultimately, the conversion from Q31 back to floating point values should be (floating point = output / 2^30), correct?

 

Thanks in advance for the help!

-Mark