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 time

Other Parts Discussed in Thread: MSP-DSPLIB, CC430F5137

Hello,

Thank you very much for your help. Can you tell me please how much time approximately CC430F5137  at 20 MHZ needs to calculate 512 pts FFT!

Best,

  • Hello Marwa,

    TI does not benchmark FFT functionality with their MCU devices but this tutorial implies a 512-point FFT execution time of 8.9 ms with integer (16-bit) math and a 25 MHz MCLK rate: www.fftdesigner.com/.../

    Assuming frequency dependency is linear you could expect ~11.125 ms with a MCLK of 20 MHz.

    Regards,
    Ryan
  • Hello,

    Thank you so much. In the begining I choose the FFTD1A because it has the most faster MSP 430 . Unfortunately I don't find its cost and if it is possible to buy it !

  • It appears to be an older EVM that is no longer in stock, it was not sold or supported by TI.

    Regards,
    Ryan
  • Hello,

    Thank you , but can I estimate this time even it is not the same microcontroller because the MSP of the FFTDesigner has not the same characteristics as CC430F5173 !

    Best,
  • Hence the adjustment of MCLK in my original post.

    Regards,
    Ryan
  • TI also now offers the MSP-DSPLIB which includes code to run FFT on all MSP430 devices. The attached example “transform_ex1_fft_fixed_q15” can be modified to run and benchmark a 512-point real FFT, using this on a FR5969 device produced 143616 cycles for 512-point 16-bit FFT. 

    /* --COPYRIGHT--,BSD
     * Copyright (c) 2016, 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--*/
    //******************************************************************************
    // transform_ex1_fft_fixed_q15 - Real FFT with fixed scaling.
    //
    // This example demonstrates how to use the msp_fft_auto_q15 API to transform a
    // real input data array to the frequency domain using the fast fourier
    // transform (FFT) with fixed scaling.
    //
    // Jeremy Friesenhahn, Brent Peterson
    // Texas Instruments Inc.
    // April 2016
    //******************************************************************************
    #include "msp430.h"
    
    #include <math.h>
    #include <stdint.h>
    #include <stdbool.h>
    
    #include "DSPLib.h"
    
    /* Global defines */
    #define SAMPLES     512
    #define FS          4096
    #define FREQ1       250
    #define FREQ2       1000
    #define AMPL1       0.25
    #define AMPL2       0.10
    
    /* Input vector A */
    DSPLIB_DATA(vectorA,MSP_ALIGN_FFT_Q15(SAMPLES))
    _q15 vectorA[SAMPLES];
    
    /* Input vector B */
    DSPLIB_DATA(vectorB,MSP_ALIGN_FFT_Q15(SAMPLES))
    _q15 vectorB[SAMPLES];
    
    /* Allocate DSPLib parameter structures. */
    msp_add_q15_params addParams;
    msp_fft_q15_params fftParams;
    
    /* Benchmark cycle counts */
    volatile uint32_t cycleCount;
    
    void main(void)
    {
        float pi;
        float time;
        uint16_t i;
        msp_status status;
        
        /* Disable WDT. */
        WDTCTL = WDTPW + WDTHOLD;
        
        /* Initialize local variables. */
        pi = acosf(-1);
    
        /*
         * Generate a floating point sine wave and convert to Q15.
         *     time = 1/(SAMPLES*2) * [0:1:SAMPLES-1];
         *     vectorA = AMPL1*sin(2*pi*FREQ1*time);
         *     vectorB = AMPL2*sin(2*pi*FREQ2*time);
         */
        for (i = 0; i < SAMPLES; i++) {
            time = (float)i/(float)FS;
            vectorA[i] = _Q15(AMPL1*sinf(2*pi*FREQ1*time));
            vectorB[i] = _Q15(AMPL2*sinf(2*pi*FREQ2*time));
        }
        
        /* Call vector add function to sum vectorA and vectorB. */
        addParams.length = SAMPLES;
        status = msp_add_q15(&addParams, vectorA, vectorB, vectorB);
        
        /* Check status flag. */
        if (status != MSP_SUCCESS) {
            /* ERROR! */
            __no_operation();
        }
        
        /* Initialize the fft parameter structure. */
        fftParams.length = SAMPLES;
        fftParams.bitReverse = 1;
        fftParams.twiddleTable = msp_cmplx_twiddle_table_512_q15;
        
        /* Call fixed scaling real fft function. */
        msp_benchmarkStart(TIMER_A0_BASE, 16);
        status = msp_fft_fixed_q15(&fftParams, vectorB);
        cycleCount = msp_benchmarkStop(TIMER_A0_BASE);
        
        /* Check status flag. */
        if (status != MSP_SUCCESS) {
            /* ERROR! */
            while(1);
        }
        
        /* End of program. */
        while (1);
    }
    

    Regards, Ryan

  • Thank you but please do you know approximately how much time it takes if I use CC430F5137 Instead of FR5969 !
  • 143616 cycles is equivalent to 7.2 ms with a 20 MHz clock frequency on the CC430F5137.

    Regards,
    Ryan
  • Hello,

    When I compilate this  program  to calculate  http://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/166/transform_5F00_ex1_5F00_fft_5F00_fixed_5F00_q15.c FFT  on MSP 430 ,I find these errors 

      WDTCTL undeclared

    WDTPW undeclared

    WDTHOLD undeclared

    TIMER_A0_BASE undeclared

    Please can you tell me how can I declare it !

  • Instead of explaining MSP430 Compiler Include Options I'm going to suggest that you download the full project from MSPWare -> Libraries -> DSPLib -> Example Projects -> Transform -> FFT Fixed q15

    Regards,
    Ryan

**Attention** This is a public forum