AnsweredAssumed Answered

Basic Question on FFT library problem

Question asked by dramsay on May 9, 2011
Latest reply on May 9, 2011 by dramsay

Hey Everyone,  I have a basic question- I hate to post it on this forum but I've literally been googling and racking my brain and I'm having trouble figuring it out.

 

I'm using a ADSP-21262 EZ Kit, with the basic talk-thru C code example as my starting point.  I'm just trying to get an FFT up and running, and I basically copied and pasted the code for the cfft function from the DSP library reference (code is shown far below).  Even though I copied and pasted, I'm getting serious errors with the twidfftf function:

 

----------------Configuration: David1 - Debug----------------
.\blockProcess.c
".\blockProcess.c", line 30: cc0040:  error: expected an identifier
  twidfftf(twid_r,twid_i,FFT_SIZE);
                              ^

 

".\blockProcess.c", line 30: cc0077: {D} warning: this declaration has no
          storage class or type specifier
  twidfftf(twid_r,twid_i,FFT_SIZE);
  ^

 

".\blockProcess.c", line 30: cc0092: {D} warning: identifier-list parameters
          may only be used in a function definition
  twidfftf(twid_r,twid_i,FFT_SIZE);
  ^

 

".\blockProcess.c", line 30: cc0147:  error: declaration is incompatible with
          "void twidfftf(float *, float *, int)" (declared at line 246 of
          "C:\Program Files (x86)\Analog Devices\VisualDSP
          5.0\212xx\include\filter.h")
  twidfftf(twid_r,twid_i,FFT_SIZE);
  ^

 

2 errors detected in the compilation of ".\blockProcess.c".
cc3089: fatal error: Compilation failed
Tool failed with exit/exception code: 1.
Build was unsuccessful.

 

 

 

Now I'm more of a matlab user than a C one, and I have no idea what is going wrong.  The prototype in the header file looks fine- I don't need to add in another extern prototype function to my code, right?  I even tried adding the header file to the project, which I'm almost positive is not necessary, with no luck.  I thought maybe there was something with the FFT_SIZE so I replaced it with a number, and I've looked up and down for a misplaced semicolon to no avail.  I'm sure this is obvious, but I could really use the help.  Thanks a ton in advance!

 

Here's the part of my code that is broken:

 

 

#include "tt.h"
#include <filter.h>

                     
                     
#define FFT_SIZE 2048

 

#pragma align 2048
float dm input_r[FFT_SIZE];

 

#pragma align 2048
float pm input_i[FFT_SIZE] = {0};

float dm temp_r[FFT_SIZE];
float pm temp_i[FFT_SIZE];
float dm twid_r[FFT_SIZE/2];
float pm twid_i[FFT_SIZE/2];

 

twidfftf(twid_r,twid_i,FFT_SIZE);
                    
                                        
unsigned int my_sin(double Amplitude, long float freqHz);

 

void processBlock(unsigned int *block_ptr)
{
    int i;
    int count;
   
    //Clear the Block Ready Semaphore
    blockReady = 0;
   
    //Set the Processing Active Semaphore before starting processing
    isProcessing = 1;

 

count=0;

 

   for(i=0;i<NUM_SAMPLES;i+=2)
        {
           input_r[count++] = (float) *(block_ptr+i);
        }

 

   cfftf(input_r,input_i,temp_r,temp_i,twid_r,twid_i,FFT_SIZE);
  
   long float freq = (93.75*i)/48000.0;
    *(block_ptr+i) = my_sin(6000*input_r[50],freq);

 


    //Clear the Processing Active Semaphore after processing is complete
    isProcessing = 0;
}

Outcomes