DSPRelated.com
Forums

FFT result using DSPF_sp_cfftr2_dit Function

Started by B S July 17, 2010
Hi Guys,

I have been stuck with this FFT stuff since long and still I am unable to
verify the result. I am simply using dsk_app.c project for C6713 board and
implementing DSPLIB function DSPF_sp_cfftr2_dit to compute 1024 point FFT over
1024 complex pairs of input. I am going to explain over all steps which has
been a part of my implementation. Please have a look if I am wrong any where.

I defined these parts in dsk_app.c project.

#define BUFFSIZE 1024 // no. of FFT points
#pragma DATA_ALIGN(fft_buffer, 8)
float fft_buffer[2*BUFFSIZE]; // Length of input data
#pragma DATA_ALIGN(twiddles, 8)
float twiddles[BUFFSIZE]; // twiddles of FFT
length (1024)
float fft_mag[BUFFSIZE];
short bitrev_table[BUFFSIZE]; // bitrev_table of FFT
length (1024)

Following parts are already defined in dsk_app.c project as follows.

Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer

In main(), I generated coefficient table.

fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
void fft_r2_init(float *w, int n, short *br_table)
{
int i;
gen_twiddle(w, n); // generate twiddle table of n/2 complex twiddles
//bit_rev(w, n/2); // put twiddle table in bit-reversed order
DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
for(i=0; i br_table[i] = 0;
bitrev_index(br_table, n);
}
-processBuffer() - I processed audio data with in this function once it
received.

For PING Buffer

Here attached plot of gBufferRcvPing after getting 1024 samples of input. It
looks fine to me.
http://i31.tinypic.com/35lcc2a.jpg

if (pingPong == PING) {
//The DSPf algorithms expect the real data in the even input buffer locations
(2*k) and imaginary data in odd location (2*k+1)
for(k=0; k < 2*BUFFSIZE;
k++)
{
fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
fft_buffer[2*k+1] = 0.0; //imag
}

Called FFT and bit reversed function.

fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
void fft_r2(float *x, float *w, int n, short *br_table)
{
DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
DSPF_sp_bitrev_cplx((double *)x, br_table, n);
}

Here attached plot of fft_buffer after FFT and bit reversal.
http://i31.tinypic.com/dq6cub.jpg

Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
for(l=0; l < BUFFSIZE; l++)
{
fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
fft_buffer[2*l+1]*fft_buffer[2*l+1]);

gBufferRcvPong[l] = (Int16)fft_mag[l];
}

/* Copy receive PING buffer to transmit PING buffer */
copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);

void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
{
Int16 i = 0;

for (i = 0; i < length; i++) {
outbuf[i] = inbuf[i];
}
}
Here attached plot of fft_mag after calculating magnitude of FFT transform.
http://i30.tinypic.com/15wntlg.jpg

I used the same approach for PONG Buffer.

Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
http://i28.tinypic.com/acebv6.jpg

and here find the plot of fft_mag after calculating magnitude of FFT transform
for PONG buffer.
http://i28.tinypic.com/2zemoo1.png

Moreoever, I am not sure how much is the sampling frequency, default one is
48Khz for dsk_app.c project, I changed the following parameter with in aic23.h
file to make it 8Khz but I don't know wheather its working fine or not.

#define AIC23_DEFAULTPARAMS {
AIC23_REG8_8KHZ, }

Is this this the right way to change Sampling Rate ?

Where am I doing any thing wrong while calculating fft and magnitude ?
Why fft_mag doesn't show one clear peak for PING and PONG register ?

Is there any thing wrong with the length of twiddles, BUFFSIZE and fft_buffer
?

Please help me out.
Thanks.
B.S.

There seems to be a problem with the generation of twiddle values code sequence.

================================ int i;
gen_twiddle(w, n); // generate twiddle table of n/2 complex twiddles
//bit_rev(w, n/2); // put twiddle table in bit-reversed order
DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
for(i=0; i br_table[i] = 0;
bitrev_index(br_table, n);

================================
The above code is calling DSPF_sp_bitref_cplx() with the bit reverse table as a
parameter.
This means the call has to be either setting the br_table or expects the br table to
already be initialized.
The next two lines of code are then initializing the br_table.

This means either:
--the call to DSPF_...() is being fed a table of junk
or
--the output of the call to DSPF_...() is being overwritten.
HOWEVER,

I think your approach needs a bit more research.
You may want to read:

which has a code example and detail explanation of what needs to be done.

R. Williams

---------- Original Message -----------
From: B S
To: c...
Sent: Thu, 15 Jul 2010 04:55:41 -0700 (PDT)
Subject: [c6x] FFT result using DSPF_sp_cfftr2_dit Function

> Hi Guys,
>
> I have been stuck with this FFT stuff since long and still I am
> unable to verify the result. I am simply using dsk_app.c project for
> C6713 board and implementing DSPLIB function DSPF_sp_cfftr2_dit to
> compute 1024 point FFT over 1024 complex pairs of input. I am going
> to explain over all steps which has been a part of my implementation.
> Please have a look if I am wrong any where.
>
> I defined these parts in dsk_app.c project.
>
> #define BUFFSIZE 1024 // no. of FFT points
> #pragma DATA_ALIGN(fft_buffer, 8)
> float fft_buffer[2*BUFFSIZE]; // Length of
> input data
> #pragma DATA_ALIGN(twiddles, 8)
> float twiddles[BUFFSIZE]; // twiddles of
> FFT length (1024) float fft_mag[BUFFSIZE]; short
> bitrev_table[BUFFSIZE]; // bitrev_table of FFT
> length (1024)
>
> Following parts are already defined in dsk_app.c project as follows.
>
> Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
> Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
> Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
> Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
>
> In main(), I generated coefficient table.
>
> fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
> void fft_r2_init(float *w, int n, short *br_table)
> {
> int i;
> gen_twiddle(w, n); // generate twiddle table of n/2
> complex twiddles //bit_rev(w, n/2); // put twiddle table in
> bit-reversed order DSPF_sp_bitrev_cplx((double *)w, br_table, n/2)
> ; for(i=0; i > br_table[i] = 0; bitrev_index(br_table, n); }
>
> -processBuffer() - I processed audio data with in this function once
> it received.
>
> For PING Buffer
>
> Here attached plot of gBufferRcvPing after getting 1024 samples of
> input. It looks fine to me. http://i31.tinypic.com/35lcc2a.jpg
>
> if (pingPong == PING) {
> //The DSPf algorithms expect the real data in the even input buffer
> locations
> (2*k) and imaginary data in odd location (2*k+1) for(k=0; k <
> 2*BUFFSIZE; k++)
>
> {
> fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
> fft_buffer[2*k+1] = 0.0; //imag
> }
>
> Called FFT and bit reversed function.
>
> fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
> void fft_r2(float *x, float *w, int n, short *br_table)
> {
> DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
> DSPF_sp_bitrev_cplx((double *)x, br_table, n);
> }
>
> Here attached plot of fft_buffer after FFT and bit reversal.
> http://i31.tinypic.com/dq6cub.jpg
>
> Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
> for(l=0; l < BUFFSIZE; l++)
> {
> fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
> fft_buffer[2*l+1]*fft_buffer[2*l+1]);
>
> gBufferRcvPong[l] = (Int16)fft_mag[l];
> }
>
> /* Copy receive PING buffer to transmit PING buffer */
> copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
>
> void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
> {
> Int16 i = 0;
>
> for (i = 0; i < length; i++) {
> outbuf[i] = inbuf[i];
> }
> }
>
> Here attached plot of fft_mag after calculating magnitude of FFT transform.
> http://i30.tinypic.com/15wntlg.jpg
>
> I used the same approach for PONG Buffer.
>
> Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
> http://i28.tinypic.com/acebv6.jpg
>
> and here find the plot of fft_mag after calculating magnitude of FFT
> transform for PONG buffer. http://i28.tinypic.com/2zemoo1.png
>
> Moreoever, I am not sure how much is the sampling frequency, default
> one is 48Khz for dsk_app.c project, I changed the following parameter
> with in aic23.h file to make it 8Khz but I don't know wheather its
> working fine or not.
>
> #define AIC23_DEFAULTPARAMS {
> AIC23_REG8_8KHZ, }
>
> Is this this the right way to change Sampling Rate ?
>
> Where am I doing any thing wrong while calculating fft and magnitude ?
>
> Why fft_mag doesn't show one clear peak for PING and PONG register ?
>
> Is there any thing wrong with the length of twiddles, BUFFSIZE and
> fft_buffer ?
>
> Please help me out.
> Thanks.
------- End of Original Message -------

_____________________________________
R. Williams,

I looked over that but it didn't change the output at all.

________________________________
From: Richard Williams
To: B S ; c...
Sent: Sat, July 17, 2010 6:58:20 PM
Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function

B.S.

There seems to be a problem with the generation of twiddle values code sequence.

================================int i;
gen_twiddle(w, n); // generate twiddle table of n/2 complex twiddles
//bit_rev(w, n/2); // put twiddle table in bit-reversed order
DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
for(i=0; i br_table[i] = 0;
bitrev_index(br_table, n);

================================
The above code is calling DSPF_sp_bitref_cplx() with the bit reverse table as a
parameter.
This means the call has to be either setting the br_table or expects the br
table to

already be initialized.
The next two lines of code are then initializing the br_table.

This means either:
--the call to DSPF_...() is being fed a table of junk
or
--the output of the call to DSPF_...() is being overwritten.

HOWEVER,

I think your approach needs a bit more research.
You may want to read:

which has a code example and detail explanation of what needs to be done.

R. Williams

---------- Original Message -----------
From: B S
To: c...
Sent: Thu, 15 Jul 2010 04:55:41 -0700 (PDT)
Subject: [c6x] FFT result using DSPF_sp_cfftr2_dit Function

> Hi Guys,
>
> I have been stuck with this FFT stuff since long and still I am
> unable to verify the result. I am simply using dsk_app.c project for
> C6713 board and implementing DSPLIB function DSPF_sp_cfftr2_dit to
> compute 1024 point FFT over 1024 complex pairs of input. I am going
> to explain over all steps which has been a part of my implementation.
> Please have a look if I am wrong any where.
>
> I defined these parts in dsk_app.c project.
>
> #define BUFFSIZE 1024 // no. of FFT points
> #pragma DATA_ALIGN(fft_buffer, 8)
> float fft_buffer[2*BUFFSIZE]; // Length of
> input data
> #pragma DATA_ALIGN(twiddles, 8)
> float twiddles[BUFFSIZE]; // twiddles of
> FFT length (1024) float fft_mag[BUFFSIZE]; short
> bitrev_table[BUFFSIZE]; // bitrev_table of FFT
> length (1024)
>
> Following parts are already defined in dsk_app.c project as follows.
>
> Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
> Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
> Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
> Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
>
> In main(), I generated coefficient table.
>
> fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
> void fft_r2_init(float *w, int n, short *br_table)
> {
> int i;
> gen_twiddle(w, n); // generate twiddle table of n/2
> complex twiddles //bit_rev(w, n/2); // put twiddle table in
> bit-reversed order DSPF_sp_bitrev_cplx((double *)w, br_table, n/2)
> ; for(i=0; i > br_table[i] = 0; bitrev_index(br_table, n); }
>
> -processBuffer() - I processed audio data with in this function once
> it received.
>
> For PING Buffer
>
> Here attached plot of gBufferRcvPing after getting 1024 samples of
> input. It looks fine to me. http://i31.tinypic.com/35lcc2a.jpg
>
> if (pingPong == PING) {
> //The DSPf algorithms expect the real data in the even input buffer
> locations
> (2*k) and imaginary data in odd location (2*k+1) for(k=0; k <
> 2*BUFFSIZE; k++)
>
> {
> fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
> fft_buffer[2*k+1] = 0.0; //imag
> }
>
> Called FFT and bit reversed function.
>
> fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
> void fft_r2(float *x, float *w, int n, short *br_table)
> {
> DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
> DSPF_sp_bitrev_cplx((double *)x, br_table, n);
> }
>
> Here attached plot of fft_buffer after FFT and bit reversal.
> http://i31.tinypic.com/dq6cub.jpg
>
> Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
> for(l=0; l < BUFFSIZE; l++)
> {
> fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
> fft_buffer[2*l+1]*fft_buffer[2*l+1]);
>
> gBufferRcvPong[l] = (Int16)fft_mag[l];
> }
>
> /* Copy receive PING buffer to transmit PING buffer */
> copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
>
> void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
> {
> Int16 i = 0;
>
> for (i = 0; i < length; i++) {
> outbuf[i] = inbuf[i];
> }
> }
>
> Here attached plot of fft_mag after calculating magnitude of FFT transform.
> http://i30.tinypic.com/15wntlg.jpg
>
> I used the same approach for PONG Buffer.
>
> Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
> http://i28.tinypic.com/acebv6.jpg
>
> and here find the plot of fft_mag after calculating magnitude of FFT
> transform for PONG buffer. http://i28.tinypic.com/2zemoo1.png
>
> Moreoever, I am not sure how much is the sampling frequency, default
> one is 48Khz for dsk_app.c project, I changed the following parameter
> with in aic23.h file to make it 8Khz but I don't know wheather its
> working fine or not.
>
> #define AIC23_DEFAULTPARAMS {
> AIC23_REG8_8KHZ, }
>
> Is this this the right way to change Sampling Rate ?
>
> Where am I doing any thing wrong while calculating fft and magnitude ?
>
> Why fft_mag doesn't show one clear peak for PING and PONG register ?
>
> Is there any thing wrong with the length of twiddles, BUFFSIZE and
> fft_buffer ?
>
> Please help me out.
> Thanks.
------- End of Original Message -------
B.S.
Your stated you have 'looked over that'.
Does that mean you read/understood the referenced URL information and code example and
corrected the order of the instructions in your application?
or does that mean you looked at the production of the twiddle factors ?
or does that mean you have looked at the production of the bit reverse table?
or does your statement mean something else?

As a side note:
In software, the order of the instructions is very important.
In software, the specific instructions used is very important.
In software, testing of each and every step is very important.
In software, precise explanations are needed, vague statements like "I looked over
that" do not convey the needed information.

It seems to me that you have written some code and then expect me to find/fix all the
problems. Your task is to find the problems. I'm here to help with specific problems.

IMO:
The first thing that needs to be done is examine the output of the twiddle factors
production.
Then examine the output of the bit reverse index array.
Note:
You can use CCS to capture an area of memory as a series of values, save it to a file
on your PC, and examine those values with a text editor.

BTW:
your email address indicates you have matlab and know how to use it.
You can use matlab to produce the twiddle factors and the bit reverse table and use
those outputs to check against the values your application is producing.

R. Williams
---------- Original Message -----------
From: B S
To: Richard Williams , c...
Sent: Tue, 20 Jul 2010 02:05:45 -0700 (PDT)
Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function

> R. Williams,
>
> I looked over that but it didn't change the output at all.
>
> ________________________________
> From: Richard Williams
> To: B S ; c...
> Sent: Sat, July 17, 2010 6:58:20 PM
> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
>
> B.S.
>
> There seems to be a problem with the generation of twiddle values code
> sequence.
>
> ================================> int i;
> gen_twiddle(w, n); // generate twiddle table of n/2 complex twiddles
> //bit_rev(w, n/2); // put twiddle table in bit-reversed order
> DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
> for(i=0; i > br_table[i] = 0;
> bitrev_index(br_table, n);
>
> ================================>
> The above code is calling DSPF_sp_bitref_cplx() with the bit reverse
> table as a parameter. This means the call has to be either setting the
> br_table or expects the br table to
>
> already be initialized.
> The next two lines of code are then initializing the br_table.
>
> This means either:
> --the call to DSPF_...() is being fed a table of junk
> or
> --the output of the call to DSPF_...() is being overwritten.
>
> HOWEVER,
>
> I think your approach needs a bit more research.
> You may want to read:
>
> which has a code example and detail explanation of what needs to be done.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: c...
> Sent: Thu, 15 Jul 2010 04:55:41 -0700 (PDT)
> Subject: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
>
> > Hi Guys,
> >
> > I have been stuck with this FFT stuff since long and still I am
> > unable to verify the result. I am simply using dsk_app.c project for
> > C6713 board and implementing DSPLIB function DSPF_sp_cfftr2_dit to
> > compute 1024 point FFT over 1024 complex pairs of input. I am going
> > to explain over all steps which has been a part of my implementation.
> > Please have a look if I am wrong any where.
> >
> > I defined these parts in dsk_app.c project.
> >
> > #define BUFFSIZE 1024 // no. of FFT points
> > #pragma DATA_ALIGN(fft_buffer, 8)
> > float fft_buffer[2*BUFFSIZE]; // Length of
> > input data
> > #pragma DATA_ALIGN(twiddles, 8)
> > float twiddles[BUFFSIZE]; // twiddles of
> > FFT length (1024) float fft_mag[BUFFSIZE]; short
> > bitrev_table[BUFFSIZE]; // bitrev_table of FFT
> > length (1024)
> >
> > Following parts are already defined in dsk_app.c project as follows.
> >
> > Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
> > Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
> > Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
> > Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
> >
> > In main(), I generated coefficient table.
> >
> > fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
> > void fft_r2_init(float *w, int n, short *br_table)
> > {
> > int i;
> > gen_twiddle(w, n); // generate twiddle table of n/2
> > complex twiddles //bit_rev(w, n/2); // put twiddle table in
> > bit-reversed order DSPF_sp_bitrev_cplx((double *)w, br_table, n/2)
> > ; for(i=0; i > > br_table[i] = 0; bitrev_index(br_table, n); }
> >
> > -processBuffer() - I processed audio data with in this function once
> > it received.
> >
> > For PING Buffer
> >
> > Here attached plot of gBufferRcvPing after getting 1024 samples of
> > input. It looks fine to me. http://i31.tinypic.com/35lcc2a.jpg
> >
> > if (pingPong == PING) {
> > //The DSPf algorithms expect the real data in the even input buffer
> > locations
> > (2*k) and imaginary data in odd location (2*k+1) for(k=0; k <
> > 2*BUFFSIZE; k++)
> >
> > {
> > fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
> > fft_buffer[2*k+1] = 0.0; //imag
> > }
> >
> > Called FFT and bit reversed function.
> >
> > fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
> > void fft_r2(float *x, float *w, int n, short *br_table)
> > {
> > DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
> > DSPF_sp_bitrev_cplx((double *)x, br_table, n);
> > }
> >
> > Here attached plot of fft_buffer after FFT and bit reversal.
> > http://i31.tinypic.com/dq6cub.jpg
> >
> > Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
> > for(l=0; l < BUFFSIZE; l++)
> > {
> > fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
> > fft_buffer[2*l+1]*fft_buffer[2*l+1]);
> >
> > gBufferRcvPong[l] = (Int16)fft_mag[l];
> > }
> >
> > /* Copy receive PING buffer to transmit PING buffer */
> > copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
> >
> > void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
> > {
> > Int16 i = 0;
> >
> > for (i = 0; i < length; i++) {
> > outbuf[i] = inbuf[i];
> > }
> > }
> >
> > Here attached plot of fft_mag after calculating magnitude of FFT transform.
> > http://i30.tinypic.com/15wntlg.jpg
> >
> > I used the same approach for PONG Buffer.
> >
> > Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
> > http://i28.tinypic.com/acebv6.jpg
> >
> > and here find the plot of fft_mag after calculating magnitude of FFT
> > transform for PONG buffer. http://i28.tinypic.com/2zemoo1.png
> >
> > Moreoever, I am not sure how much is the sampling frequency, default
> > one is 48Khz for dsk_app.c project, I changed the following parameter
> > with in aic23.h file to make it 8Khz but I don't know wheather its
> > working fine or not.
> >
> > #define AIC23_DEFAULTPARAMS {
> > AIC23_REG8_8KHZ, }
> >
> > Is this this the right way to change Sampling Rate ?
> >
> > Where am I doing any thing wrong while calculating fft and magnitude ?
> >
> > Why fft_mag doesn't show one clear peak for PING and PONG register ?
> >
> > Is there any thing wrong with the length of twiddles, BUFFSIZE and
> > fft_buffer ?
> >
> > Please help me out.
> > Thanks.
> ------- End of Original Message -------
------- End of Original Message -------

_____________________________________
BS-

> I did the same way you advised.
>
> Real data with 1 followed by 1023 zeros, and imaginary data all zero (1024
> values). Then took FFT and computed magnitude on 512 points. It gives value '1'
> for all 512 points, seems to work fine.

That is correct result, so it seems your FFT is working Ok. The next step is to verify your sampling rate. Suggest
to add a counter to your code that receives audio input buffers, let the code run for about 10 second, then check the
counter value. It should be approximately 78 (1024 pt buffers, 8 kHz sampling rate).

If that works, then another thing you can do is a "fake" -- inside the buffer receive code, fill each buffer with a
perfect 1024 pt sine wave (copy it from a table in mem, keep maximum amplitude low, like 128). This test is good
because:

-timing is about the same; i.e. all code still
responds to interrupts and runs in real-time

-in-between steps, like your CopyData()
function, are included in the test

-you know exactly what to expect from your FFT
output, both shape and amplitude

As Richard says, you have to go step-by-step and make no assumptions. There can be any number of small problems,
sorting them out can be tedious and take time. But if engineering were easy, then everyone could do it :-)

-Jeff

> ________________________________
> From: Jeff Brower
> To: BS
> Cc: c...
> Sent: Mon, July 19, 2010 6:32:22 PM
> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
> BS-
>
> Suggest to first verify DSP_sp_cfftr2_dit() function, i.e. separate from your
> audio input. For example, fill real
> data with 1 followed by 1023 zeros, and imaginary data all zero (all 1024 values
> zero). Then calculate magnitude on
> 512 points.
>
> What do you get?
>
> -Jeff
>
>> I have been stuck with this FFT stuff since long and still I am unable to
>> verify the result. I am simply using dsk_app.c project for C6713 board and
>> implementing DSPLIB function DSPF_sp_cfftr2_dit to compute 1024 point FFT over
>> 1024 complex pairs of input. I am going to explain over all steps which has
>> been a part of my implementation. Please have a look if I am wrong any where.
>>
>> I defined these parts in dsk_app.c project.
>>
>> #define BUFFSIZE 1024 // no. of FFT points
>> #pragma DATA_ALIGN(fft_buffer, 8)
>> float fft_buffer[2*BUFFSIZE]; // Length of input data
>> #pragma DATA_ALIGN(twiddles, 8)
>> float twiddles[BUFFSIZE]; // twiddles of FFT
>> length (1024)
>> float fft_mag[BUFFSIZE];
>> short bitrev_table[BUFFSIZE]; // bitrev_table of FFT
>> length (1024)
>>
>> Following parts are already defined in dsk_app.c project as follows.
>>
>> Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
>> Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
>> Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
>> Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
>>
>> In main(), I generated coefficient table.
>>
>> fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
>> void fft_r2_init(float *w, int n, short *br_table)
>> {
>> int i;
>> gen_twiddle(w, n); // generate twiddle table of n/2 complex
>>twiddles
>> //bit_rev(w, n/2); // put twiddle table in bit-reversed order
>> DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
>> for(i=0; i >> br_table[i] = 0;
>> bitrev_index(br_table, n);
>> }
>> -processBuffer() - I processed audio data with in this function once it
>> received.
>>
>> For PING Buffer
>>
>> Here attached plot of gBufferRcvPing after getting 1024 samples of input. It
>> looks fine to me.
>> http://i31.tinypic.com/35lcc2a.jpg
>>
>> if (pingPong == PING) {
>> //The DSPf algorithms expect the real data in the even input buffer
>>locations
>> (2*k) and imaginary data in odd location (2*k+1)
>> for(k=0; k < 2*BUFFSIZE;
>> k++)
>> {
>> fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
>> fft_buffer[2*k+1] = 0.0; //imag
>> }
>>
>> Called FFT and bit reversed function.
>>
>> fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
>> void fft_r2(float *x, float *w, int n, short *br_table)
>> {
>> DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
>> DSPF_sp_bitrev_cplx((double *)x, br_table, n);
>> }
>>
>> Here attached plot of fft_buffer after FFT and bit reversal.
>> http://i31.tinypic.com/dq6cub.jpg
>>
>> Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
>> for(l=0; l < BUFFSIZE; l++)
>> {
>> fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
>> fft_buffer[2*l+1]*fft_buffer[2*l+1]);
>>
>> gBufferRcvPong[l] = (Int16)fft_mag[l];
>> }
>>
>> /* Copy receive PING buffer to transmit PING buffer */
>> copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
>>
>> void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
>> {
>> Int16 i = 0;
>>
>> for (i = 0; i < length; i++) {
>> outbuf[i] = inbuf[i];
>> }
>> }
>> Here attached plot of fft_mag after calculating magnitude of FFT transform.
>> http://i30.tinypic.com/15wntlg.jpg
>>
>> I used the same approach for PONG Buffer.
>>
>> Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
>> http://i28.tinypic.com/acebv6.jpg
>>
>> and here find the plot of fft_mag after calculating magnitude of FFT
>> transform for PONG buffer.
>> http://i28.tinypic.com/2zemoo1.png
>>
>> Moreoever, I am not sure how much is the sampling frequency, default one is
>> 48Khz for dsk_app.c project, I changed the following parameter with in
> aic23.h
>> file to make it 8Khz but I don't know wheather its working fine or not.
>>
>> #define AIC23_DEFAULTPARAMS {
>> AIC23_REG8_8KHZ, }
>>
>> Is this this the right way to change Sampling Rate ?
>>
>> Where am I doing any thing wrong while calculating fft and magnitude ?
>> Why fft_mag doesn't show one clear peak for PING and PONG register ?
>>
>> Is there any thing wrong with the length of twiddles, BUFFSIZE and
>>fft_buffer
>> ?
>>
>> Please help me out.Thanks.

_____________________________________
BS-

> There was some problem with twiddle generation code now FFT is working quite
> fine with real time Sine input. Thanks a million for your kind help.

Glad to hear you got some good results! Your plots look great. Must be very satisfying to get it working.

Sounds like more basic debug on FFT-related routines revealed the problem.

-Jeff

> Plots for ping and pong buffer after magnitude computation are attached below.
>
> PING BUFFER:
> http://i31.tinypic.com/11j402d.jpg
>
> PONG BUFFER:
> http://i25.tinypic.com/33bobgl.jpg
>
> I tried to change the sampling frequency following way but it doesn't seem to
> work with the location of the peak appeard in the plots.
> Uint32 fs = DSK6713_AIC23_FREQ_8KHZ;
>
> Jeff, I couldn't found the right place to add a counter. Can you please help me
> with that ?
>
> Thanks.
> ________________________________
> From: Jeff Brower
> To: BS
> Cc: c...
> Sent: Tue, July 20, 2010 7:40:21 PM
> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
> BS-
>
>> I did the same way you advised.
>>
>> Real data with 1 followed by 1023 zeros, and imaginary data all zero (1024
>> values). Then took FFT and computed magnitude on 512 points. It gives value
>>'1'
>> for all 512 points, seems to work fine.
>
> That is correct result, so it seems your FFT is working Ok. The next step is to
> verify your sampling rate. Suggest
> to add a counter to your code that receives audio input buffers, let the code
> run for about 10 second, then check the
> counter value. It should be approximately 78 (1024 pt buffers, 8 kHz sampling
> rate).
>
> If that works, then another thing you can do is a "fake" -- inside the buffer
> receive code, fill each buffer with a
> perfect 1024 pt sine wave (copy it from a table in mem, keep maximum amplitude
> low, like 128). This test is good
> because:
>
> -timing is about the same; i.e. all code still
> responds to interrupts and runs in real-time
>
> -in-between steps, like your CopyData()
> function, are included in the test
>
> -you know exactly what to expect from your FFT
> output, both shape and amplitude
>
> As Richard says, you have to go step-by-step and make no assumptions. There can
> be any number of small problems,
> sorting them out can be tedious and take time. But if engineering were easy,
> then everyone could do it :-)
>
> -Jeff
>
>> ________________________________
>> From: Jeff Brower
>> To: BS
>> Cc: c...
>> Sent: Mon, July 19, 2010 6:32:22 PM
>> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
>> BS-
>>
>> Suggest to first verify DSP_sp_cfftr2_dit() function, i.e. separate from your
>> audio input. For example, fill real
>> data with 1 followed by 1023 zeros, and imaginary data all zero (all 1024
>>values
>> zero). Then calculate magnitude on
>> 512 points.
>>
>> What do you get?
>>
>> -Jeff
>>
>>> I have been stuck with this FFT stuff since long and still I am unable to
>>> verify the result. I am simply using dsk_app.c project for C6713 board and
>>> implementing DSPLIB function DSPF_sp_cfftr2_dit to compute 1024 point FFT
> over
>>> 1024 complex pairs of input. I am going to explain over all steps which has
>>> been a part of my implementation. Please have a look if I am wrong any
> where.
>>>
>>> I defined these parts in dsk_app.c project.
>>>
>>> #define BUFFSIZE 1024 // no. of FFT points
>>> #pragma DATA_ALIGN(fft_buffer, 8)
>>> float fft_buffer[2*BUFFSIZE]; // Length of input
> data
>>> #pragma DATA_ALIGN(twiddles, 8)
>>> float twiddles[BUFFSIZE]; // twiddles of FFT
>>> length (1024)
>>> float fft_mag[BUFFSIZE];
>>> short bitrev_table[BUFFSIZE]; // bitrev_table of FFT
>>> length (1024)
>>>
>>> Following parts are already defined in dsk_app.c project as follows.
>>>
>>> Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
>>> Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
>>> Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
>>> Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
>>>
>>> In main(), I generated coefficient table.
>>>
>>> fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
>>> void fft_r2_init(float *w, int n, short *br_table)
>>> {
>>> int i;
>>> gen_twiddle(w, n); // generate twiddle table of n/2 complex
>>>twiddles
>>> //bit_rev(w, n/2); // put twiddle table in bit-reversed order
>>> DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
>>> for(i=0; i >>> br_table[i] = 0;
>>> bitrev_index(br_table, n);
>>> }
>>>
>>>
>>> -processBuffer() - I processed audio data with in this function once it
>>> received.
>>>
>>> For PING Buffer
>>>
>>> Here attached plot of gBufferRcvPing after getting 1024 samples of input. It
>>> looks fine to me.
>>> http://i31.tinypic.com/35lcc2a.jpg
>>>
>>> if (pingPong == PING) {
>>> //The DSPf algorithms expect the real data in the even input buffer
>>>locations
>>> (2*k) and imaginary data in odd location (2*k+1)
>>> for(k=0; k < 2*BUFFSIZE;
>>> k++)
>>>
>>>
>>> {
>>> fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
>>> fft_buffer[2*k+1] = 0.0; //imag
>>> }
>>>
>>> Called FFT and bit reversed function.
>>>
>>> fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
>>> void fft_r2(float *x, float *w, int n, short *br_table)
>>> {
>>> DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
>>> DSPF_sp_bitrev_cplx((double *)x, br_table, n);
>>> }
>>>
>>> Here attached plot of fft_buffer after FFT and bit reversal.
>>> http://i31.tinypic.com/dq6cub.jpg
>>>
>>> Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
>>> for(l=0; l < BUFFSIZE; l++)
>>> {
>>> fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
>>> fft_buffer[2*l+1]*fft_buffer[2*l+1]);
>>>
>>> gBufferRcvPong[l] = (Int16)fft_mag[l];
>>> }
>>>
>>> /* Copy receive PING buffer to transmit PING buffer */
>>> copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
>>>
>>> void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
>>> {
>>> Int16 i = 0;
>>>
>>> for (i = 0; i < length; i++) {
>>> outbuf[i] = inbuf[i];
>>> }
>>> }
>>>
>>>
>>> Here attached plot of fft_mag after calculating magnitude of FFT
> transform.
>>> http://i30.tinypic.com/15wntlg.jpg
>>>
>>> I used the same approach for PONG Buffer.
>>>
>>> Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
>>> http://i28.tinypic.com/acebv6.jpg
>>>
>>> and here find the plot of fft_mag after calculating magnitude of FFT
>>> transform for PONG buffer.
>>> http://i28.tinypic.com/2zemoo1.png
>>>
>>> Moreoever, I am not sure how much is the sampling frequency, default one is
>>> 48Khz for dsk_app.c project, I changed the following parameter with in
>> aic23.h
>>> file to make it 8Khz but I don't know wheather its working fine or not.
>>>
>>> #define AIC23_DEFAULTPARAMS {
>>> AIC23_REG8_8KHZ, }
>>>
>>> Is this this the right way to change Sampling Rate ?
>>>
>>> Where am I doing any thing wrong while calculating fft and magnitude ?
>>>
>>>
>>> Why fft_mag doesn't show one clear peak for PING and PONG register ?
>>>
>>> Is there any thing wrong with the length of twiddles, BUFFSIZE and
>>>fft_buffer
>>> ?
>>>
>>> Please help me out.Thanks.

_____________________________________
Jeff, R. Williams,

There was some problem with twiddle generation code now FFT is working quite
fine with real time Sine input. Thanks a million for your kind help.
Plots for ping and pong buffer after magnitude computation are attached below.

PING BUFFER:
http://i31.tinypic.com/11j402d.jpg

PONG BUFFER:
http://i25.tinypic.com/33bobgl.jpg

I tried to change the sampling frequency following way but it doesn't seem to
work with the location of the peak appeard in the plots.
Uint32 fs = DSK6713_AIC23_FREQ_8KHZ;

Jeff, I couldn't found the right place to add a counter. Can you please help me
with that ?

Thanks.

________________________________
From: Jeff Brower
To: BS
Cc: c...
Sent: Tue, July 20, 2010 7:40:21 PM
Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function

BS-

> I did the same way you advised.
>
> Real data with 1 followed by 1023 zeros, and imaginary data all zero (1024
> values). Then took FFT and computed magnitude on 512 points. It gives value
>'1'
> for all 512 points, seems to work fine.

That is correct result, so it seems your FFT is working Ok. The next step is to
verify your sampling rate. Suggest
to add a counter to your code that receives audio input buffers, let the code
run for about 10 second, then check the
counter value. It should be approximately 78 (1024 pt buffers, 8 kHz sampling
rate).

If that works, then another thing you can do is a "fake" -- inside the buffer
receive code, fill each buffer with a
perfect 1024 pt sine wave (copy it from a table in mem, keep maximum amplitude
low, like 128). This test is good
because:

-timing is about the same; i.e. all code still
responds to interrupts and runs in real-time

-in-between steps, like your CopyData()
function, are included in the test

-you know exactly what to expect from your FFT
output, both shape and amplitude

As Richard says, you have to go step-by-step and make no assumptions. There can
be any number of small problems,
sorting them out can be tedious and take time. But if engineering were easy,
then everyone could do it :-)

-Jeff

> ________________________________
> From: Jeff Brower
> To: BS
> Cc: c...
> Sent: Mon, July 19, 2010 6:32:22 PM
> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
> BS-
>
> Suggest to first verify DSP_sp_cfftr2_dit() function, i.e. separate from your
> audio input. For example, fill real
> data with 1 followed by 1023 zeros, and imaginary data all zero (all 1024
>values
> zero). Then calculate magnitude on
> 512 points.
>
> What do you get?
>
> -Jeff
>
>> I have been stuck with this FFT stuff since long and still I am unable to
>> verify the result. I am simply using dsk_app.c project for C6713 board and
>> implementing DSPLIB function DSPF_sp_cfftr2_dit to compute 1024 point FFT
over
>> 1024 complex pairs of input. I am going to explain over all steps which has
>> been a part of my implementation. Please have a look if I am wrong any
where.
>>
>> I defined these parts in dsk_app.c project.
>>
>> #define BUFFSIZE 1024 // no. of FFT points
>> #pragma DATA_ALIGN(fft_buffer, 8)
>> float fft_buffer[2*BUFFSIZE]; // Length of input
data
>> #pragma DATA_ALIGN(twiddles, 8)
>> float twiddles[BUFFSIZE]; // twiddles of FFT
>> length (1024)
>> float fft_mag[BUFFSIZE];
>> short bitrev_table[BUFFSIZE]; // bitrev_table of FFT
>> length (1024)
>>
>> Following parts are already defined in dsk_app.c project as follows.
>>
>> Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
>> Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
>> Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
>> Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
>>
>> In main(), I generated coefficient table.
>>
>> fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
>> void fft_r2_init(float *w, int n, short *br_table)
>> {
>> int i;
>> gen_twiddle(w, n); // generate twiddle table of n/2 complex
>>twiddles
>> //bit_rev(w, n/2); // put twiddle table in bit-reversed order
>> DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
>> for(i=0; i >> br_table[i] = 0;
>> bitrev_index(br_table, n);
>> }
>> -processBuffer() - I processed audio data with in this function once it
>> received.
>>
>> For PING Buffer
>>
>> Here attached plot of gBufferRcvPing after getting 1024 samples of input. It
>> looks fine to me.
>> http://i31.tinypic.com/35lcc2a.jpg
>>
>> if (pingPong == PING) {
>> //The DSPf algorithms expect the real data in the even input buffer
>>locations
>> (2*k) and imaginary data in odd location (2*k+1)
>> for(k=0; k < 2*BUFFSIZE;
>> k++)
>> {
>> fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
>> fft_buffer[2*k+1] = 0.0; //imag
>> }
>>
>> Called FFT and bit reversed function.
>>
>> fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
>> void fft_r2(float *x, float *w, int n, short *br_table)
>> {
>> DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
>> DSPF_sp_bitrev_cplx((double *)x, br_table, n);
>> }
>>
>> Here attached plot of fft_buffer after FFT and bit reversal.
>> http://i31.tinypic.com/dq6cub.jpg
>>
>> Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
>> for(l=0; l < BUFFSIZE; l++)
>> {
>> fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
>> fft_buffer[2*l+1]*fft_buffer[2*l+1]);
>>
>> gBufferRcvPong[l] = (Int16)fft_mag[l];
>> }
>>
>> /* Copy receive PING buffer to transmit PING buffer */
>> copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
>>
>> void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
>> {
>> Int16 i = 0;
>>
>> for (i = 0; i < length; i++) {
>> outbuf[i] = inbuf[i];
>> }
>> }
>> Here attached plot of fft_mag after calculating magnitude of FFT
transform.
>> http://i30.tinypic.com/15wntlg.jpg
>>
>> I used the same approach for PONG Buffer.
>>
>> Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
>> http://i28.tinypic.com/acebv6.jpg
>>
>> and here find the plot of fft_mag after calculating magnitude of FFT
>> transform for PONG buffer.
>> http://i28.tinypic.com/2zemoo1.png
>>
>> Moreoever, I am not sure how much is the sampling frequency, default one is
>> 48Khz for dsk_app.c project, I changed the following parameter with in
> aic23.h
>> file to make it 8Khz but I don't know wheather its working fine or not.
>>
>> #define AIC23_DEFAULTPARAMS {
>> AIC23_REG8_8KHZ, }
>>
>> Is this this the right way to change Sampling Rate ?
>>
>> Where am I doing any thing wrong while calculating fft and magnitude ?
>> Why fft_mag doesn't show one clear peak for PING and PONG register ?
>>
>> Is there any thing wrong with the length of twiddles, BUFFSIZE and
>>fft_buffer
>> ?
>>
>> Please help me out.Thanks.
Jeff,

I added counter in the processbuffer() but it shows high value, I think I didn't
place it at the right place.Can you please elaborate counter thing to verify
sampling rate ?

BS

________________________________
From: Jeff Brower
To: BS
Cc: c...
Sent: Tue, July 27, 2010 6:38:42 PM
Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function

BS-

> There was some problem with twiddle generation code now FFT is working quite
> fine with real time Sine input. Thanks a million for your kind help.

Glad to hear you got some good results! Your plots look great. Must be very
satisfying to get it working.

Sounds like more basic debug on FFT-related routines revealed the problem.

-Jeff

> Plots for ping and pong buffer after magnitude computation are attached below.
>
> PING BUFFER:
> http://i31.tinypic.com/11j402d.jpg
>
> PONG BUFFER:
> http://i25.tinypic.com/33bobgl.jpg
>
> I tried to change the sampling frequency following way but it doesn't seem to
> work with the location of the peak appeard in the plots.
> Uint32 fs = DSK6713_AIC23_FREQ_8KHZ;
>
> Jeff, I couldn't found the right place to add a counter. Can you please help
me
> with that ?
>
> Thanks.
> ________________________________
> From: Jeff Brower
> To: BS
> Cc: c...
> Sent: Tue, July 20, 2010 7:40:21 PM
> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
> BS-
>
>> I did the same way you advised.
>>
>> Real data with 1 followed by 1023 zeros, and imaginary data all zero (1024
>> values). Then took FFT and computed magnitude on 512 points. It gives value
>>'1'
>> for all 512 points, seems to work fine.
>
> That is correct result, so it seems your FFT is working Ok. The next step is
>to
> verify your sampling rate. Suggest
> to add a counter to your code that receives audio input buffers, let the code
> run for about 10 second, then check the
> counter value. It should be approximately 78 (1024 pt buffers, 8 kHz sampling
> rate).
>
> If that works, then another thing you can do is a "fake" -- inside the buffer
> receive code, fill each buffer with a
> perfect 1024 pt sine wave (copy it from a table in mem, keep maximum amplitude
> low, like 128). This test is good
> because:
>
> -timing is about the same; i.e. all code still
> responds to interrupts and runs in real-time
>
> -in-between steps, like your CopyData()
> function, are included in the test
>
> -you know exactly what to expect from your FFT
> output, both shape and amplitude
>
> As Richard says, you have to go step-by-step and make no assumptions. There
>can
> be any number of small problems,
> sorting them out can be tedious and take time. But if engineering were easy,
> then everyone could do it :-)
>
> -Jeff
>
>> ________________________________
>> From: Jeff Brower
>> To: BS
>> Cc: c...
>> Sent: Mon, July 19, 2010 6:32:22 PM
>> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
>> BS-
>>
>> Suggest to first verify DSP_sp_cfftr2_dit() function, i.e. separate from your
>> audio input. For example, fill real
>> data with 1 followed by 1023 zeros, and imaginary data all zero (all 1024
>>values
>> zero). Then calculate magnitude on
>> 512 points.
>>
>> What do you get?
>>
>> -Jeff
>>
>>> I have been stuck with this FFT stuff since long and still I am unable to
>>> verify the result. I am simply using dsk_app.c project for C6713 board and
>>> implementing DSPLIB function DSPF_sp_cfftr2_dit to compute 1024 point FFT
> over
>>> 1024 complex pairs of input. I am going to explain over all steps which has
>>> been a part of my implementation. Please have a look if I am wrong any
> where.
>>>
>>> I defined these parts in dsk_app.c project.
>>>
>>> #define BUFFSIZE 1024 // no. of FFT points
>>> #pragma DATA_ALIGN(fft_buffer, 8)
>>> float fft_buffer[2*BUFFSIZE]; // Length of input
> data
>>> #pragma DATA_ALIGN(twiddles, 8)
>>> float twiddles[BUFFSIZE]; // twiddles of FFT
>>> length (1024)
>>> float fft_mag[BUFFSIZE];
>>> short bitrev_table[BUFFSIZE]; // bitrev_table of FFT
>>> length (1024)
>>>
>>> Following parts are already defined in dsk_app.c project as follows.
>>>
>>> Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
>>> Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
>>> Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
>>> Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
>>>
>>> In main(), I generated coefficient table.
>>>
>>> fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
>>> void fft_r2_init(float *w, int n, short *br_table)
>>> {
>>> int i;
>>> gen_twiddle(w, n); // generate twiddle table of n/2 complex
>>>twiddles
>>> //bit_rev(w, n/2); // put twiddle table in bit-reversed order
>>> DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
>>> for(i=0; i >>> br_table[i] = 0;
>>> bitrev_index(br_table, n);
>>> }
>>>
>>>
>>> -processBuffer() - I processed audio data with in this function once it
>>> received.
>>>
>>> For PING Buffer
>>>
>>> Here attached plot of gBufferRcvPing after getting 1024 samples of input.
It
>>> looks fine to me.
>>> http://i31.tinypic.com/35lcc2a.jpg
>>>
>>> if (pingPong == PING) {
>>> //The DSPf algorithms expect the real data in the even input buffer
>>>locations
>>> (2*k) and imaginary data in odd location (2*k+1)
>>> for(k=0; k < 2*BUFFSIZE;
>>> k++)
>>>
>>>
>>> {
>>> fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
>>> fft_buffer[2*k+1] = 0.0; //imag
>>> }
>>>
>>> Called FFT and bit reversed function.
>>>
>>> fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
>>> void fft_r2(float *x, float *w, int n, short *br_table)
>>> {
>>> DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
>>> DSPF_sp_bitrev_cplx((double *)x, br_table, n);
>>> }
>>>
>>> Here attached plot of fft_buffer after FFT and bit reversal.
>>> http://i31.tinypic.com/dq6cub.jpg
>>>
>>> Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
>>> for(l=0; l < BUFFSIZE; l++)
>>> {
>>> fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
>>> fft_buffer[2*l+1]*fft_buffer[2*l+1]);
>>>
>>> gBufferRcvPong[l] = (Int16)fft_mag[l];
>>> }
>>>
>>> /* Copy receive PING buffer to transmit PING buffer */
>>> copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
>>>
>>> void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
>>> {
>>> Int16 i = 0;
>>>
>>> for (i = 0; i < length; i++) {
>>> outbuf[i] = inbuf[i];
>>> }
>>> }
>>>
>>>
>>> Here attached plot of fft_mag after calculating magnitude of FFT
> transform.
>>> http://i30.tinypic.com/15wntlg.jpg
>>>
>>> I used the same approach for PONG Buffer.
>>>
>>> Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
>>> http://i28.tinypic.com/acebv6.jpg
>>>
>>> and here find the plot of fft_mag after calculating magnitude of FFT
>>> transform for PONG buffer.
>>> http://i28.tinypic.com/2zemoo1.png
>>>
>>> Moreoever, I am not sure how much is the sampling frequency, default one
is
>>> 48Khz for dsk_app.c project, I changed the following parameter with in
>> aic23.h
>>> file to make it 8Khz but I don't know wheather its working fine or not.
>>>
>>> #define AIC23_DEFAULTPARAMS {
>>> AIC23_REG8_8KHZ, }
>>>
>>> Is this this the right way to change Sampling Rate ?
>>>
>>> Where am I doing any thing wrong while calculating fft and magnitude ?
>>>
>>>
>>> Why fft_mag doesn't show one clear peak for PING and PONG register ?
>>>
>>> Is there any thing wrong with the length of twiddles, BUFFSIZE and
>>>fft_buffer
>>> ?
>>>
>>> Please help me out.Thanks.
BS-

> I added counter in the processbuffer() but it shows high value, I think I didn't
> place it at the right place.Can you please elaborate counter thing to verify
> sampling rate ?

I explained it already. What is your "high value"? How long did you let the code run before measuring the counter?
How did you stop the code and how do you actually see the counter value?

-Jeff

> ________________________________
> From: Jeff Brower
> To: BS
> Cc: c...
> Sent: Tue, July 27, 2010 6:38:42 PM
> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
> BS-
>
>> There was some problem with twiddle generation code now FFT is working quite
>> fine with real time Sine input. Thanks a million for your kind help.
>
> Glad to hear you got some good results! Your plots look great. Must be very
> satisfying to get it working.
>
> Sounds like more basic debug on FFT-related routines revealed the problem.
>
> -Jeff
>
>> Plots for ping and pong buffer after magnitude computation are attached below.
>>
>> PING BUFFER:
>> http://i31.tinypic.com/11j402d.jpg
>>
>> PONG BUFFER:
>> http://i25.tinypic.com/33bobgl.jpg
>>
>> I tried to change the sampling frequency following way but it doesn't seem to
>> work with the location of the peak appeard in the plots.
>> Uint32 fs = DSK6713_AIC23_FREQ_8KHZ;
>>
>> Jeff, I couldn't found the right place to add a counter. Can you please help
> me
>> with that ?
>>
>> Thanks.
>> ________________________________
>> From: Jeff Brower
>> To: BS
>> Cc: c...
>> Sent: Tue, July 20, 2010 7:40:21 PM
>> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
>> BS-
>>
>>> I did the same way you advised.
>>>
>>> Real data with 1 followed by 1023 zeros, and imaginary data all zero (1024
>>> values). Then took FFT and computed magnitude on 512 points. It gives value
>>>'1'
>>> for all 512 points, seems to work fine.
>>
>> That is correct result, so it seems your FFT is working Ok. The next step is
>>to
>> verify your sampling rate. Suggest
>> to add a counter to your code that receives audio input buffers, let the code
>> run for about 10 second, then check the
>> counter value. It should be approximately 78 (1024 pt buffers, 8 kHz sampling
>> rate).
>>
>> If that works, then another thing you can do is a "fake" -- inside the buffer
>> receive code, fill each buffer with a
>> perfect 1024 pt sine wave (copy it from a table in mem, keep maximum amplitude
>> low, like 128). This test is good
>> because:
>>
>> -timing is about the same; i.e. all code still
>> responds to interrupts and runs in real-time
>>
>> -in-between steps, like your CopyData()
>> function, are included in the test
>>
>> -you know exactly what to expect from your FFT
>> output, both shape and amplitude
>>
>> As Richard says, you have to go step-by-step and make no assumptions. There
>>can
>> be any number of small problems,
>> sorting them out can be tedious and take time. But if engineering were easy,
>> then everyone could do it :-)
>>
>> -Jeff
>>
>>> ________________________________
>>> From: Jeff Brower
>>> To: BS
>>> Cc: c...
>>> Sent: Mon, July 19, 2010 6:32:22 PM
>>> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
>>>
>>>
>>> BS-
>>>
>>> Suggest to first verify DSP_sp_cfftr2_dit() function, i.e. separate from your
>>> audio input. For example, fill real
>>> data with 1 followed by 1023 zeros, and imaginary data all zero (all 1024
>>>values
>>> zero). Then calculate magnitude on
>>> 512 points.
>>>
>>> What do you get?
>>>
>>> -Jeff
>>>
>>>> I have been stuck with this FFT stuff since long and still I am unable to
>>>> verify the result. I am simply using dsk_app.c project for C6713 board and
>>>> implementing DSPLIB function DSPF_sp_cfftr2_dit to compute 1024 point FFT
>> over
>>>> 1024 complex pairs of input. I am going to explain over all steps which has
>>>> been a part of my implementation. Please have a look if I am wrong any
>> where.
>>>>
>>>> I defined these parts in dsk_app.c project.
>>>>
>>>> #define BUFFSIZE 1024 // no. of FFT points
>>>> #pragma DATA_ALIGN(fft_buffer, 8)
>>>> float fft_buffer[2*BUFFSIZE]; // Length of input
>> data
>>>> #pragma DATA_ALIGN(twiddles, 8)
>>>> float twiddles[BUFFSIZE]; // twiddles of FFT
>>>> length (1024)
>>>> float fft_mag[BUFFSIZE];
>>>> short bitrev_table[BUFFSIZE]; // bitrev_table of FFT
>>>> length (1024)
>>>>
>>>> Following parts are already defined in dsk_app.c project as follows.
>>>>
>>>> Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
>>>> Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
>>>> Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
>>>> Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
>>>>
>>>> In main(), I generated coefficient table.
>>>>
>>>> fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
>>>> void fft_r2_init(float *w, int n, short *br_table)
>>>> {
>>>> int i;
>>>> gen_twiddle(w, n); // generate twiddle table of n/2 complex
>>>>twiddles
>>>> //bit_rev(w, n/2); // put twiddle table in bit-reversed order
>>>> DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
>>>> for(i=0; i >>>> br_table[i] = 0;
>>>> bitrev_index(br_table, n);
>>>> }
>>>>
>>>>
>>>> -processBuffer() - I processed audio data with in this function once it
>>>> received.
>>>>
>>>> For PING Buffer
>>>>
>>>> Here attached plot of gBufferRcvPing after getting 1024 samples of input.
> It
>>>> looks fine to me.
>>>> http://i31.tinypic.com/35lcc2a.jpg
>>>>
>>>> if (pingPong == PING) {
>>>> //The DSPf algorithms expect the real data in the even input buffer
>>>>locations
>>>> (2*k) and imaginary data in odd location (2*k+1)
>>>> for(k=0; k < 2*BUFFSIZE;
>>>> k++)
>>>>
>>>>
>>>> {
>>>> fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
>>>> fft_buffer[2*k+1] = 0.0; //imag
>>>> }
>>>>
>>>> Called FFT and bit reversed function.
>>>>
>>>> fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
>>>> void fft_r2(float *x, float *w, int n, short *br_table)
>>>> {
>>>> DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
>>>> DSPF_sp_bitrev_cplx((double *)x, br_table, n);
>>>> }
>>>>
>>>> Here attached plot of fft_buffer after FFT and bit reversal.
>>>> http://i31.tinypic.com/dq6cub.jpg
>>>>
>>>> Then calculated FFT magnitude and copied it back to gBufferRcvPing buffer.
>>>> for(l=0; l < BUFFSIZE; l++)
>>>> {
>>>> fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
>>>> fft_buffer[2*l+1]*fft_buffer[2*l+1]);
>>>>
>>>> gBufferRcvPong[l] = (Int16)fft_mag[l];
>>>> }
>>>>
>>>> /* Copy receive PING buffer to transmit PING buffer */
>>>> copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
>>>>
>>>> void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
>>>> {
>>>> Int16 i = 0;
>>>>
>>>> for (i = 0; i < length; i++) {
>>>> outbuf[i] = inbuf[i];
>>>> }
>>>> }
>>>>
>>>>
>>>> Here attached plot of fft_mag after calculating magnitude of FFT
>> transform.
>>>> http://i30.tinypic.com/15wntlg.jpg
>>>>
>>>> I used the same approach for PONG Buffer.
>>>>
>>>> Here attached plot of fft_buffer after FFT and bit reversal for PONG buffer.
>>>> http://i28.tinypic.com/acebv6.jpg
>>>>
>>>> and here find the plot of fft_mag after calculating magnitude of FFT
>>>> transform for PONG buffer.
>>>> http://i28.tinypic.com/2zemoo1.png
>>>>
>>>> Moreoever, I am not sure how much is the sampling frequency, default one
> is
>>>> 48Khz for dsk_app.c project, I changed the following parameter with in
>>> aic23.h
>>>> file to make it 8Khz but I don't know wheather its working fine or not.
>>>>
>>>> #define AIC23_DEFAULTPARAMS {
>>>> AIC23_REG8_8KHZ, }
>>>>
>>>> Is this this the right way to change Sampling Rate ?
>>>>
>>>> Where am I doing any thing wrong while calculating fft and magnitude ?
>>>>
>>>>
>>>> Why fft_mag doesn't show one clear peak for PING and PONG register ?
>>>>
>>>> Is there any thing wrong with the length of twiddles, BUFFSIZE and
>>>>fft_buffer
>>>> ?
>>>>
>>>> Please help me out.Thanks.

_____________________________________
Jeff,

Sampling frequency is working fine but I don't know why peaks occured at 16th
and 496th sample, respectively (figure attached). Shouldn't it appears at 128th
sample (Fs/N) ?
http://i35.tinypic.com/2psgakw.jpg
I also tried to scale the FFT magnitude to get the same amplitude as of input
signal (I Vp_p). I changed the sampled data from q15 format to floating point
then computed FFT but still it has higher values like 33 even dividing the FFT
madnitude with N (no. of FFT points) didn't work. Any suggestion please?

Best Regards.

________________________________
From: Jeff Brower
To: BS
Cc: c...
Sent: Wed, July 28, 2010 2:07:29 AM
Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function

BS-

> I added counter in the processbuffer() but it shows high value, I think I
>didn't
> place it at the right place.Can you please elaborate counter thing to verify
> sampling rate ?

I explained it already. What is your "high value"? How long did you let the
code run before measuring the counter?

How did you stop the code and how do you actually see the counter value?

-Jeff

> ________________________________
> From: Jeff Brower
> To: BS
> Cc: c...
> Sent: Tue, July 27, 2010 6:38:42 PM
> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
> BS-
>
>> There was some problem with twiddle generation code now FFT is working quite
>> fine with real time Sine input. Thanks a million for your kind help.
>
> Glad to hear you got some good results! Your plots look great. Must be very
> satisfying to get it working.
>
> Sounds like more basic debug on FFT-related routines revealed the problem.
>
> -Jeff
>
>> Plots for ping and pong buffer after magnitude computation are attached
below.
>>
>> PING BUFFER:
>> http://i31.tinypic.com/11j402d.jpg
>>
>> PONG BUFFER:
>> http://i25.tinypic.com/33bobgl.jpg
>>
>> I tried to change the sampling frequency following way but it doesn't seem to
>> work with the location of the peak appeard in the plots.
>> Uint32 fs = DSK6713_AIC23_FREQ_8KHZ;
>>
>> Jeff, I couldn't found the right place to add a counter. Can you please help
> me
>> with that ?
>>
>> Thanks.
>> ________________________________
>> From: Jeff Brower
>> To: BS
>> Cc: c...
>> Sent: Tue, July 20, 2010 7:40:21 PM
>> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
>> BS-
>>
>>> I did the same way you advised.
>>>
>>> Real data with 1 followed by 1023 zeros, and imaginary data all zero (1024
>>> values). Then took FFT and computed magnitude on 512 points. It gives value
>>>'1'
>>> for all 512 points, seems to work fine.
>>
>> That is correct result, so it seems your FFT is working Ok. The next step is
>>to
>> verify your sampling rate. Suggest
>> to add a counter to your code that receives audio input buffers, let the code
>> run for about 10 second, then check the
>> counter value. It should be approximately 78 (1024 pt buffers, 8 kHz
sampling
>> rate).
>>
>> If that works, then another thing you can do is a "fake" -- inside the buffer
>> receive code, fill each buffer with a
>> perfect 1024 pt sine wave (copy it from a table in mem, keep maximum
amplitude
>> low, like 128). This test is good
>> because:
>>
>> -timing is about the same; i.e. all code still
>> responds to interrupts and runs in real-time
>>
>> -in-between steps, like your CopyData()
>> function, are included in the test
>>
>> -you know exactly what to expect from your FFT
>> output, both shape and amplitude
>>
>> As Richard says, you have to go step-by-step and make no assumptions. There
>>can
>> be any number of small problems,
>> sorting them out can be tedious and take time. But if engineering were easy,
>> then everyone could do it :-)
>>
>> -Jeff
>>
>>> ________________________________
>>> From: Jeff Brower
>>> To: BS
>>> Cc: c...
>>> Sent: Mon, July 19, 2010 6:32:22 PM
>>> Subject: Re: [c6x] FFT result using DSPF_sp_cfftr2_dit Function
>>>
>>>
>>> BS-
>>>
>>> Suggest to first verify DSP_sp_cfftr2_dit() function, i.e. separate from
your
>>> audio input. For example, fill real
>>> data with 1 followed by 1023 zeros, and imaginary data all zero (all 1024
>>>values
>>> zero). Then calculate magnitude on
>>> 512 points.
>>>
>>> What do you get?
>>>
>>> -Jeff
>>>
>>>> I have been stuck with this FFT stuff since long and still I am unable to
>>>> verify the result. I am simply using dsk_app.c project for C6713 board and
>>>> implementing DSPLIB function DSPF_sp_cfftr2_dit to compute 1024 point FFT
>> over
>>>> 1024 complex pairs of input. I am going to explain over all steps which
has
>>>> been a part of my implementation. Please have a look if I am wrong any
>> where.
>>>>
>>>> I defined these parts in dsk_app.c project.
>>>>
>>>> #define BUFFSIZE 1024 // no. of FFT points
>>>> #pragma DATA_ALIGN(fft_buffer, 8)
>>>> float fft_buffer[2*BUFFSIZE]; // Length of input
>> data
>>>> #pragma DATA_ALIGN(twiddles, 8)
>>>> float twiddles[BUFFSIZE]; // twiddles of FFT
>>>> length (1024)
>>>> float fft_mag[BUFFSIZE];
>>>> short bitrev_table[BUFFSIZE]; // bitrev_table of FFT
>>>> length (1024)
>>>>
>>>> Following parts are already defined in dsk_app.c project as follows.
>>>>
>>>> Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING buffer
>>>> Int16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG buffer
>>>> Int16 gBufferRcvPing[BUFFSIZE]; // Receive PING buffer
>>>> Int16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffer
>>>>
>>>> In main(), I generated coefficient table.
>>>>
>>>> fft_r2_init(twiddles, BUFFSIZE, bitrev_table);
>>>> void fft_r2_init(float *w, int n, short *br_table)
>>>> {
>>>> int i;
>>>> gen_twiddle(w, n); // generate twiddle table of n/2 complex
>>>>twiddles
>>>> //bit_rev(w, n/2); // put twiddle table in bit-reversed order
>>>> DSPF_sp_bitrev_cplx((double *)w, br_table, n/2);
>>>> for(i=0; i >>>> br_table[i] = 0;
>>>> bitrev_index(br_table, n);
>>>> }
>>>>
>>>>
>>>> -processBuffer() - I processed audio data with in this function once it
>>>> received.
>>>>
>>>> For PING Buffer
>>>>
>>>> Here attached plot of gBufferRcvPing after getting 1024 samples of input.
> It
>>>> looks fine to me.
>>>> http://i31.tinypic.com/35lcc2a.jpg
>>>>
>>>> if (pingPong == PING) {
>>>> //The DSPf algorithms expect the real data in the even input buffer
>>>>locations
>>>> (2*k) and imaginary data in odd location (2*k+1)
>>>> for(k=0; k < 2*BUFFSIZE;
>>>> k++)
>>>>
>>>>
>>>> {
>>>> fft_buffer[2*k] = (float)gBufferRcvPing[k]; //real
>>>> fft_buffer[2*k+1] = 0.0; //imag
>>>> }
>>>>
>>>> Called FFT and bit reversed function.
>>>>
>>>> fft_r2(fft_buffer, twiddles, BUFFSIZE, bitrev_table);
>>>> void fft_r2(float *x, float *w, int n, short *br_table)
>>>> {
>>>> DSPF_sp_cfftr2_dit(x, w, n); // in-place FFT
>>>> DSPF_sp_bitrev_cplx((double *)x, br_table, n);
>>>> }
>>>>
>>>> Here attached plot of fft_buffer after FFT and bit reversal.
>>>> http://i31.tinypic.com/dq6cub.jpg
>>>>
>>>> Then calculated FFT magnitude and copied it back to gBufferRcvPing
buffer.
>>>> for(l=0; l < BUFFSIZE; l++)
>>>> {
>>>> fft_mag[l] = sqrt(fft_buffer[2*l]*fft_buffer[2*l] +
>>>> fft_buffer[2*l+1]*fft_buffer[2*l+1]);
>>>>
>>>> gBufferRcvPong[l] = (Int16)fft_mag[l];
>>>> }
>>>>
>>>> /* Copy receive PING buffer to transmit PING buffer */
>>>> copyData(gBufferRcvPing, gBufferXmtPing, BUFFSIZE);
>>>>
>>>> void copyData(Int16 *inbuf, Int16 *outbuf, Int16 length)
>>>> {
>>>> Int16 i = 0;
>>>>
>>>> for (i = 0; i < length; i++) {
>>>> outbuf[i] = inbuf[i];
>>>> }
>>>> }
>>>>
>>>>
>>>> Here attached plot of fft_mag after calculating magnitude of FFT
>> transform.
>>>> http://i30.tinypic.com/15wntlg.jpg
>>>>
>>>> I used the same approach for PONG Buffer.
>>>>
>>>> Here attached plot of fft_buffer after FFT and bit reversal for PONG
buffer.
>>>> http://i28.tinypic.com/acebv6.jpg
>>>>
>>>> and here find the plot of fft_mag after calculating magnitude of FFT
>>>> transform for PONG buffer.
>>>> http://i28.tinypic.com/2zemoo1.png
>>>>
>>>> Moreoever, I am not sure how much is the sampling frequency, default one
> is
>>>> 48Khz for dsk_app.c project, I changed the following parameter with in
>>> aic23.h
>>>> file to make it 8Khz but I don't know wheather its working fine or not.
>>>>
>>>> #define AIC23_DEFAULTPARAMS {
>>>> AIC23_REG8_8KHZ, }
>>>>
>>>> Is this this the right way to change Sampling Rate ?
>>>>
>>>> Where am I doing any thing wrong while calculating fft and magnitude ?
>>>>
>>>>
>>>> Why fft_mag doesn't show one clear peak for PING and PONG register ?
>>>>
>>>> Is there any thing wrong with the length of twiddles, BUFFSIZE and
>>>>fft_buffer
>>>> ?
>>>>
>>>> Please help me out.Thanks.