AnsweredAssumed Answered

Misaligned Access at PC during FFT in BF506F Simulator

Question asked by nhmood on Mar 27, 2012
Latest reply on Apr 9, 2012 by jobo23

Hi everyone,

 

I am currently trying to perform a simple FFT on a set of data and have it be stored on the Flash memory available on the BF506F but am having some trouble getting it to work. I was able to perform the same procedure without using the Flash having a smaller FFT size without any problem but when I increase the FFT size and try to store the output in Flash memory I receive "Exception: #12 DAG0ALGN:DAG0 Misaligned Access at PC 0xffa00c16" I am currently trying this on the BF506F ADSP-BF5xx Single Processor Simulator in VisualDSP++ 5.0 Update 10.

 

My code is the following:

 

 #include <fract.h>
#include <complex.h>
#include <filter.h>
#include <math.h>
#include <stdio.h>
#include "fft_input.h"


#pragma section("FLASH_data")
complex_fract32 IN[SIZE];
#pragma section("FLASH_data")
complex_fract32 OUT[SIZE];
#pragma section("FLASH_data")
complex_fract32 twid[SIZE/2];

   
void main(void)
{
  
          int i = 0, j = 0, k=0;                    // index
          int twiddle_stride = 1;                    // twiddle stride(???)
          int block_exponent = 0;                    // block exponent(???)
          int scale_method = 1;                    // static scaling for minimal behavior change
                                                                                // 0 = no scaling, 2 = dynamic scaling
  
  
  
          for (i = 0; i < SIZE; i++)
          {
                    IN[i].re = reIN[i];
                    IN[i].im = 0;
  
          } 
  
          twidfftrad2_fr32(twid, SIZE);
          cfftf_fr32(IN, OUT, twid, twiddle_stride, SIZE);
  
  
  
          printf("done\n");


}

 

The fft_input.h file is simply a fract32 array (called reIN) that contains my data set (2560 points). To my understanding (from what I have read) it is possible to place data in flash by simply including the #pragma section("FLASH_data") prior to initializing the data, and this seems to work for finding the twiddle table (twidfftrad2_fr32). However, when I step through my program in VisualDSP++ I immediately go into the "unknown_exception_occurred" section in the Disassembly.

I have also read here that I might need to align my output, twid, and input buffers using #pragma align size, but after trying various different combinations (without any real idea what values to use) I was unsuccessful in fixing the Misaligned Access problem.


I was hoping someone could lead me in the right direction for how I could go properly accessing/storing data to the internal Flash memory. Also, I'm fairly new to this so excuse any of my blatant mistakes!

 

 

Thanks

Outcomes