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, for a butterworth LPF:


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

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).