• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » C2000™ Microcontrollers » C2000 32-bit Microcontrollers Forum » IIR and FIR filter library questions
Share
C2000™ Microcontrollers
  • Forums
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
C2000 Resources
  • Product Folder
  • C2000 Training Portal
  • C2000 Technical Training Catalog
  • C2000 Datasheets, App Notes, User Guides
  • C2000 Hardware Design Kits
  • controlSUITE for C2000 Software Library


  • InstaSPIN Resources
  • What is InstaSPIN?
  • Videos and Support


  • InstaSPIN-FOC and InstaSPIN-MOTION Resources
  • What is InstaSPIN-FOC?
  • What is InstaSPIN-MOTION?
  • InstaSPIN Simulation Tool
  • Product Folder: F28069F, F28068F, F28062F, F28068M, F28069M
  • User’s Guide
  • Technical User’s Manual
  • Tools
  • Forums

    IIR and FIR filter library questions

    This question is not answered
    Maxpower
    Posted by Maxpower
    on Oct 13 2010 09:26 AM
    Intellectual685 points

    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

    28335 iir fir
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Stefan Noehammer
      Posted by Stefan Noehammer
      on Nov 29 2010 06:03 AM
      Prodigy100 points

      With the old filter i mean the implementation in version 0.9c (sprc082 from 12.Jan 2005).

      There the iir32-Filter has an integer (Q15) as input value. In the new implementation of iir5biq32 there is a long (Q31) as input value.

      In the filterfunction the inputvalue is first multiplied by the 'Input scaling factor'(ISF), to avoid overflow, as you already mentioned.

      But on the other side there is a lost in resolution of the inputsignal. 

      For example in your IIR5BIQ32-Testcoefficients there following defination for a LP-Filter.

       

       

       

       

       

       

       

       

       

       

       

       

      #define IIR32_LPF_ISF

       

       

      #define IIR32_LPF_QFMAT

       

       

      28
      134086103

      This means for me that the inputvalue is multiplied by 0.0312 (134086103/(2^32)). So the lower 5 bit of the inputvalue get lost.

      So there is also a tradeoff of resolution. (with the old implementaion this was only a matter if ISF would by <1/(2^16))

      As far as I see the parameter Ni is the number of samples of the impulse response for the 'norm' of each biquad.

      But how long has this at least to be?

      I'd like to have no overflow inside the filtersection, but also the smallest ISF to have good resolution...

      So my question how the value of 500 (for Ni) is choosen...

      /Stefan

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Yu Cai58368
      Posted by Yu Cai58368
      on Nov 29 2010 08:37 AM
      Prodigy230 points

      /* LPF co-efficients for IIR32 module */
      #define IIR32_LPF_COEFF {\
                  0,248624377,0,20118017,20118017,\
                  -141524868,517372703,43749199,87498398,43749199,\
                  -228291242,583544331,35450657,70901314,35450657,\
                  -401770939,715847129,875854244,1751708488,875854244}

      #define IIR32_LPF_ISF   288246535
      #define IIR32_LPF_NBIQ  4
      #define IIR32_LPF_QFMAT 29

      I am not sure if the example code that you are talking is the same as what I am tallking. There  are two example codes for IIR. One is 2833x_FixedPoint_IIR32 and one is 2833x_FxiedPoint_IIR16. One is for 32 bit IIR filter implementation and one is for 16 bit IIR filter implementation.

      For the 32 bit version, the input has to be in 32 bit format input (Q31) and for the 16 bit implementation the input should be Q15. I am not sure if the old version has some bug in it. It was developed long time ago and that's why I cleaned up. The new example code had been tested and the results were compared with matlab scripts.

      In IIR filter, lost resolution is unavoidable by fixed point implementation. If you want to change the ISF value, please check the matlab script either eziir32.m or FixedPointIIR32.m. You can change the Ni and see if the matlab simulation result overflow. If that Matlab simulation is good, then CCS result should be good also. If that one is not good, so you have to sacrifice you resolution.

      Please focus on the example code that I provided and don't pay too much attention to the old version. The old version might have some bug even though it is a release version.

      -Yu Cai

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Guilford Cantave61944
      Posted by Guilford Cantave61944
      on Jan 05 2011 11:55 AM
      Prodigy10 points

      Yu Cai,

      I am currently using the c28346 for control purposes in an embedded design. I would like to add DSP FIR and IIR filtering functionality to my project using floating point and optionally fixed point math in either 16-bit or 32-bit. I am new to DSP on the floating point Delfino and would benefit greatly by using the libraries mentioned in this forum. Is there officially released fixed and floating point libraries available on the TI site? Also, can you point me in the right direction in regards to c28346 DSP FIR and IIR filtering reference material, example c28346 DSP FIR and IIR filtering code and etc? Thanks for your help.

      Best regards,

      Guilford

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Yu Cai62050
      Posted by Yu Cai62050
      on Jan 05 2011 13:29 PM
      Intellectual810 points

      I think the latest FIR and IIR library was uploaded with the newest controlSUITE.  It was associated with example project from which you can know how to call those functions. By the way, the matlab script is also attached which can be used as reference guide and very useful in debugging.

      For testing any kinda IIR or FIR filter, you have to verify your algorithm at first in Matlab, which means before matlab code is working, you'd better not porting to your CCS. After it works, then it's a good reference as you debug in CCS or any real-mode. Good luck.

      Y. Cai

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    123
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use