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.

Problem in computing real time FFT on DSK6713 using dsk_app.c

Hello everyone,

                         I have a task of  real time implementation of FFT of an audio file on DSK6713 processor.I have made changes in the processbuffer() function of the file dsk_app.c in the example project found in DSK6713 folder.The code is compiling and built,  but it poses a problem while loading on the Processor,saying that it can't access some memory location(Fatal Error),the system then hangs and you have to disconnect the Processor. I think there is some thing wrong in my code itself.I have posted my Processbuffer()  function here.I have used the standard functions of the FFT folder found in  dsplib in  the c6700 folder for the Computation of the DFT.Any sort of Help is appreciated.

float x[2*BUFFSIZE];  // BUFFSIZE = 1024;
float w[BUFFSIZE];    //to calucate the twiddle factor

void processBuffer(void)
{
    Uint32 pingPong;
    Int16 i;

    /* Get contents of mailbox posted by edmaHwi */
    pingPong =  SWI_getmbox();

    /* Copy data from transmit to receive, could process audio here */
    if (pingPong == PING) {

    for (i = 0 ; i < BUFFSIZE ; i++)    // Converting values into real and imm part for FFT

    {
        x[2*i]= (float)gBufferRcvPing[i]; // changing RcvPing from int16 type to float type for FFT calculation
        x[2*i+1]=0; //Imaginary part

     }

       tw_genr2fft(w,BUFFSIZE);     //to generate the twiddle factor

      bit_rev(w,BUFFSIZE>>1);      // for bit reversal

       DSPF_sp_cfftr2_dit(x,w,BUFFSIZE);   //to  caluclate the DFT

       bit_rev(x,BUFFSIZE);
   
   for (i = 0 ; i < BUFFSIZE ; i++)    //compute magnitude
    {

     mag[i]=sqrt((x[2 * i] * x[2 * i]) + (x[2 * i + 1] * x[2 * i + 1]));}
      gBufferXmtPing[i] = (Int16)mag[i];                                             // chaning back from float type to int16 type before transmitting
   
    }

bit_rev(x,BUFFSIZE);

DSPF_sp_icfftr2_dif(x,w,BUFFSIZE);      //function for calculating the IFFT

divide(x,BUFFSIZE);                         //this function divides each element by BUFFSIZE

       /* Copy receive PING buffer to transmit PING buffer */
        copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
       
    } else {
      for (i = 0 ; i < BUFFSIZE ; i++)    // Converting values into real and imm part for FFT

    {
        x[2*i]= (float)gBufferRcvPong[i];         // changing RcvPong from int16 type to float type for FFT calculation
        x[2*i+1]=0; //Imaginary part

     }

       tw_genr2fft(w,BUFFSIZE);     //to generate the twiddle factor

      bit_rev(w,BUFFSIZE>>1);      // for bit reversal

       DSPF_sp_cfftr2_dit(x,w,BUFFSIZE);   //to  caluclate the DFT

       bit_rev(x,BUFFSIZE);
   
   for (i = 0 ; i < BUFFSIZE ; i++)    //compute magnitude
    {

     mag[i]=sqrt((x[2 * i] * x[2 * i]) + (x[2 * i + 1] * x[2 * i + 1]));}
      gBufferXmtPong[i] = (Int16)mag[i];                                             // chaning back from float type to int16 type before transmitting        
      
    }

bit_rev(x,BUFFSIZE);

DSPF_sp_icfftr2_dif(x,w,BUFFSIZE);      //function for calculating the IFFT

divide(x,BUFFSIZE);                         //this function divides each element by BUFFSIZE

/* Copy receive PONG buffer to transmit PONG buffer */
        copyData(gBufferRcvPong, gBufferXmtPong, BUFFSIZE);
       

   }

}

Please also let me know how to Proceed after running the code.I plan to give the input(which is a .wav file) to the LINE IN of the DSP .

Thanks,

Uday