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.

Need help calculating FFT of an array in MSP430F5529

Other Parts Discussed in Thread: MSP430F5529, MSP430F5438A, MSP430F6638

Hi all, 

I'm working on a project with MSP430F5529 where I need to calculate the FFT of an array of values that are stored in a vector. 

Can you please tell me what's the easiest way to do this? I just want to store the output of the FFT function in another array so I can see the result.

Thank you very much for your time,

 Carlos Loura

  • Carlos,

    Thank you for your interest in MSP! Regarding your interest in performing FFT of an array of values, have you had a chance to check out the IQMATH library? It features a host of examples on many different devices with example code on how to do complex FFT's using MSP430.

    www.ti.com/.../MSP-IQMATHLIB

    Please let me know if this helps or if you are looking for something else.
  • Hi Evan!

    I looked at that library but I had some doubts. Is it possible to calculate the FFT of an array of samples using the FFT function that comes as an example in the IQMATH library? When I looked through it, I saw that it calculates the values of the FFT using the Imaginary part of the values stored in the INPUT array. But, in my case, I don't have any Imaginary parts. Won't that be a problem?

    That you so much for your reply, I hope that I'm making my doubt clear.


    Regards,

    Carlos Loura
  • Carlos,

    Excuse me for this. I should have actually pointed you to the MSP430F5438A users experience code. This contains an assembly routine that calculates a 256-point FFT. It would need to be modified to support other sizes but that's typically the best place to start for users looking for do an FFT on MSP430.

    www.ti.com/.../slac227
  • Dear Evan,

         Excuse me. I'm also searching for the solution doing fft on MSP too. (What I'm using is MSP430F6638.) And according to this post, I implement the function cFFT from this: www.ti.com/.../MSP-IQMATHLIB. I would like to have 1024 points FFT rather than 256 points. However, when I change the sample size, the project get compiled but can not run when debugging. May I ask what the problem it is? Do I need to do some modifications for that? Thanks a lot.

    Jenny  

  • Hi Jenny,

    The problem is the bit reversal function only supports size up to 256, using it with a size of 1024 would certainly cause out of bounds array access and corrupt your memory. I've attached a modified example file with support up to 1024 points and optimizations to use lookup tables for cos and sin coefficients and inline multiplication. Please let me know if you have any issues getting it to run.

    Regards,

    Brent Peterson

    /* --COPYRIGHT--,BSD
     * Copyright (c) 2015, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    //*****************************************************************************
    // QmathLib_signal_FFT_ex4: Qmath signal generator and complex FFT example.
    //
    // Generate an input signal based on an array of wave descriptors. Each wave
    // descriptor is composed of a frequency, amplitude and phase angle. The
    // input signal is constructed with a size of SAMPLES and assumes a sample
    // frequency defined by SAMPLE_FREQUENCY. The real component of the input
    // consists of the summation of all the waves at that time index and the
    // imaginary component is set to zero.
    //
    // The input array is passed into the complex FFT function which performs
    // the FFT in-place using radix-2. The result of the cFFT is stored in the
    // input array and is scaled by SAMPLES.
    //
    // The result is used to calculate the magnitude and phase angle at each
    // frequency bin up to SAMPLES/2 (Nyquist frequency). The magnitude and phase
    // angles are stored in data memory and should approximate the original
    // signal composition. Because the input signal did not have any imaginary
    // components the magnitude will be halved. The results can be printed with
    // the printf function if ALLOW_PRINTF is defined.
    //
    // B. Peterson
    // Texas Instruments Inc.
    // May 2014
    // Built with CCS version 6.0.0.00190 and IAR Embedded Workbench version 6.10.1
    //*****************************************************************************
    #include "msp430.h"
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdint.h>
    
    /* Select the global Q value and include the Qmath header file. */
    #define GLOBAL_Q    12
    #include "QmathLib.h"
    
    /* Specify the sample size and sample frequency. */
    #define SAMPLES                 1024    // <= 1024, power of 2
    #define SAMPLE_FREQUENCY        8192    // <= 16384
    
    /* Access the real and imaginary parts of an index into a complex array. */
    #define RE(x)           (((x)<<1)+0)    // access real part of index
    #define IM(x)           (((x)<<1)+1)    // access imaginary part of index
    
    /*
     * Input and result buffers. These can be viewed in memory or printed by
     * defining ALLOW_PRINTF.
     */
    _q qInput[SAMPLES*2];                   // Input buffer of complex values
    _q qMag[SAMPLES/2];                     // Magnitude of each frequency result
    _q qPhase[SAMPLES/2];                   // Phase of each frequency result
    
    /* Misc. definitions. */
    #define PI      3.1415926536
    
    /* Structure that describes a single wave to be used to construct the signal */
    typedef struct wave {
        int16_t     frequency;              // Frequency in Hz
        _q          amplitude;              // Amplitude of the signal
        _q          phase;                  // Phase angle in radians
    } wave;
    
    /*
     * Specify wave structures that will be used to construct the input signal to
     * the complex FFT function.
     */
    const wave signals[] = {
    /*   Frequency (Hz)     Magnitude       Phase angle (radians) */
        {128,               _Q(0.5),        _Q(PI/2)},
        {512,               _Q(2.0),        _Q(0)},
        {2048,              _Q(1.333),      _Q(-PI/2)}
    };
    
    /* Calculate the number of wave structures that have been provided. */
    #define NUM_WAVES       (sizeof(signals)/sizeof(wave))
    
    //#define ALLOW_PRINTF                    // allow usage of printf to print results
    #ifdef ALLOW_PRINTF
        char cMagBuffer[10];                // Character buffer for printing magnitude
        char cPhaseBuffer[10];              // Character buffer for printing phase
        char cFrequencyBuffer[10];          // Character buffer for printing frequency
    #endif
    
    extern void cFFT_LUT(_q *input, int16_t n);
    
    int main(void)
    {
        int16_t i, j;                       // loop counters
        _q qWaveCurrentAngle[NUM_WAVES];    // input angles for each signal
        
        /* Disable WDT. */
        WDTCTL = WDTPW + WDTHOLD;
        
        /* Set the initial input angles. */
        for (i = 0; i < NUM_WAVES; i++) {
            qWaveCurrentAngle[i] = signals[i].phase;
        }
        
        /* Construct the input signal from the wave structures. */
        for (i = 0; i < SAMPLES; i++) {
            qInput[RE(i)] = 0;
            qInput[IM(i)] = 0;
            for (j = 0; j < NUM_WAVES; j++) {
                /*
                 * input[RE] += cos(angle)*amplitude
                 * angle += 2*pi*freq/sample_freq
                 */
                qInput[RE(i)] += _Qmpy(_Qcos(qWaveCurrentAngle[j]), signals[j].amplitude);
                qWaveCurrentAngle[j] += _Qmpy(_Q(2*PI), _Qdiv(signals[j].frequency, SAMPLE_FREQUENCY));
                if (qWaveCurrentAngle[j] > _Q(PI)) {
                    qWaveCurrentAngle[j] -= _Q(2*PI);
                }
            }
        }
        
        /*
         * Perform a complex FFT on the input samples. The result is calculated
         * in-place and will be stored in the input buffer.
         */
        cFFT_LUT(qInput, SAMPLES);
        
        /* Calculate the magnitude and phase angle of the results. */
        for (i = 0; i < SAMPLES/2; i++) {
            qMag[i] = _Qmag(qInput[RE(i)], qInput[IM(i)]);
            qPhase[i] = _Qatan2(qInput[IM(i)], qInput[RE(i)]);
        }
        
        /* Print the results. */
    #ifdef ALLOW_PRINTF
        for (i = 0; i < SAMPLES/2; i++) {
            _Qtoa(cMagBuffer, "%2.4f", qMag[i]);
            _Qtoa(cPhaseBuffer, "%2.4f", qPhase[i]);
            _Q1toa(cFrequencyBuffer, "%5.0f", _Q1mpyI16(_Q1(SAMPLE_FREQUENCY/SAMPLES), i));
            printf("%sHz: mag = %s, phase = %s radians\n",
                   cFrequencyBuffer, cMagBuffer, cPhaseBuffer);
        }
    #endif
        
        return 0;
    }
    
    #define CFFT_MAX_SIZE		1024
    
    extern const uint16_t ui16BitRevLUT[CFFT_MAX_SIZE];
    extern const uint16_t ui16TwiddleLUT[CFFT_MAX_SIZE*2];
    
    extern void cBitReverse(_q *input, int16_t n);
    
    static inline _q _Q15mpy_inline(_q q15Arg1, _q q15Arg2)
    {
    	uint16_t ui16Result;
    	uint16_t ui16IntState;
    	uint16_t ui16MPYState;
    
    	/* Disable interrupts and save multiplier mode. [optional] */
    	ui16IntState = __get_interrupt_state();
    	__disable_interrupt();
    	ui16MPYState = MPY32CTL0;
    
    	/* Set the multiplier to fractional mode. */
    	MPY32CTL0 = MPYFRAC;
    
    	/* Perform multiplication and save result. */
    	MPYS = q15Arg1;
    	OP2 = q15Arg2;
    	__delay_cycles(3); //Delay for the result to be ready
    	ui16Result = RESHI;
    
    	/* Restore multiplier mode and interrupts. [optional] */
    	MPY32CTL0 = ui16MPYState;
    	__set_interrupt_state(ui16IntState);
    
    	return (_q)ui16Result;
    }
    
    /*
     * cFFT implementation using a look-up table for cos and sin twiddle coefficients.
     */
    void cFFT_LUT(_q *input, int16_t n)
    {
        int16_t s, s_2;                     // step
        uint16_t i, j;                      // loop counters
        uint16_t ui16TIndex;                // twiddle factor index
        uint16_t ui16TIncrement;            // twiddle factor increment
        _q qTCos, qTSin;                    // complex components of twiddle factor
        _q qTempR, qTempI;                  // temp result complex pair
        
        /* Bit reverse the order of the inputs. */
        cBitReverse(input, n);
        
        /* Set step to 2 and initialize twiddle index increment. */
        s = 2;
        s_2 = 1;
        ui16TIncrement = _Qmpy2(CFFT_MAX_SIZE);
        
        while (s <= n) {
            /* Reset twiddle index and halve increment factor. */
        	ui16TIndex = 0;
        	ui16TIncrement = _Qdiv2(ui16TIncrement);
            
            for (i = 0; i < s_2; i++) {
                /* Calculate twiddle factor complex components. */
                qTCos = ui16TwiddleLUT[ui16TIndex];
                qTSin = ui16TwiddleLUT[ui16TIndex+1];
                ui16TIndex += ui16TIncrement;
                
                for (j = i; j < n; j += s) {
                    /* Multiply complex pairs and scale each stage. */
                    qTempR = _Q15mpy_inline(qTCos, input[RE(j+s_2)]) - _Q15mpy_inline(qTSin, input[IM(j+s_2)]);
                    qTempI = _Q15mpy_inline(qTSin, input[RE(j+s_2)]) + _Q15mpy_inline(qTCos, input[IM(j+s_2)]);
                    input[RE(j+s_2)] = _Qdiv2(input[RE(j)] - qTempR);
                    input[IM(j+s_2)] = _Qdiv2(input[IM(j)] - qTempI);
                    input[RE(j)] = _Qdiv2(input[RE(j)] + qTempR);
                    input[IM(j)] = _Qdiv2(input[IM(j)] + qTempI);
                }
            }
            /* Multiply step by 2. */
            s_2 = s;
            s = _Qmpy2(s);
        }
    }
    
    
    /*
     * Perform an in-place bit reversal of the complex input array with size n.
     * Use a look up table to speed up the process. Valid for size of 1024 and
     * smaller.
     */
    void cBitReverse(_q *input, int16_t n)
    {
        uint16_t i, j;                      // loop counters
        uint16_t ui16BitRev;                // index bit reversal
        _q qTemp;
        
        /* In-place bit-reversal. */
        for (i = 0; i < n; i++) {
        	ui16BitRev = ui16BitRevLUT[i];
            for (j = n; j < CFFT_MAX_SIZE; j <<= 1) {
            	ui16BitRev >>= 1;
            }
            if (i < ui16BitRev) {
                /* Swap inputs. */
                qTemp = input[RE(i)];
                input[RE(i)] = input[RE(ui16BitRev)];
                input[RE(ui16BitRev)] = qTemp;
                qTemp = input[IM(i)];
                input[IM(i)] = input[IM(ui16BitRev)];
                input[IM(ui16BitRev)] = qTemp;
            }
        }
    }
    
    /* 10-bit reversal lookup table. */
    const uint16_t ui16BitRevLUT[CFFT_MAX_SIZE] = {
    	0x0000, 0x0200, 0x0100, 0x0300, 0x0080, 0x0280, 0x0180, 0x0380,
    	0x0040, 0x0240, 0x0140, 0x0340, 0x00C0, 0x02C0, 0x01C0, 0x03C0,
    	0x0020, 0x0220, 0x0120, 0x0320, 0x00A0, 0x02A0, 0x01A0, 0x03A0,
    	0x0060, 0x0260, 0x0160, 0x0360, 0x00E0, 0x02E0, 0x01E0, 0x03E0,
    	0x0010, 0x0210, 0x0110, 0x0310, 0x0090, 0x0290, 0x0190, 0x0390,
    	0x0050, 0x0250, 0x0150, 0x0350, 0x00D0, 0x02D0, 0x01D0, 0x03D0,
    	0x0030, 0x0230, 0x0130, 0x0330, 0x00B0, 0x02B0, 0x01B0, 0x03B0,
    	0x0070, 0x0270, 0x0170, 0x0370, 0x00F0, 0x02F0, 0x01F0, 0x03F0,
    	0x0008, 0x0208, 0x0108, 0x0308, 0x0088, 0x0288, 0x0188, 0x0388,
    	0x0048, 0x0248, 0x0148, 0x0348, 0x00C8, 0x02C8, 0x01C8, 0x03C8,
    	0x0028, 0x0228, 0x0128, 0x0328, 0x00A8, 0x02A8, 0x01A8, 0x03A8,
    	0x0068, 0x0268, 0x0168, 0x0368, 0x00E8, 0x02E8, 0x01E8, 0x03E8,
    	0x0018, 0x0218, 0x0118, 0x0318, 0x0098, 0x0298, 0x0198, 0x0398,
    	0x0058, 0x0258, 0x0158, 0x0358, 0x00D8, 0x02D8, 0x01D8, 0x03D8,
    	0x0038, 0x0238, 0x0138, 0x0338, 0x00B8, 0x02B8, 0x01B8, 0x03B8,
    	0x0078, 0x0278, 0x0178, 0x0378, 0x00F8, 0x02F8, 0x01F8, 0x03F8,
    	0x0004, 0x0204, 0x0104, 0x0304, 0x0084, 0x0284, 0x0184, 0x0384,
    	0x0044, 0x0244, 0x0144, 0x0344, 0x00C4, 0x02C4, 0x01C4, 0x03C4,
    	0x0024, 0x0224, 0x0124, 0x0324, 0x00A4, 0x02A4, 0x01A4, 0x03A4,
    	0x0064, 0x0264, 0x0164, 0x0364, 0x00E4, 0x02E4, 0x01E4, 0x03E4,
    	0x0014, 0x0214, 0x0114, 0x0314, 0x0094, 0x0294, 0x0194, 0x0394,
    	0x0054, 0x0254, 0x0154, 0x0354, 0x00D4, 0x02D4, 0x01D4, 0x03D4,
    	0x0034, 0x0234, 0x0134, 0x0334, 0x00B4, 0x02B4, 0x01B4, 0x03B4,
    	0x0074, 0x0274, 0x0174, 0x0374, 0x00F4, 0x02F4, 0x01F4, 0x03F4,
    	0x000C, 0x020C, 0x010C, 0x030C, 0x008C, 0x028C, 0x018C, 0x038C,
    	0x004C, 0x024C, 0x014C, 0x034C, 0x00CC, 0x02CC, 0x01CC, 0x03CC,
    	0x002C, 0x022C, 0x012C, 0x032C, 0x00AC, 0x02AC, 0x01AC, 0x03AC,
    	0x006C, 0x026C, 0x016C, 0x036C, 0x00EC, 0x02EC, 0x01EC, 0x03EC,
    	0x001C, 0x021C, 0x011C, 0x031C, 0x009C, 0x029C, 0x019C, 0x039C,
    	0x005C, 0x025C, 0x015C, 0x035C, 0x00DC, 0x02DC, 0x01DC, 0x03DC,
    	0x003C, 0x023C, 0x013C, 0x033C, 0x00BC, 0x02BC, 0x01BC, 0x03BC,
    	0x007C, 0x027C, 0x017C, 0x037C, 0x00FC, 0x02FC, 0x01FC, 0x03FC,
    	0x0002, 0x0202, 0x0102, 0x0302, 0x0082, 0x0282, 0x0182, 0x0382,
    	0x0042, 0x0242, 0x0142, 0x0342, 0x00C2, 0x02C2, 0x01C2, 0x03C2,
    	0x0022, 0x0222, 0x0122, 0x0322, 0x00A2, 0x02A2, 0x01A2, 0x03A2,
    	0x0062, 0x0262, 0x0162, 0x0362, 0x00E2, 0x02E2, 0x01E2, 0x03E2,
    	0x0012, 0x0212, 0x0112, 0x0312, 0x0092, 0x0292, 0x0192, 0x0392,
    	0x0052, 0x0252, 0x0152, 0x0352, 0x00D2, 0x02D2, 0x01D2, 0x03D2,
    	0x0032, 0x0232, 0x0132, 0x0332, 0x00B2, 0x02B2, 0x01B2, 0x03B2,
    	0x0072, 0x0272, 0x0172, 0x0372, 0x00F2, 0x02F2, 0x01F2, 0x03F2,
    	0x000A, 0x020A, 0x010A, 0x030A, 0x008A, 0x028A, 0x018A, 0x038A,
    	0x004A, 0x024A, 0x014A, 0x034A, 0x00CA, 0x02CA, 0x01CA, 0x03CA,
    	0x002A, 0x022A, 0x012A, 0x032A, 0x00AA, 0x02AA, 0x01AA, 0x03AA,
    	0x006A, 0x026A, 0x016A, 0x036A, 0x00EA, 0x02EA, 0x01EA, 0x03EA,
    	0x001A, 0x021A, 0x011A, 0x031A, 0x009A, 0x029A, 0x019A, 0x039A,
    	0x005A, 0x025A, 0x015A, 0x035A, 0x00DA, 0x02DA, 0x01DA, 0x03DA,
    	0x003A, 0x023A, 0x013A, 0x033A, 0x00BA, 0x02BA, 0x01BA, 0x03BA,
    	0x007A, 0x027A, 0x017A, 0x037A, 0x00FA, 0x02FA, 0x01FA, 0x03FA,
    	0x0006, 0x0206, 0x0106, 0x0306, 0x0086, 0x0286, 0x0186, 0x0386,
    	0x0046, 0x0246, 0x0146, 0x0346, 0x00C6, 0x02C6, 0x01C6, 0x03C6,
    	0x0026, 0x0226, 0x0126, 0x0326, 0x00A6, 0x02A6, 0x01A6, 0x03A6,
    	0x0066, 0x0266, 0x0166, 0x0366, 0x00E6, 0x02E6, 0x01E6, 0x03E6,
    	0x0016, 0x0216, 0x0116, 0x0316, 0x0096, 0x0296, 0x0196, 0x0396,
    	0x0056, 0x0256, 0x0156, 0x0356, 0x00D6, 0x02D6, 0x01D6, 0x03D6,
    	0x0036, 0x0236, 0x0136, 0x0336, 0x00B6, 0x02B6, 0x01B6, 0x03B6,
    	0x0076, 0x0276, 0x0176, 0x0376, 0x00F6, 0x02F6, 0x01F6, 0x03F6,
    	0x000E, 0x020E, 0x010E, 0x030E, 0x008E, 0x028E, 0x018E, 0x038E,
    	0x004E, 0x024E, 0x014E, 0x034E, 0x00CE, 0x02CE, 0x01CE, 0x03CE,
    	0x002E, 0x022E, 0x012E, 0x032E, 0x00AE, 0x02AE, 0x01AE, 0x03AE,
    	0x006E, 0x026E, 0x016E, 0x036E, 0x00EE, 0x02EE, 0x01EE, 0x03EE,
    	0x001E, 0x021E, 0x011E, 0x031E, 0x009E, 0x029E, 0x019E, 0x039E,
    	0x005E, 0x025E, 0x015E, 0x035E, 0x00DE, 0x02DE, 0x01DE, 0x03DE,
    	0x003E, 0x023E, 0x013E, 0x033E, 0x00BE, 0x02BE, 0x01BE, 0x03BE,
    	0x007E, 0x027E, 0x017E, 0x037E, 0x00FE, 0x02FE, 0x01FE, 0x03FE,
    	0x0001, 0x0201, 0x0101, 0x0301, 0x0081, 0x0281, 0x0181, 0x0381,
    	0x0041, 0x0241, 0x0141, 0x0341, 0x00C1, 0x02C1, 0x01C1, 0x03C1,
    	0x0021, 0x0221, 0x0121, 0x0321, 0x00A1, 0x02A1, 0x01A1, 0x03A1,
    	0x0061, 0x0261, 0x0161, 0x0361, 0x00E1, 0x02E1, 0x01E1, 0x03E1,
    	0x0011, 0x0211, 0x0111, 0x0311, 0x0091, 0x0291, 0x0191, 0x0391,
    	0x0051, 0x0251, 0x0151, 0x0351, 0x00D1, 0x02D1, 0x01D1, 0x03D1,
    	0x0031, 0x0231, 0x0131, 0x0331, 0x00B1, 0x02B1, 0x01B1, 0x03B1,
    	0x0071, 0x0271, 0x0171, 0x0371, 0x00F1, 0x02F1, 0x01F1, 0x03F1,
    	0x0009, 0x0209, 0x0109, 0x0309, 0x0089, 0x0289, 0x0189, 0x0389,
    	0x0049, 0x0249, 0x0149, 0x0349, 0x00C9, 0x02C9, 0x01C9, 0x03C9,
    	0x0029, 0x0229, 0x0129, 0x0329, 0x00A9, 0x02A9, 0x01A9, 0x03A9,
    	0x0069, 0x0269, 0x0169, 0x0369, 0x00E9, 0x02E9, 0x01E9, 0x03E9,
    	0x0019, 0x0219, 0x0119, 0x0319, 0x0099, 0x0299, 0x0199, 0x0399,
    	0x0059, 0x0259, 0x0159, 0x0359, 0x00D9, 0x02D9, 0x01D9, 0x03D9,
    	0x0039, 0x0239, 0x0139, 0x0339, 0x00B9, 0x02B9, 0x01B9, 0x03B9,
    	0x0079, 0x0279, 0x0179, 0x0379, 0x00F9, 0x02F9, 0x01F9, 0x03F9,
    	0x0005, 0x0205, 0x0105, 0x0305, 0x0085, 0x0285, 0x0185, 0x0385,
    	0x0045, 0x0245, 0x0145, 0x0345, 0x00C5, 0x02C5, 0x01C5, 0x03C5,
    	0x0025, 0x0225, 0x0125, 0x0325, 0x00A5, 0x02A5, 0x01A5, 0x03A5,
    	0x0065, 0x0265, 0x0165, 0x0365, 0x00E5, 0x02E5, 0x01E5, 0x03E5,
    	0x0015, 0x0215, 0x0115, 0x0315, 0x0095, 0x0295, 0x0195, 0x0395,
    	0x0055, 0x0255, 0x0155, 0x0355, 0x00D5, 0x02D5, 0x01D5, 0x03D5,
    	0x0035, 0x0235, 0x0135, 0x0335, 0x00B5, 0x02B5, 0x01B5, 0x03B5,
    	0x0075, 0x0275, 0x0175, 0x0375, 0x00F5, 0x02F5, 0x01F5, 0x03F5,
    	0x000D, 0x020D, 0x010D, 0x030D, 0x008D, 0x028D, 0x018D, 0x038D,
    	0x004D, 0x024D, 0x014D, 0x034D, 0x00CD, 0x02CD, 0x01CD, 0x03CD,
    	0x002D, 0x022D, 0x012D, 0x032D, 0x00AD, 0x02AD, 0x01AD, 0x03AD,
    	0x006D, 0x026D, 0x016D, 0x036D, 0x00ED, 0x02ED, 0x01ED, 0x03ED,
    	0x001D, 0x021D, 0x011D, 0x031D, 0x009D, 0x029D, 0x019D, 0x039D,
    	0x005D, 0x025D, 0x015D, 0x035D, 0x00DD, 0x02DD, 0x01DD, 0x03DD,
    	0x003D, 0x023D, 0x013D, 0x033D, 0x00BD, 0x02BD, 0x01BD, 0x03BD,
    	0x007D, 0x027D, 0x017D, 0x037D, 0x00FD, 0x02FD, 0x01FD, 0x03FD,
    	0x0003, 0x0203, 0x0103, 0x0303, 0x0083, 0x0283, 0x0183, 0x0383,
    	0x0043, 0x0243, 0x0143, 0x0343, 0x00C3, 0x02C3, 0x01C3, 0x03C3,
    	0x0023, 0x0223, 0x0123, 0x0323, 0x00A3, 0x02A3, 0x01A3, 0x03A3,
    	0x0063, 0x0263, 0x0163, 0x0363, 0x00E3, 0x02E3, 0x01E3, 0x03E3,
    	0x0013, 0x0213, 0x0113, 0x0313, 0x0093, 0x0293, 0x0193, 0x0393,
    	0x0053, 0x0253, 0x0153, 0x0353, 0x00D3, 0x02D3, 0x01D3, 0x03D3,
    	0x0033, 0x0233, 0x0133, 0x0333, 0x00B3, 0x02B3, 0x01B3, 0x03B3,
    	0x0073, 0x0273, 0x0173, 0x0373, 0x00F3, 0x02F3, 0x01F3, 0x03F3,
    	0x000B, 0x020B, 0x010B, 0x030B, 0x008B, 0x028B, 0x018B, 0x038B,
    	0x004B, 0x024B, 0x014B, 0x034B, 0x00CB, 0x02CB, 0x01CB, 0x03CB,
    	0x002B, 0x022B, 0x012B, 0x032B, 0x00AB, 0x02AB, 0x01AB, 0x03AB,
    	0x006B, 0x026B, 0x016B, 0x036B, 0x00EB, 0x02EB, 0x01EB, 0x03EB,
    	0x001B, 0x021B, 0x011B, 0x031B, 0x009B, 0x029B, 0x019B, 0x039B,
    	0x005B, 0x025B, 0x015B, 0x035B, 0x00DB, 0x02DB, 0x01DB, 0x03DB,
    	0x003B, 0x023B, 0x013B, 0x033B, 0x00BB, 0x02BB, 0x01BB, 0x03BB,
    	0x007B, 0x027B, 0x017B, 0x037B, 0x00FB, 0x02FB, 0x01FB, 0x03FB,
    	0x0007, 0x0207, 0x0107, 0x0307, 0x0087, 0x0287, 0x0187, 0x0387,
    	0x0047, 0x0247, 0x0147, 0x0347, 0x00C7, 0x02C7, 0x01C7, 0x03C7,
    	0x0027, 0x0227, 0x0127, 0x0327, 0x00A7, 0x02A7, 0x01A7, 0x03A7,
    	0x0067, 0x0267, 0x0167, 0x0367, 0x00E7, 0x02E7, 0x01E7, 0x03E7,
    	0x0017, 0x0217, 0x0117, 0x0317, 0x0097, 0x0297, 0x0197, 0x0397,
    	0x0057, 0x0257, 0x0157, 0x0357, 0x00D7, 0x02D7, 0x01D7, 0x03D7,
    	0x0037, 0x0237, 0x0137, 0x0337, 0x00B7, 0x02B7, 0x01B7, 0x03B7,
    	0x0077, 0x0277, 0x0177, 0x0377, 0x00F7, 0x02F7, 0x01F7, 0x03F7,
    	0x000F, 0x020F, 0x010F, 0x030F, 0x008F, 0x028F, 0x018F, 0x038F,
    	0x004F, 0x024F, 0x014F, 0x034F, 0x00CF, 0x02CF, 0x01CF, 0x03CF,
    	0x002F, 0x022F, 0x012F, 0x032F, 0x00AF, 0x02AF, 0x01AF, 0x03AF,
    	0x006F, 0x026F, 0x016F, 0x036F, 0x00EF, 0x02EF, 0x01EF, 0x03EF,
    	0x001F, 0x021F, 0x011F, 0x031F, 0x009F, 0x029F, 0x019F, 0x039F,
    	0x005F, 0x025F, 0x015F, 0x035F, 0x00DF, 0x02DF, 0x01DF, 0x03DF,
    	0x003F, 0x023F, 0x013F, 0x033F, 0x00BF, 0x02BF, 0x01BF, 0x03BF,
    	0x007F, 0x027F, 0x017F, 0x037F, 0x00FF, 0x02FF, 0x01FF, 0x03FF
    };
    
    /* 10-bit twiddle factor lookup table. */
    const uint16_t ui16TwiddleLUT[CFFT_MAX_SIZE*2] = {
    	0x7FFF, 0x0000, 0x7FFF, 0xFF37, 0x7FFE, 0xFE6E, 0x7FFA, 0xFDA5,
    	0x7FF6, 0xFCDC, 0x7FF1, 0xFC13, 0x7FEA, 0xFB4A, 0x7FE2, 0xFA81,
    	0x7FD9, 0xF9B8, 0x7FCE, 0xF8EF, 0x7FC2, 0xF827, 0x7FB5, 0xF75E,
    	0x7FA7, 0xF695, 0x7F98, 0xF5CD, 0x7F87, 0xF505, 0x7F75, 0xF43C,
    	0x7F62, 0xF374, 0x7F4E, 0xF2AC, 0x7F38, 0xF1E4, 0x7F22, 0xF11C,
    	0x7F0A, 0xF055, 0x7EF0, 0xEF8D, 0x7ED6, 0xEEC6, 0x7EBA, 0xEDFF,
    	0x7E9D, 0xED38, 0x7E7F, 0xEC71, 0x7E60, 0xEBAB, 0x7E3F, 0xEAE4,
    	0x7E1E, 0xEA1E, 0x7DFB, 0xE958, 0x7DD6, 0xE892, 0x7DB1, 0xE7CD,
    	0x7D8A, 0xE707, 0x7D63, 0xE642, 0x7D3A, 0xE57D, 0x7D0F, 0xE4B9,
    	0x7CE4, 0xE3F4, 0x7CB7, 0xE330, 0x7C89, 0xE26D, 0x7C5A, 0xE1A9,
    	0x7C2A, 0xE0E6, 0x7BF9, 0xE023, 0x7BC6, 0xDF61, 0x7B92, 0xDE9E,
    	0x7B5D, 0xDDDC, 0x7B27, 0xDD1B, 0x7AEF, 0xDC59, 0x7AB7, 0xDB99,
    	0x7A7D, 0xDAD8, 0x7A42, 0xDA18, 0x7A06, 0xD958, 0x79C9, 0xD898,
    	0x798A, 0xD7D9, 0x794A, 0xD71B, 0x790A, 0xD65C, 0x78C8, 0xD59E,
    	0x7885, 0xD4E1, 0x7840, 0xD424, 0x77FB, 0xD367, 0x77B4, 0xD2AB,
    	0x776C, 0xD1EF, 0x7723, 0xD134, 0x76D9, 0xD079, 0x768E, 0xCFBE,
    	0x7642, 0xCF04, 0x75F4, 0xCE4B, 0x75A6, 0xCD92, 0x7556, 0xCCD9,
    	0x7505, 0xCC21, 0x74B3, 0xCB69, 0x7460, 0xCAB2, 0x740B, 0xC9FC,
    	0x73B6, 0xC946, 0x735F, 0xC890, 0x7308, 0xC7DB, 0x72AF, 0xC727,
    	0x7255, 0xC673, 0x71FA, 0xC5C0, 0x719E, 0xC50D, 0x7141, 0xC45B,
    	0x70E3, 0xC3A9, 0x7083, 0xC2F8, 0x7023, 0xC248, 0x6FC2, 0xC198,
    	0x6F5F, 0xC0E9, 0x6EFB, 0xC03A, 0x6E97, 0xBF8C, 0x6E31, 0xBEDF,
    	0x6DCA, 0xBE32, 0x6D62, 0xBD86, 0x6CF9, 0xBCDA, 0x6C8F, 0xBC2F,
    	0x6C24, 0xBB85, 0x6BB8, 0xBADC, 0x6B4B, 0xBA33, 0x6ADD, 0xB98B,
    	0x6A6E, 0xB8E3, 0x69FD, 0xB83C, 0x698C, 0xB796, 0x691A, 0xB6F1,
    	0x68A7, 0xB64C, 0x6832, 0xB5A8, 0x67BD, 0xB505, 0x6747, 0xB462,
    	0x66D0, 0xB3C0, 0x6657, 0xB31F, 0x65DE, 0xB27F, 0x6564, 0xB1DF,
    	0x64E9, 0xB140, 0x646C, 0xB0A2, 0x63EF, 0xB005, 0x6371, 0xAF68,
    	0x62F2, 0xAECC, 0x6272, 0xAE31, 0x61F1, 0xAD97, 0x616F, 0xACFD,
    	0x60EC, 0xAC65, 0x6068, 0xABCD, 0x5FE4, 0xAB36, 0x5F5E, 0xAAA0,
    	0x5ED7, 0xAA0A, 0x5E50, 0xA976, 0x5DC8, 0xA8E2, 0x5D3E, 0xA84F,
    	0x5CB4, 0xA7BD, 0x5C29, 0xA72C, 0x5B9D, 0xA69C, 0x5B10, 0xA60C,
    	0x5A82, 0xA57E, 0x59F4, 0xA4F0, 0x5964, 0xA463, 0x58D4, 0xA3D7,
    	0x5843, 0xA34C, 0x57B1, 0xA2C2, 0x571E, 0xA238, 0x568A, 0xA1B0,
    	0x55F6, 0xA129, 0x5560, 0xA0A2, 0x54CA, 0xA01C, 0x5433, 0x9F98,
    	0x539B, 0x9F14, 0x5303, 0x9E91, 0x5269, 0x9E0F, 0x51CF, 0x9D8E,
    	0x5134, 0x9D0E, 0x5098, 0x9C8F, 0x4FFB, 0x9C11, 0x4F5E, 0x9B94,
    	0x4EC0, 0x9B17, 0x4E21, 0x9A9C, 0x4D81, 0x9A22, 0x4CE1, 0x99A9,
    	0x4C40, 0x9930, 0x4B9E, 0x98B9, 0x4AFB, 0x9843, 0x4A58, 0x97CE,
    	0x49B4, 0x9759, 0x490F, 0x96E6, 0x486A, 0x9674, 0x47C4, 0x9603,
    	0x471D, 0x9592, 0x4675, 0x9523, 0x45CD, 0x94B5, 0x4524, 0x9448,
    	0x447B, 0x93DC, 0x43D1, 0x9371, 0x4326, 0x9307, 0x427A, 0x929E,
    	0x41CE, 0x9236, 0x4121, 0x91CF, 0x4074, 0x9169, 0x3FC6, 0x9105,
    	0x3F17, 0x90A1, 0x3E68, 0x903E, 0x3DB8, 0x8FDD, 0x3D08, 0x8F7D,
    	0x3C57, 0x8F1D, 0x3BA5, 0x8EBF, 0x3AF3, 0x8E62, 0x3A40, 0x8E06,
    	0x398D, 0x8DAB, 0x38D9, 0x8D51, 0x3825, 0x8CF8, 0x3770, 0x8CA1,
    	0x36BA, 0x8C4A, 0x3604, 0x8BF5, 0x354E, 0x8BA0, 0x3497, 0x8B4D,
    	0x33DF, 0x8AFB, 0x3327, 0x8AAA, 0x326E, 0x8A5A, 0x31B5, 0x8A0C,
    	0x30FC, 0x89BE, 0x3042, 0x8972, 0x2F87, 0x8927, 0x2ECC, 0x88DD,
    	0x2E11, 0x8894, 0x2D55, 0x884C, 0x2C99, 0x8805, 0x2BDC, 0x87C0,
    	0x2B1F, 0x877B, 0x2A62, 0x8738, 0x29A4, 0x86F6, 0x28E5, 0x86B6,
    	0x2827, 0x8676, 0x2768, 0x8637, 0x26A8, 0x85FA, 0x25E8, 0x85BE,
    	0x2528, 0x8583, 0x2467, 0x8549, 0x23A7, 0x8511, 0x22E5, 0x84D9,
    	0x2224, 0x84A3, 0x2162, 0x846E, 0x209F, 0x843A, 0x1FDD, 0x8407,
    	0x1F1A, 0x83D6, 0x1E57, 0x83A6, 0x1D93, 0x8377, 0x1CD0, 0x8349,
    	0x1C0C, 0x831C, 0x1B47, 0x82F1, 0x1A83, 0x82C6, 0x19BE, 0x829D,
    	0x18F9, 0x8276, 0x1833, 0x824F, 0x176E, 0x822A, 0x16A8, 0x8205,
    	0x15E2, 0x81E2, 0x151C, 0x81C1, 0x1455, 0x81A0, 0x138F, 0x8181,
    	0x12C8, 0x8163, 0x1201, 0x8146, 0x113A, 0x812A, 0x1073, 0x8110,
    	0x0FAB, 0x80F6, 0x0EE4, 0x80DE, 0x0E1C, 0x80C8, 0x0D54, 0x80B2,
    	0x0C8C, 0x809E, 0x0BC4, 0x808B, 0x0AFB, 0x8079, 0x0A33, 0x8068,
    	0x096B, 0x8059, 0x08A2, 0x804B, 0x07D9, 0x803E, 0x0711, 0x8032,
    	0x0648, 0x8027, 0x057F, 0x801E, 0x04B6, 0x8016, 0x03ED, 0x800F,
    	0x0324, 0x800A, 0x025B, 0x8006, 0x0192, 0x8002, 0x00C9, 0x8001,
    	0x0000, 0x8001, 0xFF37, 0x8001, 0xFE6E, 0x8002, 0xFDA5, 0x8006,
    	0xFCDC, 0x800A, 0xFC13, 0x800F, 0xFB4A, 0x8016, 0xFA81, 0x801E,
    	0xF9B8, 0x8027, 0xF8EF, 0x8032, 0xF827, 0x803E, 0xF75E, 0x804B,
    	0xF695, 0x8059, 0xF5CD, 0x8068, 0xF505, 0x8079, 0xF43C, 0x808B,
    	0xF374, 0x809E, 0xF2AC, 0x80B2, 0xF1E4, 0x80C8, 0xF11C, 0x80DE,
    	0xF055, 0x80F6, 0xEF8D, 0x8110, 0xEEC6, 0x812A, 0xEDFF, 0x8146,
    	0xED38, 0x8163, 0xEC71, 0x8181, 0xEBAB, 0x81A0, 0xEAE4, 0x81C1,
    	0xEA1E, 0x81E2, 0xE958, 0x8205, 0xE892, 0x822A, 0xE7CD, 0x824F,
    	0xE707, 0x8276, 0xE642, 0x829D, 0xE57D, 0x82C6, 0xE4B9, 0x82F1,
    	0xE3F4, 0x831C, 0xE330, 0x8349, 0xE26D, 0x8377, 0xE1A9, 0x83A6,
    	0xE0E6, 0x83D6, 0xE023, 0x8407, 0xDF61, 0x843A, 0xDE9E, 0x846E,
    	0xDDDC, 0x84A3, 0xDD1B, 0x84D9, 0xDC59, 0x8511, 0xDB99, 0x8549,
    	0xDAD8, 0x8583, 0xDA18, 0x85BE, 0xD958, 0x85FA, 0xD898, 0x8637,
    	0xD7D9, 0x8676, 0xD71B, 0x86B6, 0xD65C, 0x86F6, 0xD59E, 0x8738,
    	0xD4E1, 0x877B, 0xD424, 0x87C0, 0xD367, 0x8805, 0xD2AB, 0x884C,
    	0xD1EF, 0x8894, 0xD134, 0x88DD, 0xD079, 0x8927, 0xCFBE, 0x8972,
    	0xCF04, 0x89BE, 0xCE4B, 0x8A0C, 0xCD92, 0x8A5A, 0xCCD9, 0x8AAA,
    	0xCC21, 0x8AFB, 0xCB69, 0x8B4D, 0xCAB2, 0x8BA0, 0xC9FC, 0x8BF5,
    	0xC946, 0x8C4A, 0xC890, 0x8CA1, 0xC7DB, 0x8CF8, 0xC727, 0x8D51,
    	0xC673, 0x8DAB, 0xC5C0, 0x8E06, 0xC50D, 0x8E62, 0xC45B, 0x8EBF,
    	0xC3A9, 0x8F1D, 0xC2F8, 0x8F7D, 0xC248, 0x8FDD, 0xC198, 0x903E,
    	0xC0E9, 0x90A1, 0xC03A, 0x9105, 0xBF8C, 0x9169, 0xBEDF, 0x91CF,
    	0xBE32, 0x9236, 0xBD86, 0x929E, 0xBCDA, 0x9307, 0xBC2F, 0x9371,
    	0xBB85, 0x93DC, 0xBADC, 0x9448, 0xBA33, 0x94B5, 0xB98B, 0x9523,
    	0xB8E3, 0x9592, 0xB83C, 0x9603, 0xB796, 0x9674, 0xB6F1, 0x96E6,
    	0xB64C, 0x9759, 0xB5A8, 0x97CE, 0xB505, 0x9843, 0xB462, 0x98B9,
    	0xB3C0, 0x9930, 0xB31F, 0x99A9, 0xB27F, 0x9A22, 0xB1DF, 0x9A9C,
    	0xB140, 0x9B17, 0xB0A2, 0x9B94, 0xB005, 0x9C11, 0xAF68, 0x9C8F,
    	0xAECC, 0x9D0E, 0xAE31, 0x9D8E, 0xAD97, 0x9E0F, 0xACFD, 0x9E91,
    	0xAC65, 0x9F14, 0xABCD, 0x9F98, 0xAB36, 0xA01C, 0xAAA0, 0xA0A2,
    	0xAA0A, 0xA129, 0xA976, 0xA1B0, 0xA8E2, 0xA238, 0xA84F, 0xA2C2,
    	0xA7BD, 0xA34C, 0xA72C, 0xA3D7, 0xA69C, 0xA463, 0xA60C, 0xA4F0,
    	0xA57E, 0xA57E, 0xA4F0, 0xA60C, 0xA463, 0xA69C, 0xA3D7, 0xA72C,
    	0xA34C, 0xA7BD, 0xA2C2, 0xA84F, 0xA238, 0xA8E2, 0xA1B0, 0xA976,
    	0xA129, 0xAA0A, 0xA0A2, 0xAAA0, 0xA01C, 0xAB36, 0x9F98, 0xABCD,
    	0x9F14, 0xAC65, 0x9E91, 0xACFD, 0x9E0F, 0xAD97, 0x9D8E, 0xAE31,
    	0x9D0E, 0xAECC, 0x9C8F, 0xAF68, 0x9C11, 0xB005, 0x9B94, 0xB0A2,
    	0x9B17, 0xB140, 0x9A9C, 0xB1DF, 0x9A22, 0xB27F, 0x99A9, 0xB31F,
    	0x9930, 0xB3C0, 0x98B9, 0xB462, 0x9843, 0xB505, 0x97CE, 0xB5A8,
    	0x9759, 0xB64C, 0x96E6, 0xB6F1, 0x9674, 0xB796, 0x9603, 0xB83C,
    	0x9592, 0xB8E3, 0x9523, 0xB98B, 0x94B5, 0xBA33, 0x9448, 0xBADC,
    	0x93DC, 0xBB85, 0x9371, 0xBC2F, 0x9307, 0xBCDA, 0x929E, 0xBD86,
    	0x9236, 0xBE32, 0x91CF, 0xBEDF, 0x9169, 0xBF8C, 0x9105, 0xC03A,
    	0x90A1, 0xC0E9, 0x903E, 0xC198, 0x8FDD, 0xC248, 0x8F7D, 0xC2F8,
    	0x8F1D, 0xC3A9, 0x8EBF, 0xC45B, 0x8E62, 0xC50D, 0x8E06, 0xC5C0,
    	0x8DAB, 0xC673, 0x8D51, 0xC727, 0x8CF8, 0xC7DB, 0x8CA1, 0xC890,
    	0x8C4A, 0xC946, 0x8BF5, 0xC9FC, 0x8BA0, 0xCAB2, 0x8B4D, 0xCB69,
    	0x8AFB, 0xCC21, 0x8AAA, 0xCCD9, 0x8A5A, 0xCD92, 0x8A0C, 0xCE4B,
    	0x89BE, 0xCF04, 0x8972, 0xCFBE, 0x8927, 0xD079, 0x88DD, 0xD134,
    	0x8894, 0xD1EF, 0x884C, 0xD2AB, 0x8805, 0xD367, 0x87C0, 0xD424,
    	0x877B, 0xD4E1, 0x8738, 0xD59E, 0x86F6, 0xD65C, 0x86B6, 0xD71B,
    	0x8676, 0xD7D9, 0x8637, 0xD898, 0x85FA, 0xD958, 0x85BE, 0xDA18,
    	0x8583, 0xDAD8, 0x8549, 0xDB99, 0x8511, 0xDC59, 0x84D9, 0xDD1B,
    	0x84A3, 0xDDDC, 0x846E, 0xDE9E, 0x843A, 0xDF61, 0x8407, 0xE023,
    	0x83D6, 0xE0E6, 0x83A6, 0xE1A9, 0x8377, 0xE26D, 0x8349, 0xE330,
    	0x831C, 0xE3F4, 0x82F1, 0xE4B9, 0x82C6, 0xE57D, 0x829D, 0xE642,
    	0x8276, 0xE707, 0x824F, 0xE7CD, 0x822A, 0xE892, 0x8205, 0xE958,
    	0x81E2, 0xEA1E, 0x81C1, 0xEAE4, 0x81A0, 0xEBAB, 0x8181, 0xEC71,
    	0x8163, 0xED38, 0x8146, 0xEDFF, 0x812A, 0xEEC6, 0x8110, 0xEF8D,
    	0x80F6, 0xF055, 0x80DE, 0xF11C, 0x80C8, 0xF1E4, 0x80B2, 0xF2AC,
    	0x809E, 0xF374, 0x808B, 0xF43C, 0x8079, 0xF505, 0x8068, 0xF5CD,
    	0x8059, 0xF695, 0x804B, 0xF75E, 0x803E, 0xF827, 0x8032, 0xF8EF,
    	0x8027, 0xF9B8, 0x801E, 0xFA81, 0x8016, 0xFB4A, 0x800F, 0xFC13,
    	0x800A, 0xFCDC, 0x8006, 0xFDA5, 0x8002, 0xFE6E, 0x8001, 0xFF37,
    	0x8001, 0x0000, 0x8001, 0x00C9, 0x8002, 0x0192, 0x8006, 0x025B,
    	0x800A, 0x0324, 0x800F, 0x03ED, 0x8016, 0x04B6, 0x801E, 0x057F,
    	0x8027, 0x0648, 0x8032, 0x0711, 0x803E, 0x07D9, 0x804B, 0x08A2,
    	0x8059, 0x096B, 0x8068, 0x0A33, 0x8079, 0x0AFB, 0x808B, 0x0BC4,
    	0x809E, 0x0C8C, 0x80B2, 0x0D54, 0x80C8, 0x0E1C, 0x80DE, 0x0EE4,
    	0x80F6, 0x0FAB, 0x8110, 0x1073, 0x812A, 0x113A, 0x8146, 0x1201,
    	0x8163, 0x12C8, 0x8181, 0x138F, 0x81A0, 0x1455, 0x81C1, 0x151C,
    	0x81E2, 0x15E2, 0x8205, 0x16A8, 0x822A, 0x176E, 0x824F, 0x1833,
    	0x8276, 0x18F9, 0x829D, 0x19BE, 0x82C6, 0x1A83, 0x82F1, 0x1B47,
    	0x831C, 0x1C0C, 0x8349, 0x1CD0, 0x8377, 0x1D93, 0x83A6, 0x1E57,
    	0x83D6, 0x1F1A, 0x8407, 0x1FDD, 0x843A, 0x209F, 0x846E, 0x2162,
    	0x84A3, 0x2224, 0x84D9, 0x22E5, 0x8511, 0x23A7, 0x8549, 0x2467,
    	0x8583, 0x2528, 0x85BE, 0x25E8, 0x85FA, 0x26A8, 0x8637, 0x2768,
    	0x8676, 0x2827, 0x86B6, 0x28E5, 0x86F6, 0x29A4, 0x8738, 0x2A62,
    	0x877B, 0x2B1F, 0x87C0, 0x2BDC, 0x8805, 0x2C99, 0x884C, 0x2D55,
    	0x8894, 0x2E11, 0x88DD, 0x2ECC, 0x8927, 0x2F87, 0x8972, 0x3042,
    	0x89BE, 0x30FC, 0x8A0C, 0x31B5, 0x8A5A, 0x326E, 0x8AAA, 0x3327,
    	0x8AFB, 0x33DF, 0x8B4D, 0x3497, 0x8BA0, 0x354E, 0x8BF5, 0x3604,
    	0x8C4A, 0x36BA, 0x8CA1, 0x3770, 0x8CF8, 0x3825, 0x8D51, 0x38D9,
    	0x8DAB, 0x398D, 0x8E06, 0x3A40, 0x8E62, 0x3AF3, 0x8EBF, 0x3BA5,
    	0x8F1D, 0x3C57, 0x8F7D, 0x3D08, 0x8FDD, 0x3DB8, 0x903E, 0x3E68,
    	0x90A1, 0x3F17, 0x9105, 0x3FC6, 0x9169, 0x4074, 0x91CF, 0x4121,
    	0x9236, 0x41CE, 0x929E, 0x427A, 0x9307, 0x4326, 0x9371, 0x43D1,
    	0x93DC, 0x447B, 0x9448, 0x4524, 0x94B5, 0x45CD, 0x9523, 0x4675,
    	0x9592, 0x471D, 0x9603, 0x47C4, 0x9674, 0x486A, 0x96E6, 0x490F,
    	0x9759, 0x49B4, 0x97CE, 0x4A58, 0x9843, 0x4AFB, 0x98B9, 0x4B9E,
    	0x9930, 0x4C40, 0x99A9, 0x4CE1, 0x9A22, 0x4D81, 0x9A9C, 0x4E21,
    	0x9B17, 0x4EC0, 0x9B94, 0x4F5E, 0x9C11, 0x4FFB, 0x9C8F, 0x5098,
    	0x9D0E, 0x5134, 0x9D8E, 0x51CF, 0x9E0F, 0x5269, 0x9E91, 0x5303,
    	0x9F14, 0x539B, 0x9F98, 0x5433, 0xA01C, 0x54CA, 0xA0A2, 0x5560,
    	0xA129, 0x55F6, 0xA1B0, 0x568A, 0xA238, 0x571E, 0xA2C2, 0x57B1,
    	0xA34C, 0x5843, 0xA3D7, 0x58D4, 0xA463, 0x5964, 0xA4F0, 0x59F4,
    	0xA57E, 0x5A82, 0xA60C, 0x5B10, 0xA69C, 0x5B9D, 0xA72C, 0x5C29,
    	0xA7BD, 0x5CB4, 0xA84F, 0x5D3E, 0xA8E2, 0x5DC8, 0xA976, 0x5E50,
    	0xAA0A, 0x5ED7, 0xAAA0, 0x5F5E, 0xAB36, 0x5FE4, 0xABCD, 0x6068,
    	0xAC65, 0x60EC, 0xACFD, 0x616F, 0xAD97, 0x61F1, 0xAE31, 0x6272,
    	0xAECC, 0x62F2, 0xAF68, 0x6371, 0xB005, 0x63EF, 0xB0A2, 0x646C,
    	0xB140, 0x64E9, 0xB1DF, 0x6564, 0xB27F, 0x65DE, 0xB31F, 0x6657,
    	0xB3C0, 0x66D0, 0xB462, 0x6747, 0xB505, 0x67BD, 0xB5A8, 0x6832,
    	0xB64C, 0x68A7, 0xB6F1, 0x691A, 0xB796, 0x698C, 0xB83C, 0x69FD,
    	0xB8E3, 0x6A6E, 0xB98B, 0x6ADD, 0xBA33, 0x6B4B, 0xBADC, 0x6BB8,
    	0xBB85, 0x6C24, 0xBC2F, 0x6C8F, 0xBCDA, 0x6CF9, 0xBD86, 0x6D62,
    	0xBE32, 0x6DCA, 0xBEDF, 0x6E31, 0xBF8C, 0x6E97, 0xC03A, 0x6EFB,
    	0xC0E9, 0x6F5F, 0xC198, 0x6FC2, 0xC248, 0x7023, 0xC2F8, 0x7083,
    	0xC3A9, 0x70E3, 0xC45B, 0x7141, 0xC50D, 0x719E, 0xC5C0, 0x71FA,
    	0xC673, 0x7255, 0xC727, 0x72AF, 0xC7DB, 0x7308, 0xC890, 0x735F,
    	0xC946, 0x73B6, 0xC9FC, 0x740B, 0xCAB2, 0x7460, 0xCB69, 0x74B3,
    	0xCC21, 0x7505, 0xCCD9, 0x7556, 0xCD92, 0x75A6, 0xCE4B, 0x75F4,
    	0xCF04, 0x7642, 0xCFBE, 0x768E, 0xD079, 0x76D9, 0xD134, 0x7723,
    	0xD1EF, 0x776C, 0xD2AB, 0x77B4, 0xD367, 0x77FB, 0xD424, 0x7840,
    	0xD4E1, 0x7885, 0xD59E, 0x78C8, 0xD65C, 0x790A, 0xD71B, 0x794A,
    	0xD7D9, 0x798A, 0xD898, 0x79C9, 0xD958, 0x7A06, 0xDA18, 0x7A42,
    	0xDAD8, 0x7A7D, 0xDB99, 0x7AB7, 0xDC59, 0x7AEF, 0xDD1B, 0x7B27,
    	0xDDDC, 0x7B5D, 0xDE9E, 0x7B92, 0xDF61, 0x7BC6, 0xE023, 0x7BF9,
    	0xE0E6, 0x7C2A, 0xE1A9, 0x7C5A, 0xE26D, 0x7C89, 0xE330, 0x7CB7,
    	0xE3F4, 0x7CE4, 0xE4B9, 0x7D0F, 0xE57D, 0x7D3A, 0xE642, 0x7D63,
    	0xE707, 0x7D8A, 0xE7CD, 0x7DB1, 0xE892, 0x7DD6, 0xE958, 0x7DFB,
    	0xEA1E, 0x7E1E, 0xEAE4, 0x7E3F, 0xEBAB, 0x7E60, 0xEC71, 0x7E7F,
    	0xED38, 0x7E9D, 0xEDFF, 0x7EBA, 0xEEC6, 0x7ED6, 0xEF8D, 0x7EF0,
    	0xF055, 0x7F0A, 0xF11C, 0x7F22, 0xF1E4, 0x7F38, 0xF2AC, 0x7F4E,
    	0xF374, 0x7F62, 0xF43C, 0x7F75, 0xF505, 0x7F87, 0xF5CD, 0x7F98,
    	0xF695, 0x7FA7, 0xF75E, 0x7FB5, 0xF827, 0x7FC2, 0xF8EF, 0x7FCE,
    	0xF9B8, 0x7FD9, 0xFA81, 0x7FE2, 0xFB4A, 0x7FEA, 0xFC13, 0x7FF1,
    	0xFCDC, 0x7FF6, 0xFDA5, 0x7FFA, 0xFE6E, 0x7FFE, 0xFF37, 0x7FFF,
    	0x0000, 0x7FFF, 0x00C9, 0x7FFF, 0x0192, 0x7FFE, 0x025B, 0x7FFA,
    	0x0324, 0x7FF6, 0x03ED, 0x7FF1, 0x04B6, 0x7FEA, 0x057F, 0x7FE2,
    	0x0648, 0x7FD9, 0x0711, 0x7FCE, 0x07D9, 0x7FC2, 0x08A2, 0x7FB5,
    	0x096B, 0x7FA7, 0x0A33, 0x7F98, 0x0AFB, 0x7F87, 0x0BC4, 0x7F75,
    	0x0C8C, 0x7F62, 0x0D54, 0x7F4E, 0x0E1C, 0x7F38, 0x0EE4, 0x7F22,
    	0x0FAB, 0x7F0A, 0x1073, 0x7EF0, 0x113A, 0x7ED6, 0x1201, 0x7EBA,
    	0x12C8, 0x7E9D, 0x138F, 0x7E7F, 0x1455, 0x7E60, 0x151C, 0x7E3F,
    	0x15E2, 0x7E1E, 0x16A8, 0x7DFB, 0x176E, 0x7DD6, 0x1833, 0x7DB1,
    	0x18F9, 0x7D8A, 0x19BE, 0x7D63, 0x1A83, 0x7D3A, 0x1B47, 0x7D0F,
    	0x1C0C, 0x7CE4, 0x1CD0, 0x7CB7, 0x1D93, 0x7C89, 0x1E57, 0x7C5A,
    	0x1F1A, 0x7C2A, 0x1FDD, 0x7BF9, 0x209F, 0x7BC6, 0x2162, 0x7B92,
    	0x2224, 0x7B5D, 0x22E5, 0x7B27, 0x23A7, 0x7AEF, 0x2467, 0x7AB7,
    	0x2528, 0x7A7D, 0x25E8, 0x7A42, 0x26A8, 0x7A06, 0x2768, 0x79C9,
    	0x2827, 0x798A, 0x28E5, 0x794A, 0x29A4, 0x790A, 0x2A62, 0x78C8,
    	0x2B1F, 0x7885, 0x2BDC, 0x7840, 0x2C99, 0x77FB, 0x2D55, 0x77B4,
    	0x2E11, 0x776C, 0x2ECC, 0x7723, 0x2F87, 0x76D9, 0x3042, 0x768E,
    	0x30FC, 0x7642, 0x31B5, 0x75F4, 0x326E, 0x75A6, 0x3327, 0x7556,
    	0x33DF, 0x7505, 0x3497, 0x74B3, 0x354E, 0x7460, 0x3604, 0x740B,
    	0x36BA, 0x73B6, 0x3770, 0x735F, 0x3825, 0x7308, 0x38D9, 0x72AF,
    	0x398D, 0x7255, 0x3A40, 0x71FA, 0x3AF3, 0x719E, 0x3BA5, 0x7141,
    	0x3C57, 0x70E3, 0x3D08, 0x7083, 0x3DB8, 0x7023, 0x3E68, 0x6FC2,
    	0x3F17, 0x6F5F, 0x3FC6, 0x6EFB, 0x4074, 0x6E97, 0x4121, 0x6E31,
    	0x41CE, 0x6DCA, 0x427A, 0x6D62, 0x4326, 0x6CF9, 0x43D1, 0x6C8F,
    	0x447B, 0x6C24, 0x4524, 0x6BB8, 0x45CD, 0x6B4B, 0x4675, 0x6ADD,
    	0x471D, 0x6A6E, 0x47C4, 0x69FD, 0x486A, 0x698C, 0x490F, 0x691A,
    	0x49B4, 0x68A7, 0x4A58, 0x6832, 0x4AFB, 0x67BD, 0x4B9E, 0x6747,
    	0x4C40, 0x66D0, 0x4CE1, 0x6657, 0x4D81, 0x65DE, 0x4E21, 0x6564,
    	0x4EC0, 0x64E9, 0x4F5E, 0x646C, 0x4FFB, 0x63EF, 0x5098, 0x6371,
    	0x5134, 0x62F2, 0x51CF, 0x6272, 0x5269, 0x61F1, 0x5303, 0x616F,
    	0x539B, 0x60EC, 0x5433, 0x6068, 0x54CA, 0x5FE4, 0x5560, 0x5F5E,
    	0x55F6, 0x5ED7, 0x568A, 0x5E50, 0x571E, 0x5DC8, 0x57B1, 0x5D3E,
    	0x5843, 0x5CB4, 0x58D4, 0x5C29, 0x5964, 0x5B9D, 0x59F4, 0x5B10,
    	0x5A82, 0x5A82, 0x5B10, 0x59F4, 0x5B9D, 0x5964, 0x5C29, 0x58D4,
    	0x5CB4, 0x5843, 0x5D3E, 0x57B1, 0x5DC8, 0x571E, 0x5E50, 0x568A,
    	0x5ED7, 0x55F6, 0x5F5E, 0x5560, 0x5FE4, 0x54CA, 0x6068, 0x5433,
    	0x60EC, 0x539B, 0x616F, 0x5303, 0x61F1, 0x5269, 0x6272, 0x51CF,
    	0x62F2, 0x5134, 0x6371, 0x5098, 0x63EF, 0x4FFB, 0x646C, 0x4F5E,
    	0x64E9, 0x4EC0, 0x6564, 0x4E21, 0x65DE, 0x4D81, 0x6657, 0x4CE1,
    	0x66D0, 0x4C40, 0x6747, 0x4B9E, 0x67BD, 0x4AFB, 0x6832, 0x4A58,
    	0x68A7, 0x49B4, 0x691A, 0x490F, 0x698C, 0x486A, 0x69FD, 0x47C4,
    	0x6A6E, 0x471D, 0x6ADD, 0x4675, 0x6B4B, 0x45CD, 0x6BB8, 0x4524,
    	0x6C24, 0x447B, 0x6C8F, 0x43D1, 0x6CF9, 0x4326, 0x6D62, 0x427A,
    	0x6DCA, 0x41CE, 0x6E31, 0x4121, 0x6E97, 0x4074, 0x6EFB, 0x3FC6,
    	0x6F5F, 0x3F17, 0x6FC2, 0x3E68, 0x7023, 0x3DB8, 0x7083, 0x3D08,
    	0x70E3, 0x3C57, 0x7141, 0x3BA5, 0x719E, 0x3AF3, 0x71FA, 0x3A40,
    	0x7255, 0x398D, 0x72AF, 0x38D9, 0x7308, 0x3825, 0x735F, 0x3770,
    	0x73B6, 0x36BA, 0x740B, 0x3604, 0x7460, 0x354E, 0x74B3, 0x3497,
    	0x7505, 0x33DF, 0x7556, 0x3327, 0x75A6, 0x326E, 0x75F4, 0x31B5,
    	0x7642, 0x30FC, 0x768E, 0x3042, 0x76D9, 0x2F87, 0x7723, 0x2ECC,
    	0x776C, 0x2E11, 0x77B4, 0x2D55, 0x77FB, 0x2C99, 0x7840, 0x2BDC,
    	0x7885, 0x2B1F, 0x78C8, 0x2A62, 0x790A, 0x29A4, 0x794A, 0x28E5,
    	0x798A, 0x2827, 0x79C9, 0x2768, 0x7A06, 0x26A8, 0x7A42, 0x25E8,
    	0x7A7D, 0x2528, 0x7AB7, 0x2467, 0x7AEF, 0x23A7, 0x7B27, 0x22E5,
    	0x7B5D, 0x2224, 0x7B92, 0x2162, 0x7BC6, 0x209F, 0x7BF9, 0x1FDD,
    	0x7C2A, 0x1F1A, 0x7C5A, 0x1E57, 0x7C89, 0x1D93, 0x7CB7, 0x1CD0,
    	0x7CE4, 0x1C0C, 0x7D0F, 0x1B47, 0x7D3A, 0x1A83, 0x7D63, 0x19BE,
    	0x7D8A, 0x18F9, 0x7DB1, 0x1833, 0x7DD6, 0x176E, 0x7DFB, 0x16A8,
    	0x7E1E, 0x15E2, 0x7E3F, 0x151C, 0x7E60, 0x1455, 0x7E7F, 0x138F,
    	0x7E9D, 0x12C8, 0x7EBA, 0x1201, 0x7ED6, 0x113A, 0x7EF0, 0x1073,
    	0x7F0A, 0x0FAB, 0x7F22, 0x0EE4, 0x7F38, 0x0E1C, 0x7F4E, 0x0D54,
    	0x7F62, 0x0C8C, 0x7F75, 0x0BC4, 0x7F87, 0x0AFB, 0x7F98, 0x0A33,
    	0x7FA7, 0x096B, 0x7FB5, 0x08A2, 0x7FC2, 0x07D9, 0x7FCE, 0x0711,
    	0x7FD9, 0x0648, 0x7FE2, 0x057F, 0x7FEA, 0x04B6, 0x7FF1, 0x03ED,
    	0x7FF6, 0x0324, 0x7FFA, 0x025B, 0x7FFE, 0x0192, 0x7FFF, 0x00C9
    };
    

  • Hi Brent,

    Thanks a lot! Although I spent some time solving the problem that the size of object code is too much, it works!!

    You are sooo kind and helpful. Thank you very much!

    Best Regards,

    Jenny

  • Hi Brent,
    I move the function cFFT_LUT and related look up tables in this code into my project and have some tests. However, it seems CCE runs too slowly that it takes me almost 20 secs to get one result (I would like to calculate the average frequency). Do you know how to enhance the speed in CCE? Or just have this file able to be run in IAR? (Since we test the code using 256pts in IAR and the speed is further faster than in CCE. We guess that maybe when we change to use IAR, it could take less time. However, the code with 1024pts cannot be run on IAR. It can only be compiled.)  

    Thanks for your help again.

    Regards,
    Jenny

  • Hi, thanks for your help!

    I'm trying to use this code you gave, but I'm having some problems. When I try to build it, CCS gives me these errors:

    Description Resource Path Location Type
    unresolved symbol _Q12atan2, first referenced in ./main.obj DDS_ADC12_teste C/C++ Problem
    unresolved symbol _Q12cos, first referenced in ./main.obj DDS_ADC12_teste C/C++ Problem
    unresolved symbol _Q12div, first referenced in ./main.obj DDS_ADC12_teste C/C++ Problem
    unresolved symbol _Q12mpy, first referenced in ./main.obj DDS_ADC12_teste C/C++ Problem
    unresolved symbol _Qmag, first referenced in ./main.obj DDS_ADC12_teste C/C++ Problem


    Am I doing something wrong?

    Thank you for your time,

    Regards,

    Carlos Loura

  • Hi Carlos,

    The FFT routine I posted is intended to be used with the IQmath libraries for MSP430. You can download the libraries at the link below and follow the instructions to create an empty project or add the libraries to an existing project with the above c routine.

    www.ti.com/.../msp-iqmathlib

    Regards,
    Brent Peterson
  • Hi, you were right (of course), I forgot to drag and drop the library files to my project.

    Thank you so very much for your help,

    Best Regards,

    Carlos Loura
  • Hi, this code calculates the FFT of a wave with stipulated frequency, magnitude and phase. Is it possible to make it calculate the FFT of an array? (Like the FFT function of Matlab)


    Regards,

    Carlos Loura

**Attention** This is a public forum