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.

MSP430FR6989: DSPLib msp_fft_fixed_q15 not working beyond 512 samples

Part Number: MSP430FR6989

The example code transform_ex1_fft_fixed_q15.c works fine on the MSP430FR6989 up to 4096 samples. I can currently use the msp_fft_fixed_q15 function with a BMI160 accelerometer and up to 512 samples. However, beyond 512 samples, such as 1024, the program becomes stuck at line 109 of copy_zero_init.c where the output buffer is initialized. Because 4096 samples work in the example code, I don't think this is a memory size issue. I am not sure how creating the input array from accelerometer data instead of test values can interfere with DSPLib. Any help or suggestions are greatly appreciated.

This is my main function content. I can share my initialization code for the GPIO, UART, and BMI160 if they will help.

WDTCTL = WDTPW | WDTHOLD;   // Stop watchdog timer
    initClockTo16MHz();
    initGPIO();
    UART_init();
    initI2C();
    timer_init();
    bmi160_init();

    msp_status status;
    msp_fft_q15_params fftParams;

    /* Initialize the fft parameter structure. */
    fftParams.length = SAMPLES;
    fftParams.bitReverse = true;
    fftParams.twiddleTable = msp_cmplx_twiddle_table_4096_q15; //MAP_msp_cmplx_twiddle_table_2048_q15;

    int i = 0;
    int16_t input[SAMPLES]={0};
    
//Read SAMPLES amount of data from the BMI160
           for(i=0;i<SAMPLES;i++)
           {
               I2C_Master_ReadReg(SLAVE_ADDR, 0x16, 2); //Read the acceleration value from the BMI160 registers
               input[i]= ReceiveBuffer[0] | (ReceiveBuffer[1] << 8); //Store the value in an array
               delay_ms(1); //Wait 1ms to create a sampling frequency of 1kHz
           }

           //Transmit all input values via UART to PC for debugging
           for(i=0; i<SAMPLES; i++)
           {
               while(!(UCA1IFG&UCTXIFG)); //Transmit high byte 
               UCA1TXBUF = input[i]>>8;
               while(!(UCA1IFG&UCTXIFG)); //Transmit low byte
               UCA1TXBUF = input[i] & 0xFF;
           }

           msp_benchmarkStart(MSP_BENCHMARK_BASE, 16); 
           status = MAP_msp_fft_fixed_q15(&fftParams, input); //Perform FFT 
           cycleCount = msp_benchmarkStop(MSP_BENCHMARK_BASE);
           msp_checkStatus(status);

           //Transmit all output values to PC
           for(i=0; i<SAMPLES; i++)
           {
               while(!(UCA1IFG&UCTXIFG));
               UCA1TXBUF = input[i]>>8;
               while(!(UCA1IFG&UCTXIFG));
               UCA1TXBUF = input[i] & 0xFF;
           }

  • Hello,

    I'll need a day or two to dig into your question and provide some feedback.

  • Hello James, thank you, but I've discovered my issue. I needed to set the temp and input arrays as persistent variables so that they would be allocated to the FRAM instead of overflowing my 2Kb of RAM. For others who run into this issue, I've put the code below.

    /* Declare as persistent to move variable to FRAM */
    #pragma PERSISTENT(input)
    int16_t input[SAMPLES] = {0};
    
    /* Temporary data array for processing */
    DSPLIB_DATA(temp,4)
    /* Declare as persistent to move variable to FRAM */
    #pragma PERSISTENT(temp)
    int16_t temp[3*SAMPLES/2] = {0};

**Attention** This is a public forum