Posted on:
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 dline[0]=accum1; *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
Posted on:
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.
Posted on:
Great, 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.