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.

  • TI Thinks Resolved

MSP430FR6043: real FFT/iFFT calculation using LEA

Prodigy 40 points

Replies: 7

Views: 163

Part Number: MSP430FR6043

Hello, 

We are evaluating real FFT/iFFT with MSP430FR6043, and found an issue as below:

  • Convert time domain signal A to frequency domain signal B using msp_fft_fixed_q15().
  • Convert frequency domain signal B back to domain signal C using msp_ifft_fixed_q15().
  • It’s found that A is totally different from C, and it is not caused by precision lost.

Can you help to look into this?

Thanks for your help.

Chaofan

  • Part Number: MSP430FR5994

    Hello, 

    We are evaluating real FFT/iFFT with MSP430FR6043, and found an issue as below:

    • Convert time domain signal A to frequency domain signal B using msp_fft_fixed_q15().
    • Convert frequency domain signal B back to domain signal C using msp_ifft_fixed_q15().
    • It’s found that A is totally different from C, and it is not caused by precision lost.

    Can you help to look into this?

    Thanks for your help.

    Chaofan

  • The test code is shown as below.

    the test vector provided is [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,26, 27, 28, 29, 30, 31]

    after fft and ifft, it's changed to [-11, -10, 12, -11, 6, -3, 14, -6, 15, -3, 14, -10, 22, -5, 21, 0, 27, 2, 12, 1, 24, -1, 20, 2, 25, 11, 22, 12, 20, 9, 13, 12]

    #include "msp430.h"

    #include <math.h>
    #include <stdint.h>
    #include <stdbool.h>
    #include "DSPLib.h"

    #define SAMPLES 32

    /* Input signal and FFT result */
    DSPLIB_DATA(input,MSP_ALIGN_FFT_Q15(SAMPLES))
    _q15 input[SAMPLES*2];

    void main(void)
    {
     int16_t idx;
     msp_status status;
     msp_fft_q15_params fftParams;

     /* Disable WDT */
     WDTCTL = WDTPW + WDTHOLD;

     for (idx = 0; idx < SAMPLES; idx++)
     {
     input[idx] = idx;
     }

     fftParams.length = SAMPLES;
     fftParams.bitReverse = true;
     fftParams.twiddleTable = msp_cmplx_twiddle_table_32_q15;

     /* Perform real FFT with fixed scaling */
     status = msp_fft_fixed_q15(&fftParams, input);
     msp_checkStatus(status);

     /* Perform real iFFT with fixed scaling */
     status = msp_ifft_fixed_q15(&fftParams, input);
     msp_checkStatus(status);

     /* End of program. */
     __no_operation();
    }

  • In reply to user1116547:

    Hi Chaofan,

    I'll need to consult our DSPLib expert and get back to you.

    BR,

    Leo

  • In reply to user1116547:

    As I read this, your input is (a) amplitude roughly 0.0009, very close to loss of significance and (b) is sampled in an extremely small window (indistinguishable from DC). I suspect the ifft output is just noise.

    Try generating an input vector using sin().

    [Edit: Fixed Nyquist reference.]

  • In reply to Bruce McKenney47378:

    Any update on this issue? The test vector I provide is just an example, it seems the ifft output is always different no matter what the test vector is.

  • In reply to user1116547:

    What other test vectors did you try?

    I would not expect an FFT+IFFT to be bit-exact due to rounding errors. (It should be repeatable, though.) In the test case you posted, I expect rounding errors would dominate.

  • In reply to Bruce McKenney47378:

    Hi Chaofan,

    Please try using the msp_cmplx_fft_auto_q15 and msp_cmplx_ifft_auto_q15 functions for more accuracy.

     

    The results will not be perfect, however for the example you are using we were able to get a line increasing as an output of the IFFT function as shown below.

     

    BR,

    Leo

     

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.