I'm quite new to DSP and am trying to implement an adaptive FIR filter for active noise cancellation on the ADZS-21369-EZLITE evaluation Board.
The desired number of coefficients is around 300. The first thing that came to my mind, was whether the processing to adapt the coefficients (using LLMS) and generate an output sample is fast enough. I've adapted the block-based talk through (C) to give my processing function one sample at a time.
Programming my algorithm straightforward (without using compiler/hardware-specific code) got me two loops. The compiler optimized the first one to have 4 cycles (trip count is half the number of coefficients-1):
[Info] This loop executes 2 iterations of the original loop in estimated 4 cycles.
[Info] Trip count = 149
and the other one is executed in 9 cycles (trip count=no. of coefficients-1)
[Info] This loop executes 1 iteration of the original loop in estimated 9 cycles.
[Info] Trip count = 299
This gives me 3287 instructions to be carried out between to samples (for my estimation I ignored the overhead). Multiplying it with the instruction cycle time (2.5ns) tells me that the generation of each output sample takes around 8,2µs. Given a sample frequency of 96kHz (2 channels, each 48kHz) means that the SPORTisr is called every 10.4µs. Enough time for my algorithm... At least in theory. Can anyone who has a better understanding of DSP confirm my estimation? Problem is, when I run the code (even with only 150 coefficients) it stucks in the "ProcessingTooLong" function
After running into this problem I dug deeper into the compiler manual and found the builtin-functions for fir filtering. I tried to use them for my problem but I don't know how: I get an error signal from the ADC which I use to adapt the FIR coefficients. The FIR is then applied to a sound template which is stored in the SDRAM (the noise I'm targeting is periodic about every 0.5s). My understanding is, that I apply the coefficients to the template's samples (depends on how many coefficients) and get ONE new value which I then send to the DAC. Why does the fir_vec function alter an ARRAY of output samples?
Please excuse any using of wrong terminology and don't hesitate to correct it . Sadly there's no DSP lecture in my studies so I have to figure everything out by myself for my master's thesis :/.
Thanks in advance,