AnsweredAssumed Answered

More FFT Accel

Question asked by maboytim on May 13, 2010
Latest reply on May 14, 2010 by maboytim

I saw the thread on the FFT accelerator and the 2048 point example but am still confused.


I am doing a 256 point FFT which should be the simple case.  I have it working, I just don't really understand it.


Like the person in the other thread, I also can't seem to do a second FFT without either resetting the FFT or explicitly moving it to idle.  My code is below:


#define FFT_N 256
#define FFT_LOG_N 8


   // select fft accel
   *pPMCTL1 = (*pPMCTL1 & ~(BIT_17 | BIT_18)) | FFTACCSEL;


   // doing nothing doesn't work
   //*pFFTCTL1 = FFT_RST; // works but needs 3 nop's
   *pFFTCTL1 = FFT_EN | FFT_DMAEN; // works with 2 nop's
   //*pFFTCTL1 = FFT_START; // doesn't work
   //*pFFTCTL1 = 0xE; // doesn't work (recommendation from FFT accel thread)


   *pFFTCTL2 = FFT_CPACKIN | FFT_CPACKOUT | (FFT_LOG_N << 3) | ((FFT_N/16) << 7);

   *pCPIFFT = (int)&TCB_FFT_w.IIFFTx - OFFSET | BIT_20;
   *pCPOFFT = (int)&TCB_FFT_y.OIFFTx - OFFSET;


   // wait for fft to complete


It hangs in the spin loop if I don't reset or move the FFT accel explicitly through idle after the first time (first time out or chip reset is okay).  Somewhere I got the impression that two instruction cycles are needed after selecting the accelerator, maybe from and FIR discussion or example, but for some reason if I reset the FFT I need three cycles instead of two, if I explicitly put in idle I can use two nop's.  If I use less than two I get stuck in my spin loop.


Okay, so instead I decided to just leave the FFT disabled so it is ready to go for next time by writing 0 to FFTCTL1 after my spin loop and that didn't work.  It seems like I have to  first move it to idle then disable.  Or resetting the FFT seems to work.

   // wait for fft to complete

   // leave fft accel ready for next time
   //*pFFTCTL1 = 0; // doesn't work
   *pFFTCTL1 = FFT_EN; *pFFTCTL1 = 0; // combination works

   //*pFFTCTL1 = FFT_RST; // works

So I guess my question is, what is the right way to do this?