# Questions about dspf_sp_cfftr2_dit

Started by March 20, 2010
Hi boys,I've a question regarding implementation of fft on tms320c6711 on a dsk6711:
My code's critical part is essentially an interroupt driven function that has to do the fft, so I've

/*INCLUDES*/
[...]
#define N 2048 // Or every radix-2 number >3, points of fft

/*PROTOTYPES*/
void bit_rev(float *x,int n); // <-- ChipSupportLibrary 657.pdf
void gen_w_r2(float *w, int n);// <-- ChipSupportLibrary 657.pdf
void bitrev_index(short *index, int n);// <-- ChipSupportLibrary 657.pdf
void resp_to_int(void); // my function
/*MAIN*/
void main(){
[...]
for(;;)
}

/*CALLED FUNCTIONS*/

void resp_to_int(void){
bitrev_index(table,N);
gen_twiddle(w, N);
bit_rev(w,N>>1);
DSPF_sp_cfftr2_dit(v,w,N);
DSPF_sp_bitrev_cplx((double*)v,table,N);
magnitude_calc(v);
}

I've found how to call these functions in ti's doc; I've understand that: i have to generate tiddle factors w of lenght N/2, reorder they using bit reversal, do the fft that use sample's array of lenght 2*N (because real and immaginary part are mixed like complex_number[0]=x[0] + jx[1] and so on) in normal order and twiddle factors in bit reversed order and produce bit reversed coefficents of the FFT in an array of lenght 2*N ( same rule ) and bitreverse the result to obtain the correct order of real and immaginary part and finally calculate magnitude and phase.

So my questions are:

0) In your opinion is the right way to do fft?

1) Why gen_twiddle is called passing N and bit_rev of twiddle is passed with N>>1? The code in it do something_x[n]= something1*y[2*n] so there already is N/2 numbers!

2) I've studied that it is very important to do windowing of sample beacuse the initial and final part of the sequence may not enter in phase in the sampled array. It's better to use many windows phased Npoint/Number_of_window. Implementation of ti's fft use these techiniques? if not how can I do these things?

3) I generate interroupt event using a timer that provocates the Hardware Interroupt 8, using:

void start_timer1(){
*(unsigned volatile int*)TIMER1_CTRL=0x000; //Disable output of Timer 1
IRQ_map(IRQ_EVT_TINT1,8); // Map TINT event to CPU interrupt 8
hTimer=TIMER_open(TIMER_DEV1,TIMER_OPEN_RESET);//Open a handle to timer
TIMER_configArgs(hTimer, /* Setup the timer */
TIMER_CTL_OF(0x000003c1),
TIMER_PRD_OF(TPRD),
TIMER_CNT_OF(0)
);
TIMER_start(hTimer); // Enable the timer
}

with defined:

#define FCPU 167000000
#define SRATE 8000
#define TPRD (FCPU/(4*2*SRATE*10))

I've modified the FCPU parameters in bios from 150Mhz to 167Mhz. Is all my method correct? i think there is soething not very good...i like the better configuration in 5510dsk in wich configuring AD you can impose SampleRate in the configurations string of the codec at the initialization.
In a lot of project I've seen everybody use FCPU/(4*2*SRATE) . Why 4*2? Can i generate interroupt when i want or i have to extremely precise generate interroupt only when AD is ready for me, so every 1/8000 seconds?

I wish in your reply!!!! Have a good day!!

_____________________________________