Analog.com Analog Dialogue Wiki 简体中文
EngineerZone
EngineerZone
  • Log In
  • Site
  • Search
  • User
  • Support

    Popular Forums

    • RF and Microwave
    • Power Management
    • Video
    • FPGA Reference Designs
    • Precision ADCs
    • Linux Software Drivers
    • SigmaDSP Processors & SigmaStudio Dev. Tool

    Product Forums

    • A2B
    • Amplifiers
    • Analog Microcontrollers
    • Clock and Timing
    • Data Converters
    • Direct Digital Synthesis (DDS)
    • Energy Monitoring and Metering
    • Interface and Isolation
    • MEMS Inertial Sensors
    • Processors and DSP
    • Switches/Multiplexers
    • Temperature Sensors
    • Voltage References
    View All

    Application Forums

    • Audio
    • Automated Test Equipment (ATE)
    • Condition-Based Monitoring
    • Depth, Perception & Ranging Technologies
    • Embedded Vision Sensing
    • Optical Sensing
    • Precision Technology Signal Chains
    • Video
    • Wireless Sensor Networks Reference Library

    Design Center Forums

    • ACE Evaluation Software
    • ADEF System Platforms
    • Design Tools and Calculators
    • FPGA Reference Designs
    • Linux Software Drivers
    • Microcontroller no-OS Drivers
    • Reference Designs
    • Signal Chain Power (SCP)
    • Software Interface Tools
    • System Demonstration Platform (SDP) Support
  • Learn

    Recent Discussions

    • Pluto + GNURADIO frequency change
    • Pluto SDR
    • pluto sdr pyadi-iio continous iq recording
    • attribute error
    • gps-sdr-sim is not working with my ADALM-PLUTO

    Places

    • ADI Education Home
    • ADI Education China
    • ADI Education India
    • ADI Education Philippines
    • StudentZone (Analog Dialogue)
    • Virtual Classroom

    Latest Webinars

    • Optimizing GaN and GaAs RF Amplifier Performance Using Novel Biasing Techniques
    • Improving Switch-Mode Power Supplies Using Noise Cancelling Technology
    • Webinar Accelerate Your Design With a 2 to 24 GHz Wideband Transceiver Reference Design
    • How to Design an Optimized Motion Control System for Intelligent Edge Based Surveillance Camera
    • How to Enhance High Precision Current Sensing Systems
    View All
  • Community Hub

    Challenge Yourself!

      KCC's Quizzes: Taking the right shoes in the dark and in a hurry
    View All

    Places

    • Community Help
    • Logic Lounge

    Resources

    • EZ Code of Conduct
    • Getting Started Guide
    • ADI: Words Matter
    • Community Help Videos
    View All
  • Blogs

     

    Can I Build My Own Phased Array Radar?

     

    How to Understand Public Key Cryptography Without Formulas

    Latest Blogs

    • How To Design Fieldbus Agnostic Smart Factory Sensors
    • You Passed EMC Testing… But Wait, Is There More?
    • The 5 Things You Need to Know about RF Matching Networks
    • Does Reliability Prediction Uncertainty Justify Mandating Two Channel Safety?
    • An Inside Look at 2022
    Read All Blogs

    ADI Blogs

    • EZ Spotlight
    • The Engineering Mind
  • Partners

    Electronic Design Services - PartnerZone

    • Boston Engineering
    • Calian, Advanced Technologies
    • Colorado Engineering Inc. (DBA CAES AT&E)
    • Clockworks Signal Processing
    • Epiq Solutions
    • Fidus
    • PalmSens
    • Richardson RFPD
    • Tri-Star Design, Inc.
    • VadaTech
    • Vanteon
    • X-Microwave
    View All
SigmaDSP Processors & SigmaStudio Dev. Tool
  • Processors and DSP
SigmaDSP Processors & SigmaStudio Dev. Tool
Documents Calculating Filter Coefficients to Store in a Microcontroller
  • Forums
  • Members
  • Tags
  • More
  • Cancel
  • Documents
  • +AD193x: FAQ
  • +ADAU1401AEBZ: FAQ
  • +ADAU144x: FAQ
  • +ADAU1452: FAQ
  • +ADAU145x: FAQ
  • +ADAU1701: FAQ
  • +ADAU1701MINIZ- FAQ
  • +ADAU1761: FAQ
  • +ADAU1772: FAQ
  • +ADI: FAQ
  • +AN-951: FAQ
  • +bitwise logic: FAQ
  • +Compressor Table Format: FAQ
  • +Creating a simple balance crossfade control: FAQ
  • +Creating constant-dB envelope decay using an existing linear decay algorithm: FAQ
  • +Crossover with more than 3 bands: FAQ
  • +E2PROM: FAQ
  • +EEPROM: FAQ
  • +EVAL DAU144XEBZ: FAQ
  • +EVAL-ADAU1781Z: FAQ
  • +Excluding Cells from the Exported System Files: FAQ
  • +GPIO button: FAQ
  • +GPIOs or Aux ADCs: FAQ
  • +How do I execute a software safeload write?: FAQ
  • +IIR coefficient filter: FAQ
  • +IIR filter: FAQ
  • +Peak Full Range Compressor: FAQ
  • +Preserving "Ear-candy": FAQ
  • +Push Button Volume: FAQ
  • +self-boot EEPROM image: FAQ
  • +Sigma300 Family Products: FAQ
  • -SigmaDSP: FAQ
    • Booting a SigmaDSP from a microcontroller with no C compiler
    • Calculating Filter Coefficients to Store in a Microcontroller
    • Can I program multiple SigmaDSPs in parallel using one USBi?
    • Can I use SigmaDSP to decode MP3/WAV/AAC?
    • Can SigmaDSP do frequency-domain processing like FFT or pitch shift?
    • Creating a delay after startup
    • FAQ: Can I write C or assembly code for SigmaDSP in SigmaStudio?
    • FAQ: Can we bundle SigmaStudio with our product design?
    • FAQ: Developing custom algorithms and/or using 3rd party algorithms
    • FAQ: How can I estimate MIPS/Memory resource on SigmaDSP?
    • FAQ: What types of capacitors are good to use in the analog audio signal path?
    • FAQ:  Which SigmaDSP ICs support selfbooting from an EEPROM?
    • FAQ:  Why isn't a software/documentation CD included with my evaluation board?
    • How do I create the microcontroller code to interface to my SigmaDSP?
    • How do I start a timer after power-on, or when the input signal goes away?
    • How many instructions can be executed per sample in SigmaDSP?
    • Memory requirements for booting a SigmaDSP with a microcontroller
    • Monitoring average and instantaneous signal levels
    • Playing audio samples in SigmaDSP
    • SigmaDSP PCB Layout Best Practices
    • SigmaDSP Products and Evaluation Boards - ROHS and REACH Compliance
    • SigmaStudio 3.4 Released
    • Updating SigmaDSP Parameter with a Microcontroller
    • Using two SigmaDSP evaluation boards simultaneously with one USBi board
    • Welcome to the SIGMADSP Processors and SIGMASTUDIO Development tool community
    • What are the number formats for SigmaDSP?
    • What is the step size for audio delay in a SigmaDSP?
    • Where can I buy a SigmaDSP Evaluation Board or USBi (EVAL-ADUSB2EBZ)?
    • Which SPI Mode is used by SigmaDSP Devices?
  • +SigmaStudio: FAQ
  • +single precision VS double precision: FAQ
  • +Stimulus-Probe Capability and Limitations: FAQ
  • +Stopwatch to Count Successive Samples: FAQ
  • +Toolbox into the schematic tab: FAQ
  • +USB communications between the PC and SigmaDSP: FAQ
  • +Using Hierarchy Boards to create re-usable code: FAQ

Calculating Filter Coefficients to Store in a Microcontroller

Recently there have been some email support requests regarding the calculation of filter coefficients (and other types of parameters) for storage in a microcontroller. The basic idea is to store a table of parameters in the microcontroller and download them to the appropriate addresses in the SigmaDSP's parameter RAM when required. SigmaStudio includes a few tools to help make this possible.

Method 1: Direct coefficient calculation

This method is not really preferred because it takes time and effort compared to the other methods, and doesn't offer any real benefits. In the help file, equations used for calculating first-order and second-order (biquad) IIR filter coefficients are given.

For example, here are the first-order filter calculations:

/--------------------------------/

First order filters
frequency = Cutoff frequency
gain = Linear Gain
fs = Sample Rate

PI = π

For lowpass filters,

A1 = Pow(2.7,(-2 * PI * frequency/fs))
B0 = gain * (1.0 - A1)
B1 = 0

For highpass filters,

A1 = Pow(2.7,(-2 * PI * frequency/fs))
B1 = (1.0 + A1) * 0.5 * gain
B0 = -B1

For allpass filters,

A1 = Pow(2.7,(-2 * PI * frequency/fs))
B0 = -gain * A1
B1 = gain

/--------------------------------/

The equations for second order filters are in the attached PDF.

These equations can be used to calculate parameters directly, but are a bit cumbersome.

Attached below is an XLS file that shows an example of how to calculate filter coefficients for parameteric EQ cells.

Method 2: Fixed Point Filter Table Generator

Open the fixed point filter table generator under the Tools menu.

Here you can enter in parameters for a number of filter curves that you desire, then hit the generate button to see the generated curves on the graph.

Click the value table tab to see the biquad filter coefficients to be stored in RAM (5 coefficients are listed for each filter generated).

Click the Show Values button and then Generate again to show the decimal values and parameter names for each filter, along with the associated boost.

These values can be loaded directly into a 2nd-order general filter, set to IIR Coefficient mode in SigmaStudio. Important: Because of the way the values are stored in RAM, the coefficients for a1 and a2 must be inverted from what is shown in the filter table generator. The filter table generator shows coefficients as they are stored in RAM, whereas the IIR Coefficient filter box shows their true values as calculated by the equations.

The filter table generator allows a large number of coefficients to be calculated and stored in RAM for applications such as a user-controllable tone control.

Method 3:Use the capture window

Start a project and make sure the SigmaDSP is connected to a USBi communication channel in the Hardware Configuration tab. Insert any filter into your project and compile. Then change the filter values. The values written to the SigmaDSP's RAM are shown in the capture window (open by default, toggle by pressing Ctrl+5).

This allows you to simply generate the parameters for one filter curve.

Figuring out parameters for any SigmaStudio algorithm control using the Capture Window

You can insert any cell into the project, compile, then change its parameters to see what should be stored in RAM in the capture window. If, for example, I wanted to to a sine tone sweep that is manually controlled by a microcontroller, I could enter in a range of values into a sine tone generator and make note of the frequency parameter in the capture window (in this example, the parameter name is sin_lookupAlg19401increment).

This FAQ was generated from the following discussion: Calculating Filter Coefficients to Store in a Microcontroller

Attachments:
1307.FilterMathCalculations.pdf
8244.Parameteric_EQ_IIR_Coefficient_Calculator.xls
  • coefficient
  • microcontroller
  • filter
  • sigmastudio
  • frequency
  • parameter
  • sigmadsp
  • Share
  • History
  • More
  • Cancel
Related
Recommended
 
Social
Quick Links
  • About ADI
  • Partners
  • Analog Dialogue
  • Careers
  • Contact us
  • Investor Relations
  • News Room
  • Quality & Reliability
  • Sales & Distribution
  • Analog Garage
Languages
  • English
  • 简体中文
  • 日本語
  • Руccкий
Newsletters

Interested in the latest news and articles about ADI products, design tools, training and events? Choose from one of our 12 newsletters that match your product area of interest, delivered monthly or quarterly to your inbox.

Sign Up
Switch to mobile view
Analog Logo
© 1995 - 2023 Analog Devices, Inc. All Rights Reserved 沪ICP备09046653号-1
  • ©
  • 1995 - 2023 Analog Devices, Inc. All Rights Reserved
  • 沪ICP备09046653号-1
  • Sitemap
  • Privacy & Security
  • Privacy Settings
  • Terms of use
EngineerZone Uses cookies to ensure you get the best experience in our community. For more information on cookies, please read our Privacy & Security Statement.