Dear All,
I'm puzzled with results I'm getting from using the arm_fir_decimate_q15 function in CMSIS DSP_Lib, and I'd like to clarify if I use the function correctly. Any help would be really much appreciated.
This is the background: I try to program a digital lock-in loop, where an input signal is multiplied with a reference signal and then low pass filtered in three FIR filter/decimation stages. In my simple mock-up example (code attached below) the input signal is generated as a 12 bit (approximate) sine with a frequency of 2500 Hz and is sampled with 100 kHz into a buffer of size 8192. This buffer is then separately multiplied by sine and cosine functions with a lock frequency of 2500 Hz (same as the signal frequency). The three filter stages involve FIR filters with 63, 127 and 511 taps and decimation factors of 32, 32 and 8. FIR coefficients are calculated with matlab fir1 and cutoff frequencies are 1/32 1/32 and 1/8 of the Nyquist frequency. Unfortunately, after filtering and decimating the convoluted signals are not as expected. Also the signal output does not stabilize (figure of output with buffer frames also attached). Is there a problem with overflow? I checked the arm_fir_decimate_q15 code but cannot find anything wrong.
Can someone please help and tell me were I'm going wrong using arm_fir_decimate?
Thanks, Tom
It might be worth it to try the same experiment with arm_fir_decimate_f32 to see if its a numerical issue or a use case issue. I took a look at your code, and nothing obvious jumps out, but it's a bit more complex than just a simple arm_fir_decimate example.