Sign in

username:

password:



Not a member?

Search c54x



Search tips

Subscribe to c54x



c54x by Keywords

5409 | 5416 | AD5 | ADC | BIOS | Boot | Booting | Bootloader | C540 | C5402 | C5409 | C5416 | CCS | Codec | DMA | Dmad | DSK | DSKPlus | Dsplib | EVM | FFT | FIR | Flash | GPIO | HPI | Initialization | Interrupt | JTAG | LOG_printf | MCBSP | RFFT | RTDX | Sampling | STLM | UART | VC540

Discussion Groups

Discussion Groups | TMS320C54x | RFFT from dsplib not working...

Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).

  

Post a new Thread

RFFT from dsplib not working... - pet_dsp - Oct 5 16:49:00 2004





Hello everybody,
I am wondering if any experts here could help solve
my problems with using rfft (routine from TI's dsplib) on a 5402 DSP.
Here is my scenario,

Codec --> DMA (block size = 256 samples) --> CPU (do 256-pt FFT) -->
see results by plotting a graph (in CCS).

The codec and DMA are setup correctly, the codec
input is a 1Khz sine wave, and the codec samples @ 40KHz. I can see
the input data in the dma destination buffer and it looks good. I
copy the DMA destination buffer to an array x which is defined as,

#define NX 256
#pragma DATA_SECTION (x,".inputdata")
DATA x[NX];

The data copied into 'x' is not corrupted in any
way, i checked that. Now i am trying to do a 256-pt real FFT using
the rfft routine from TI's dsplib library. This is the way i invoke
rfft,

cbrev(x,x,NX/2);
rfft(x,NX,1);

After this when i plot 'x', i don't see a single
peak in the frequency domain, rather the o/p looks like the FFT of
some broadband audio. Can somebody please explain what i am doing
wrong?

Thanks in advance,
Deepak.





(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: RFFT from dsplib not working... - Jeff Brower - Oct 5 20:53:00 2004

Deepak-

You are trying to debug too much at one time. Try passing this to rfft():

-x[0] = 1
-x[2, 4, ...NX-2] = 0
-x[1, 3, ...NX-1] = 0

That should produce all 1's in the magnitude domain (remember your basic impulse
response, haha). If you don't get a correct result, then you know cbrev() or
rfft()
is the problem. You can try the same thing without calling cbrev() and
eliminate it
as well. Otherwise your audio/dma is the problem (which I suspect).

-Jeff pet_dsp wrote:
>
> Hello everybody,
> I am wondering if any experts here could help solve
> my problems with using rfft (routine from TI's dsplib) on a 5402 DSP.
> Here is my scenario,
>
> Codec --> DMA (block size = 256 samples) --> CPU (do 256-pt FFT) -->
> see results by plotting a graph (in CCS).
>
> The codec and DMA are setup correctly, the codec
> input is a 1Khz sine wave, and the codec samples @ 40KHz. I can see
> the input data in the dma destination buffer and it looks good. I
> copy the DMA destination buffer to an array x which is defined as,
>
> #define NX 256
> #pragma DATA_SECTION (x,".inputdata")
> DATA x[NX];
>
> The data copied into 'x' is not corrupted in any
> way, i checked that. Now i am trying to do a 256-pt real FFT using
> the rfft routine from TI's dsplib library. This is the way i invoke
> rfft,
>
> cbrev(x,x,NX/2);
> rfft(x,NX,1);
>
> After this when i plot 'x', i don't see a single
> peak in the frequency domain, rather the o/p looks like the FFT of
> some broadband audio. Can somebody please explain what i am doing
> wrong?
>
> Thanks in advance,
> Deepak.






(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: RFFT from dsplib not working... - pet_dsp - Oct 5 21:52:00 2004



Jeff,
Just figured out the problem. The problem is with the memory
alignment of the array 'x' that is input to the cbrev funtion.
Document spru518c (p-33) says, "input data (x) must be aligned
at 2*nx boundary. The log(nx) + 1 LSBits of address x must be zero."
I did not align 'x' on a 512-word boundary (log(256)+1 LSB's must
have been 0). Once i fixed this in the linker definition file, i got
the fft results as expected for a sine wave input.
Anyways, thank you for a useful debugging tip.

Best regards,
Deepak. --- In , Jeff Brower <jbrower@s...> wrote:
> Deepak-
>
> You are trying to debug too much at one time. Try passing this to
rfft():
>
> -x[0] = 1
> -x[2, 4, ...NX-2] = 0
> -x[1, 3, ...NX-1] = 0
>
> That should produce all 1's in the magnitude domain (remember your
basic impulse
> response, haha). If you don't get a correct result, then you know
cbrev() or rfft()
> is the problem. You can try the same thing without calling cbrev()
and eliminate it
> as well. Otherwise your audio/dma is the problem (which I
suspect).
>
> -Jeff > pet_dsp wrote:
> >
> > Hello everybody,
> > I am wondering if any experts here could help
solve
> > my problems with using rfft (routine from TI's dsplib) on a 5402
DSP.
> > Here is my scenario,
> >
> > Codec --> DMA (block size = 256 samples) --> CPU (do 256-pt FFT) -
->
> > see results by plotting a graph (in CCS).
> >
> > The codec and DMA are setup correctly, the codec
> > input is a 1Khz sine wave, and the codec samples @ 40KHz. I can
see
> > the input data in the dma destination buffer and it looks good. I
> > copy the DMA destination buffer to an array x which is defined as,
> >
> > #define NX 256
> > #pragma DATA_SECTION (x,".inputdata")
> > DATA x[NX];
> >
> > The data copied into 'x' is not corrupted in any
> > way, i checked that. Now i am trying to do a 256-pt real FFT using
> > the rfft routine from TI's dsplib library. This is the way i
invoke
> > rfft,
> >
> > cbrev(x,x,NX/2);
> > rfft(x,NX,1);
> >
> > After this when i plot 'x', i don't see a
single
> > peak in the frequency domain, rather the o/p looks like the FFT of
> > some broadband audio. Can somebody please explain what i am doing
> > wrong?
> >
> > Thanks in advance,
> > Deepak.





(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: Re: RFFT from dsplib not working... - Jeff Brower - Oct 6 17:49:00 2004

Deepak-

> Just figured out the problem. The problem is with the memory
> alignment of the array 'x' that is input to the cbrev funtion.
> Document spru518c (p-33) says, "input data (x) must be aligned
> at 2*nx boundary. The log(nx) + 1 LSBits of address x must be zero."
> I did not align 'x' on a 512-word boundary (log(256)+1 LSB's must
> have been 0). Once i fixed this in the linker definition file, i got
> the fft results as expected for a sine wave input.
> Anyways, thank you for a useful debugging tip.

Ok then you're on your way. The 2*nx alignment is because the .asm language
instructions inside rfft() uses a chip-level "circular address mode". Some DSP
devices even offer "bit-reversed" addressing mode.

-Jeff

> --- In , Jeff Brower <jbrower@s...> wrote:
> > Deepak-
> >
> > You are trying to debug too much at one time. Try passing this to
> rfft():
> >
> > -x[0] = 1
> > -x[2, 4, ...NX-2] = 0
> > -x[1, 3, ...NX-1] = 0
> >
> > That should produce all 1's in the magnitude domain (remember your
> basic impulse
> > response, haha). If you don't get a correct result, then you know
> cbrev() or rfft()
> > is the problem. You can try the same thing without calling cbrev()
> and eliminate it
> > as well. Otherwise your audio/dma is the problem (which I
> suspect).
> >
> > -Jeff
> >
> >
> > pet_dsp wrote:
> > >
> > > Hello everybody,
> > > I am wondering if any experts here could help
> solve
> > > my problems with using rfft (routine from TI's dsplib) on a 5402
> DSP.
> > > Here is my scenario,
> > >
> > > Codec --> DMA (block size = 256 samples) --> CPU (do 256-pt FFT) -
> ->
> > > see results by plotting a graph (in CCS).
> > >
> > > The codec and DMA are setup correctly, the codec
> > > input is a 1Khz sine wave, and the codec samples @ 40KHz. I can
> see
> > > the input data in the dma destination buffer and it looks good. I
> > > copy the DMA destination buffer to an array x which is defined as,
> > >
> > > #define NX 256
> > > #pragma DATA_SECTION (x,".inputdata")
> > > DATA x[NX];
> > >
> > > The data copied into 'x' is not corrupted in any
> > > way, i checked that. Now i am trying to do a 256-pt real FFT using
> > > the rfft routine from TI's dsplib library. This is the way i
> invoke
> > > rfft,
> > >
> > > cbrev(x,x,NX/2);
> > > rfft(x,NX,1);
> > >
> > > After this when i plot 'x', i don't see a
> single
> > > peak in the frequency domain, rather the o/p looks like the FFT of
> > > some broadband audio. Can somebody please explain what i am doing
> > > wrong?
> > >
> > > Thanks in advance,
> > > Deepak.
>
> _____________________________________ > Yahoo! Groups Links




(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )