
Technical discussions about the TI C55x DSPs (including the c5501, c5502, c5503, c5507, c5509, c5510 and OMAP5910).
Hi,
I am having a problem trying to implement an IIR filter on an TI c55x.
I have calculated the filter on matlab getting the following
coefficients for 2 second order sections:
SOS
1.0000 1.6854 1.0000 1.0000 -1.7197 0.8565
1.0000 -1.9999 1.0000 1.0000 -1.8899 0.9250
G
1.0000
0.1041
1.0000
Simulations perform as expected.
Since the coefficients are between ]-2..2[ I transform the SOS matrix
as SOS_fix = SOS*2^14:
SOS_fix
16384 27614 16384 16384 -28175 14033
16384 -32766 16384 16384 -30964 15155
The question is: can I run this coefficients on iircas5 of the TI
dsplib? I know dsplib is Q.15 while my coefficients are Q.14, but I
suppose this is not a problem if the filter's input is small enough not
to cause any overflow. Unfortunately this does not work, the output is
completely wrong.
The second think I tried was to multiply the numerator coefficients of
the second section of the filter by 0.1041 (according to G), before
converting them to Q.14, getting this:
SOS_fix_G
16384 27614 16384 16384 -28175 14033
1706 -3412 1706 16384 -30964 15155
But this also does not work.
Does anyone have any idea how I should convert my coefficients in order
to work with iircas5?
Thanks.
Christian
______________________________
New Year Gift for Members of DSPRelated.com. Details here.Firstly, did you check whether the coefficients account for a stable filter? Secondly, you can ask MATLAB to give you fixed point coefficients directly. That way you would eliminate the possibility of forming an unstable filter. And finally, when you say that the output is completely wrong, how do you check it? ~ R K Hi, >I am having a problem trying to implement an IIR filter on an TI c55x. >I have calculated the filter on matlab getting the following >coefficients for 2 second order sections: > >SOS > 1.0000 1.6854 1.0000 1.0000 -1.7197 0.8565 > 1.0000 -1.9999 1.0000 1.0000 -1.8899 0.9250 >G > 1.0000 > 0.1041 > 1.0000 > >Simulations perform as expected. >Since the coefficients are between ]-2..2[ I transform the SOS matrix >as SOS_fix = SOS*2^14: > >SOS_fix > 16384 27614 16384 16384 -28175 14033 > 16384 -32766 16384 16384 -30964 15155 > >The question is: can I run this coefficients on iircas5 of the TI >dsplib? I know dsplib is Q.15 while my coefficients are Q.14, but I >suppose this is not a problem if the filter's input is small enough not >to cause any overflow. Unfortunately this does not work, the output is >completely wrong. > >The second think I tried was to multiply the numerator coefficients of >the second section of the filter by 0.1041 (according to G), before >converting them to Q.14, getting this: > >SOS_fix_G > 16384 27614 16384 16384 -28175 14033 > 1706 -3412 1706 16384 -30964 15155 > >But this also does not work. > >Does anyone have any idea how I should convert my coefficients in order >to work with iircas5? > >Thanks. > >Christian ______________________________ New Year Gift for Members of DSPRelated.com. Details here.
Thanks RK, Yes, I am using fdatool, which guaranties that the filter is stable. I have also asked matlab to give fixed point coefs, and they where exactly like mine. I checked the filter I have run it both in a DSK with hard-coded input signal and with the c5510 simulator having the same result. Nevertheless in the mean time I managed to have some useful results from the filter. Using the coefs "SOS_fix_G" and scaling (left shifting) the input signal so that it's max value is not grater than 64. But of course in this way I loose a lot of bits in precision because of increased quantization noise. Any ideas? Thanks. c r...@gmail.com ha scritto: > Firstly, did you check whether the coefficients account for a stable > filter? > Secondly, you can ask MATLAB to give you fixed point coefficients > directly. That way you would eliminate the possibility of forming an > unstable filter. > And finally, when you say that the output is completely wrong, how do > you check it? > > ~ R K > > Hi, > >I am having a problem trying to implement an IIR filter on an TI c55x. > >I have calculated the filter on matlab getting the following > >coefficients for 2 second order sections: > > > >SOS > > 1.0000 1.6854 1.0000 1.0000 -1.7197 0.8565 > > 1.0000 -1.9999 1.0000 1.0000 -1.8899 0.9250 > >G > > 1.0000 > > 0.1041 > > 1.0000 > > > >Simulations perform as expected. > >Since the coefficients are between ]-2..2[ I transform the SOS matrix > >as SOS_fix = SOS*2^14: > > > >SOS_fix > > 16384 27614 16384 16384 -28175 14033 > > 16384 -32766 16384 16384 -30964 15155 > > > >The question is: can I run this coefficients on iircas5 of the TI > >dsplib? I know dsplib is Q.15 while my coefficients are Q.14, but I > >suppose this is not a problem if the filter's input is small enough not > >to cause any overflow. Unfortunately this does not work, the output is > >completely wrong. > > > >The second think I tried was to multiply the numerator coefficients of > >the second section of the filter by 0.1041 (according to G), before > >converting them to Q.14, getting this: > > > >SOS_fix_G > > 16384 27614 16384 16384 -28175 14033 > > 1706 -3412 1706 16384 -30964 > 15155 > > > >But this also does not work. > > > >Does anyone have any idea how I should convert my coefficients in order > >to work with iircas5? > > > >Thanks. > > > >Christian > > > > ______________________________ New Year Gift for Members of DSPRelated.com. Details here.
The order of the coefficients....each iir function of CCS takes in a different sequence of the coefficients. Check whether you have them correct. I wonder how you got an input signal with max value not greater than 64 after left shifting. You are supposed to perform a right shift to limit a value, not a left shift. Check that. And, check the overflow flag after the call of the iir function. It being set may not be a good sign. ~ R K Thanks RK, >Yes, I am using fdatool, which guaranties that the filter is stable. I >have also asked matlab to give fixed point coefs, and they where exactly >like mine. >I checked the filter I have run it both in a DSK with hard-coded input >signal and with the c5510 simulator having the same result. > >Nevertheless in the mean time I managed to have some useful results from >the filter. Using the coefs "SOS_fix_G" and scaling (left shifting) the >input signal so that it's max value is not grater than 64. But of course >in this way I loose a lot of bits in precision because of increased >quantization noise. Any ideas? > >Thanks. > >c >r...@gmail.com ha scritto: >> Firstly, did you check whether the coefficients account for a stable >> filter? >> Secondly, you can ask MATLAB to give you fixed point coefficients >> directly. That way you would eliminate the possibility of forming an >> unstable filter. >> And finally, when you say that the output is completely wrong, how do >> you check it? >> >> ~ R K >> >> Hi, >> > I am having a problem trying to implement an IIR filter on an TI c55x. >> > I have calculated the filter on matlab getting the following >> > coefficients for 2 second order sections: >> > >> > SOS >> > 1.0000 1.6854 1.0000 1.0000 -1.7197 0.8565 >> > 1.0000 -1.9999 1.0000 1.0000 -1.8899 0.9250 >> > G >> > 1.0000 >> > 0.1041 >> > 1.0000 >> > >> > Simulations perform as expected. >> > Since the coefficients are between ]-2..2[ I transform the SOS matrix >> > as SOS_fix = SOS*2^14: >> > >> > SOS_fix >> > 16384 27614 16384 16384 -28175 14033 >> > 16384 -32766 16384 16384 -30964 15155 >> > >> > The question is: can I run this coefficients on iircas5 of the TI >> > dsplib? I know dsplib is Q.15 while my coefficients are Q.14, but I >> > suppose this is not a problem if the filter's input is small enough not >> > to cause any overflow. Unfortunately this does not work, the output is >> > completely wrong. >> > >> > The second think I tried was to multiply the numerator coefficients of >> > the second section of the filter by 0.1041 (according to G), before >> > converting them to Q.14, getting this: >> > >> > SOS_fix_G >> > 16384 27614 16384 16384 -28175 14033 >> > 1706 -3412 1706 16384 -30964 >> 15155 >> > >> > But this also does not work. >> > >> > Does anyone have any idea how I should convert my coefficients in order >> > to work with iircas5? >> > >> > Thanks. >> > >> > Christian >> > >> > ______________________________ New Year Gift for Members of DSPRelated.com. Details here.
thanks Misan, thanks RK: indeed this was the problem... I have successfully implemented the filter now. CN nasim ahmed ha scritto: > hi christian, > u r trying to get q14 fixed point format but dsplib > has q15 format, i suggest u to use both in same format . u can > multiply with 2^15 . And two q15 multiplication results q2.30. here 2 > sign bit presents so u hav to modify that according to ur desired > output format. i hope it will help u , if u hav any prob u can send me > message. > > regards misan > > */Christian Narvaez <c...@gmx.net>/* wrote: > > Hi, > I am having a problem trying to implement an IIR filter on an TI c55x. > I have calculated the filter on matlab getting the following > coefficients for 2 second order sections: > > SOS > 1.0000 1.6854 1.0000 1.0000 -1.7197 0.8565 > 1.0000 -1.9999 1.0000 1.0000 -1.8899 0.9250 > G > 1.0000 > 0.1041 > 1.0000 > > Simulations perform as expected. > Since the coefficients are between ]-2..2[ I transform the SOS matrix > as SOS_fix = SOS*2^14: > > SOS_fix > 16384 27614 16384 16384 -28175 14033 > 16384 -32766 16384 16384 -30964 15155 > > The question is: can I run this coefficients on iircas5 of the TI > dsplib? I know dsplib is Q.15 while my coefficients are Q.14, but I > suppose this is not a problem if the filter's input is small > enough not > to cause any overflow. Unfortunately this does not work, the > output is > completely wrong. > > The second think I tried was to multiply the numerator > coefficients of > the second section of the filter by 0.1041 (according to G), before > converting them to Q.14, getting this: > > SOS_fix_G > 16384 27614 16384 16384 -28175 14033 > 1706 -3412 1706 16384 -30964 15155 > > But this also does not work. > > Does anyone have any idea how I should convert my coefficients in > order > to work with iircas5? > > Thanks. > > Christian > > ------------------------------------------------------------------------ > New Yahoo! Messenger with Voice. Call regular phones from your PC > <http://us.rd.yahoo.com/mail_us/taglines/postman5/*http://us.rd.yahoo.com/evt=39666/*http:// messenger.yahoo.com> > and save big. ______________________________ New Year Gift for Members of DSPRelated.com. Details here.