IIR filter on AT91SAM7S256

OP #1536741
Rate this post
• ▲ useful
▼ not useful
Hi guys,
i am implementing a traditional IIR filter of this kind:
1
accum1=(*i_o * coefvect[0]) + (coefvect[1]* dline[0]) + (coefvect[2]*dline[1]);
2
accum1= accum1 >> scalefactor; //scaling
3
accum2=(accum1 * coefvect[3])+ (coefvect[4]*dline[0]) + (coefvect[5]*dline[1]);
4
accum2=accum2 >> scalefactor; //scaling
5
dline[1]=dline[0]; //move delay line
6
dline[0]=accum1;
7
*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 
setup).
I also tried to vary the optimization level (original was Os, i tried 
O2)
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.

Bye

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.