the coefficents ,a1,and a2, needed to be inverted in the IIR coefficents caculation procedure?
In the help document of sigma studio, it says as follows"
"...For each of these three filters, all the coefficients are divided by a0, normalizing them and making a0 = 1, so that only 5 coefficients must be stored.
In the implementation on the DSP, when the coefficients are stored in parameter RAM, a1 and a2 needed to be inverted. This is done in software before the parameters are written to memory."
How to understand "This is done in software before the parameters are written to memory"? Does it mean i should invert a1, and a2?
In this doucument, a1,and a2 are defined as:
a1 = 2*( (A-1) - (A+1)*cos(ω0) ) ; (1)
a2 = (A+1) - (A-1)*cos(ω0) - 2*sqrt(A)*alpha ; (2)
Now, according to the depiction above, whether I should add other two equations? like these,
a1=-a1; (3 )
a2=-a2 (4)
Than , for a simplified way, why could't I combine the 4 equations above to 2 ? just like this:
a1 = -( 2*( (A-1) - (A+1)*cos(ω0) )) ; (5)
a2 =-( (A+1) - (A-1)*cos(ω0) - 2*sqrt(A)*alpha) ; (6)
At this time, a1, a2 ,and b0,b1,b2 could be divided by a0. After this normalizing procedure, the five datas are the final coefficients, is't correct?
My quetion focus on the eqution (5), (6) -- Is it consistant with the meaning of "This is done in software before the parameters are written to memory"??
Thanks a lot!
Hello,
The short answer is yes, go ahead and flip the signs of your a coefficients in your microcontroller's program before safeloading them into the DSP. ADI's engineers set it up this way in order to save on instruction usage at runtime. Please see IIR filter implementation issues for more on this.
Best regards,
Bob
Thank you, Mr. Bob..
And would you like to explain something in detiled, why the a coefficients should be inverted before safeloading them into the DSP. Because in some paper, it seems there are no such procedure, and what we should do is just feed a coefficients to the algorithm program.
Thank with best regards!
Hello,
I'd like to explain it better, yet only the folks at ADI who designed the coding for the Sigma DSPs could really explain it in detail. Rest assured that the need to invert the a coefficients has nothing to do with generic DSP theory or the bi-linear transformations of analog filter types. Rather, it was found that inverting these coefficients beforehand streamlines the filters' calculations within the DSP itself. Apparently in some stage of the filter's execution, it was easier for the DSP to incorrectly invert the sign -- and we make up for it by inverting the sign going in. In other words, if we didn't invert the coefficients ourselves, the DSP would have more work to do -- 48000 or more times a second for every filter in your project. Inverting the signs on our end saves at least one instruction cycle every time the filter is invoked. Especially with the early DSPs like the ADAU1701, every instruction cycle is precious.
It always makes sense to pre-calculate operations wherever possible. This is often done in computer programming generally. For example, x*x executes faster than x^2, unless your spreadsheet or compiler is smart enough to recognize the shortcut.
Best regards,
Bob
HELLOL, Mr. Bob. How to understand "it was easier for the DSP to incorrectly invert the sign". You mentioned the DSP can invert the sign incorrectly by itself in some stage of the filter's execution. Why does it happend? Doesn't it mean the DSP could't follow the algorithm strictly, or the algorithm still has some bug needed bing make up ?Such as we have to invert the coefficients by ourselves.
Thanks a lot.
Hello,
This is not a bug.
As Bob says, the DSP inverts the a1 and a2 coefficients during processing. It is for efficiency in the DSP assembly code; a programming choice.
If you invert a1 and a2 in your microcontroller as described, the filters will work.
Regards,
Joshua
Please log in to reply.