Hi, Philipp,
I am glad to hear you have fixed the library issue.
Regarding the q15 FIR digital filter, I suppose you have to acquire the coefficents array with matlab or the other tools based on the application requirements, if the coefficents array is float type, and the absolute maximum element is greater than 1, you can divide each element of the coefficents with the absolute maximum element, in this way all the coeffiecnts in the array ranges from -1 to +1.
You can use the macro to transform the coeeicents to Q15.
#define FRAC16(x) 32768*x
#define TAPNUMBER 20
#define BLOCKSIZE 1
#define TOTAL_POINTS 100
#define Q15_OFFSET 0x4000
int16_t lpFilterCoefficent[TAPNUMBER]=
{
FRAC16(4.45556640625000e-003),
FRAC16(1.44042968750000e-002),
FRAC16(2.54516601562500e-002),
FRAC16(3.69873046875000e-002),
FRAC16(4.84619140625000e-002),
FRAC16(5.92041015625000e-002),
FRAC16(6.86950683593750e-002),
FRAC16(7.63244628906250e-002),
FRAC16(8.16650390625000e-002),
FRAC16(8.44116210937500e-002),
FRAC16(8.44116210937500e-002),
FRAC16(8.16650390625000e-002),
FRAC16(7.63244628906250e-002),
FRAC16(6.86950683593750e-002),
FRAC16(5.92041015625000e-002),
FRAC16(4.84619140625000e-002),
FRAC16(3.69873046875000e-002),
FRAC16(2.54516601562500e-002),
FRAC16(1.44042968750000e-002),
FRAC16(4.45556640625000e-003)
};
const arm_fir_instance_q15 sFirStru;
int16_t FirState[TAPNUMBER+BLOCKSIZE];
int16_t temp,temp1;
void main()
{
.....................
arm_fir_init_q15(&sFirStru,TAPNUMBER,&lpFilterCoefficent[0],&FirState[0],BLOCKSIZE);
arm_fir_fast_q15(&sFirStru,&temp,&temp1,1);
}
In the code, the temp is the latest sample(Note if the sample is in 16 bits, you should logic right shift one bit, because the MSB is regarded as sign. In other words, the MSB should be zero), temp1 is the filtered result. Generally, the arm_fir_fast_q15() should be put in the ADC ISR.
Hope it can help you
BR
xiangJun Rong