Forum: µC & Digital Electronics IIR filter on AT91SAM7S256

von Alex T. (yoni)

Rate this post
not useful
Hi guys,
i am implementing a traditional IIR filter of this kind:
accum1=(*i_o * coefvect[0]) + (coefvect[1]* dline[0]) + (coefvect[2]*dline[1]);
accum1= accum1 >> scalefactor; //scaling
accum2=(accum1 * coefvect[3])+ (coefvect[4]*dline[0]) + (coefvect[5]*dline[1]);
accum2=accum2 >> scalefactor; //scaling
dline[1]=dline[0]; //move delay line
*i_o=(accum2 >> 1); //output

all registers, coefficients and buffers are 32 bits long integer types.

i acquire 1024 samples from the ADC and i then pass the buffer to the
filter. The filter executes in 3mS (obviously this is the time it takes
to process 1024 samples, not just one) and i am wondering why it seems 
to take so long to compute; i was expecting something better.

I am using the AT91SAM7S-EK adapting an example of GCC-Winarm for this
board. The clock seems to be 48MHz internally multiplied (i haven't
changed any other parameter in microcontroller configuration or board 
I also tried to vary the optimization level (original was Os, i tried 
and to move the IIR filter into an external module compiled with ARM
(not thumb) instructions.
The only differences i noted changing these parameters, were slight
differences in the final size of the compiled file: the filter execution
speed remained practically always the same.

My question is this: are there any methods to speed up execution?
Have i to struggle coding the filter part in assembler or it is not
a good deal? I should, at least, halve the execution speed.
I see that there is an mp3 player project based on this microcontroller,
so i think that if it can handle the burden of decoding an mp3 stream
it should be able to compute a simple iir biquad.

I close saying that i am an absolute beginner with ARMs and Winarm,
and i would thank in advance anyone who 'll answer.


von Kar (Guest)

Rate this post
not useful
You could try moving the filter code to the ram. This should increase 
the speed significantly on AT91. Have a look at the mentioned mp3 player 
project and search for "ramfunc" or something similar.

von Alex T. (yoni)

Rate this post
not useful

now i'm a bit occupied in other tasks. As soon as i'll put my hands 
again on the ARM i'll publish the results.

Many thanks.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.