Sign in

username:

password:



Not a member?

Search motoroladsp



Search tips

Subscribe to motoroladsp



motoroladsp by Keywords

56303 | 563xx | 5680 | 56805 | 5680x | 56F80 | 56F800DEMO | 56F805 | 56f807 | 56F830 | ADC | Bootloader | Codec | CodeWarrior | CW5 | CW6 | Debugger | DSP56303 | DSP56303EVM | DSP563xx | DSP5680 | DSP56800 | DSP56807 | DSP56858 | DSP56858EVM | DSP56F803 | DSP56F805 | DSP56F807 | DSP56F80x | DSP56F826 | DSP56F827 | DSP56F8xx | EVM | FFT | Flash_over_jtag | GPIO | Interrupt | Interrupts | JTAG | LCD | Linker | MCF5307 | Metrowerks | Modulus | MSCAN | PCMaster | PWM | Quad | Rif | RTOS | SDK | SPI

Discussion Groups

Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).

  

Post a new Thread

FFT 56807 - Marius Goosen - Sep 6 7:19:34 2007



Hi,

I am really new at programming a DSP, and a simple task is starting to cause
me some trouble.

I'm using the Motorola 56807 EVM with Cosewarrior and PE. I want to
calculate a simple FFT and transmit the data serially to the PC.

The problem is that as soon as I call the FFT function nothing happens?

I tested my ADC to serial connection and it worked fine but it stops working
when I implement the FFT.

I am using the FFT code as is in the help file:
#include "DFR1.h"

#include "MEM1.h"

#include "MFR1.h"
Frac16 pX[128];

dfr16_tRFFTStruct *pRFFT;

dfr16_sInplaceCRFFT *pZ;

UInt16 options = FFT_DEFAULT_OPTIONS;
  pRFFT = dfr16RFFTCreate (8, options); /* N = 128 point RFFT */

   res = dfr16RFFT (pRFFT, pX, pZ);                  /*Do the FFT*/

It seems to get stuck at the last line of code. If I comment it out
everything works fine but as soon as I include it the rest does not work

PLEASE HELP.

What am I doing wrong?



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

Re: FFT 56807 - wich...@op.pl - Sep 13 16:23:22 2007

void calcAmplitude(short * values, volatile word * amp)
{
	//find fft plot	
	static int cnt1;
	static long ampReal = 0;
	static long ampImag = 0;
	static long ampTemp = 0;
	static CFrac16 outFFTTable [FFT_SAMPLES/2+1];
	static int j;

	//perform fft and save values on the output table
	DFR1_dfr16RFFT(fftPointer,&values[0], (dfr16_sInplaceCRFFT *)&outFFTTable[0] );

        //take the first value from fft 	
        ampReal = outFFTTable[1].real;
ampImag = outFFTTable[1].imag;				
ampTemp = (ampReal*ampReal + ampImag*ampImag);

}
fftPointer = DFR1_dfr16RFFTCreate(FFT_SAMPLES, FFT_SCALE_RESULTS_BY_N|
FFT_INPUT_IS_BITREVERSED);

static CFrac16 outFFTTable [FFT_SAMPLES/2+1];

//perform fft and save values on the output table
DFR1_dfr16RFFT(fftPointer,&values[0], (dfr16_sInplaceCRFFT *)&outFFTTable[0] );
Hi,
>
>I am really new at programming a DSP, and a simple task is starting to cause
>me some trouble.
>
>I'm using the Motorola 56807 EVM with Cosewarrior and PE. I want to
>calculate a simple FFT and transmit the data serially to the PC.
>
>The problem is that as soon as I call the FFT function nothing happens?
>
>I tested my ADC to serial connection and it worked fine but it stops working
>when I implement the FFT.
>
>I am using the FFT code as is in the help file:
>#include "DFR1.h"
>
>#include "MEM1.h"
>
>#include "MFR1.h"
>Frac16 pX[128];
>
>dfr16_tRFFTStruct *pRFFT;
>
>dfr16_sInplaceCRFFT *pZ;
>
>UInt16 options = FFT_DEFAULT_OPTIONS;
>  pRFFT = dfr16RFFTCreate (8, options); /* N = 128 point RFFT */
>
>   res = dfr16RFFT (pRFFT, pX, pZ);                  /*Do the FFT*/
>
>It seems to get stuck at the last line of code. If I comment it out
>everything works fine but as soon as I include it the rest does not work
>
>PLEASE HELP.
>
>What am I doing wrong?



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

Re: FFT 56807 - wich...@op.pl - Sep 13 16:24:22 2007

Hi

Sorry for the previous post, I accidentally pressed "Send Message"...Below there is a
code that works perfectly for me. FFT_SAMPLES should be 8, 16, 32, etc. See: CodeWarrior help.
Good luck!

dfr16_tRFFTStruct* fftPointer; //pointer to fft struct
fftPointer = DFR1_dfr16RFFTCreate(FFT_SAMPLES,
FFT_SCALE_RESULTS_BY_N|FFT_INPUT_IS_BITREVERSED);//initialize fftPointer, for example in
main...

//this is my function for calculating amplitude of sin signal
void calcAmplitude(short * values, volatile word * amp)
{
	static int cnt1;
	static long ampReal = 0;
	static long ampImag = 0;
	static long ampTemp = 0;
	static CFrac16 outFFTTable [FFT_SAMPLES/2+1];

	//perform fft and save values on the output table
	DFR1_dfr16RFFT(fftPointer,&values[0], (dfr16_sInplaceCRFFT *)&outFFTTable[0] );
	
	//take the first value from fft. I do it, because I know, that for me the first value is the
one I'm intersted in (I allways obtain single sine wave, 0-2pi).
	
	ampReal = outFFTTable[1].real;
	ampImag = outFFTTable[1].imag;				
	ampTemp = (ampReal*ampReal + ampImag*ampImag);			
	
}
Hi,
>
>I am really new at programming a DSP, and a simple task is starting to cause
>me some trouble.
>
>I'm using the Motorola 56807 EVM with Cosewarrior and PE. I want to
>calculate a simple FFT and transmit the data serially to the PC.
>
>The problem is that as soon as I call the FFT function nothing happens?
>
>I tested my ADC to serial connection and it worked fine but it stops working
>when I implement the FFT.
>
>I am using the FFT code as is in the help file:
>#include "DFR1.h"
>
>#include "MEM1.h"
>
>#include "MFR1.h"
>Frac16 pX[128];
>
>dfr16_tRFFTStruct *pRFFT;
>
>dfr16_sInplaceCRFFT *pZ;
>
>UInt16 options = FFT_DEFAULT_OPTIONS;
>  pRFFT = dfr16RFFTCreate (8, options); /* N = 128 point RFFT */
>
>   res = dfr16RFFT (pRFFT, pX, pZ);                  /*Do the FFT*/
>
>It seems to get stuck at the last line of code. If I comment it out
>everything works fine but as soon as I include it the rest does not work
>
>PLEASE HELP.
>
>What am I doing wrong?



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