I am using the F28335 chip. I looked for iir and fir filters and found some for the C2000 but they are written for integer math. My questions are:
1) Is there a library for the C2000 chips with floating point support?
2) If not and I need to use the integer versions, for iir32, do I need to scale the input to Q15 (ie x 32768) before feeding it to the filter function?
3) Why isn't there a 32 bit version of the FIR? Or is there?
Thanks
Maxpower I am using the F28335 chip. I looked for iir and fir filters and found some for the C2000 but they are written for integer math. My questions are: 1) Is there a library for the C2000 chips with floating point support?
Maxpower,
Floating-point filters is definitely on our list of to-dos for early next year. In the meantime I have some preliminary filter functions that I am willing to share - they just haven't been packaged/documented/etc. I will post them tomorrow when I'm back in the office.
-Lori
Thanks. I look forward to checking them out.
Max - my apologies I just realized I forgot to respond back before leaving the office. I still have this on my to-do.
Max,
I found a copy of the FIR but I think its not the latest. I want to check with a co-worker first.
Regards
Lori
Lori,
Thanks for the great communication. I am not in a hurry at the moment. I am running the integer version, FIR16, and it seems to work. It is very quick in execution. I was concerened about the integer math because when I used the iir16 I had resolution issues.
I am going to be away from my project next week so the earliest I can try anything is a week from now.
Thanks and best regards,
Max
-Max,
There is a fixed-point version of filter library available downloaded from
http://focus.ti.com/docs/toolsw/folders/print/sprc082.html
This is a very old lib and I tested the fir and iir 16 bit version. both of them are work. But the document has some problem.
This lib has 16 bit FIR and 16/32 bit IIR. At this moment, there is not 32 bit fixed point FIR in this library.
For IIR version, you not only needs scale to Q15 but also needs some scaling factor. This lib can not work independently from
matlab.
We are gonna release a updated version of this lib soon. So you would be able to get something easier to use for sure. :)
-Yu Cai
Thank you.
That is the library I am using now and it does seem to work. At least the FIR16 does. I had some resolution issues with the iir16. I look forward to the updated filer libraries.
Kidn regards,
The IIR 16 version also works, but eziir_matlab has some mistakes. If you follow that document step by step, it's kinda confusing. The output *.dat file is correct though.
I am currently testing IIR 32 version, i believe it would work as well. I will keep you posted and if anything else resources which potentially be helpful to you, please let me know.
Yu Cai
-Max
I tested fixed point IIR 32 bit version. It has a bug in the old lib. Please be careful when you tried to use that. I will put a fixed one in the update release.
Thank you for the heads up. Let me know when the update is available.
Do you have a floating point version of the IIR fitler available yet for me to try?
I currently have FIR and IIR working version in both 16 and 32 bit. Now I am documenting them. We don't have floating point version of optimized IIR filter library at this time. If you really want to implement it in floating point. You can use C to do that.
Yu Cai,
I can work with the integer versions but Lori (above) mentioned there were floating point versions being worked on and that I might be able to get ahold of some code to try out.
I look forwared to getting the latest integer versions to try in the meantime.
Maxpower Lori, Do you have a floating point version of the IIR fitler available yet for me to try? Thanks Max
Hi Max,
Unfortunately Yu Cai is correct. What I found was an FIR tucked away but I was not able to find the IIR. I apologize for that. At the moment Yu Cai is finishing up some fixed point cleanup but will be working on the float soon.
I hope what you have at this time will work for you until then.
While I am waiting for an updated iir32, I am trying to get iir16 to work. All my math is in floating point on the F28335. The output from the iir16 matlab script is:
#define IIR16_COEFF {\ 0,5716,0,89,89,\ -5781,13114,9879,19759,9879}
#define IIR16_ISF 2476#define IIR16_NBIQ 2#define IIR16_QFMAT 13
I call the initialize function as in the examples given.
This is the code I use to convert my floating point number to an integer in Q15 format and then convert from a Q14.
iir.input = (int)floor((speed_control.Out * 32768.0)); // Scale to Q15 format iir.calc(&iir); angle->omega_m = (float)iir.output / 16384.0; // 2^14 which is the output format
According to the iir16 asm source, the output is in Q14 format so I have to divide to convert it back to floating point
Is this correct?
I am not getting the desired results so I am wondering what I am doing wrong.