Hello again,
after some try outs with my EVM I tried to implement a own ring buffer FIR in C like this example:
http://www.fh-schmalkalden.de/schmalkaldenmedia/Realisierung_Digitaler_Filter_in_C.pdf
I use Q15 coefficients placed in the DARAM. But I`m irritated about the result because I get a offset of half the filter length under the ideal result (cross tested in Matlab, with the DSPLib fir function AND with the same function but with float coefficients).
Here comes the code:
void calculate2(Uint16 newsample){
short resBuff;
db[zeiger2]=newsample;
//Inkrementiere counter2 Modulo NH
zeiger2=(zeiger2+1) % NH;
resBuff=0;
for(counter1=0;counter1 < NH; counter1++){
resBuff += (short)(((long)h[counter1] * (long)db[(zeiger2 + counter1) % NH])>>15);
}//for counter1
trxBuff.result[trxBuff.InPtr]=resBuff;
}
Maybe some kind of overflow or truncating? I`m relly helpless about it.