cembeddedfftbeagleboneblackkissfft

Error in running KissFFT on Beaglebone black


I am trying to use KissFFT on BeagleBone Black, running Debian 7.5 with 3.8 kernel. The program gets compiled yet when I try to run it, It shows error

Real FFT optimization must be even

.

The same program run properly on Ubuntu laptop. I also tried various fft window length but error remains the same. Can anyone point out where I am going wrong? Herewith attaching the code and on gist with highlighting .

#include<stdio.h>
#include<math.h>
#include<string.h>
#include"kiss_fft.h"
#include "tools/kiss_fftr.h"
#include<complex.h>

int main()

{

    float s[960], k;                  //s = sine, data array
    float t[960]= {0};                //t = time data array
    int i, size = 960, fft_len=16384;
    float buff[fft_len];


    bzero(&buff, sizeof(buff));       // write zeros in whole buffer

    for (i = 0;i< fft_len;i++){
      if(buff[i] != 0){
          printf("Not zero");
          break;
        }
    }

    k = 2*M_PI/128;

  // Creating a 128 point/cycle discreet input 
    for (i = 0; i< 128; i++){
        t[i]= i*k;
        s[i] = sin(t[i]*50);
    }

// taking 7 cycles of input as 960 point window
  for (i = 1; i <=7; i++){
        memcpy(s+(128*i),s,128*4);
  }

kiss_fftr_cfg fft_cfg = kiss_fftr_alloc(fft_len,0,0,0);

kiss_fft_cpx out_cpx[fft_len/2 +1];

// Padding the 960 length data with zeros
memcpy(buff,s, sizeof(s));

kiss_fftr(fft_cfg,buff,out_cpx);

  for (i = 0; i <fft_len/2+1; i++){
        printf("\n%d %f%+f ",i,out_cpx[i].r,out_cpx[i].i);
  }

    return 0;
}

I compile it using:

gcc -g sinwave.c kiss_fft.c tools/kiss_fftr.c -o fsin -I "kiss_fft130/" -lm


Solution

  • One problem is that you are overwriting the s buffer. The loop with "i<=7" makes 7 extra copies of the first 128 elements in s. 8*128 = 1024 > 960