Guidelines on Exporting Filters from FDATool to Code Composer Studio™ IDE

You can export filters from FDATool to CCS IDE by generating an ANSI® C header file, or by writing the filter coefficients directly to target memory. To export a filter from FDATool to CCS IDE, use the Export to Code Composer Studio(tm) IDE dialog box (shortened to Export to CCS IDE dialog box in this section). Open the dialog box from the FDATool Targets menu.

For instructions on using the Export to CCS IDE dialog box, refer toTutorial — Exporting Filters from FDATool to CCS IDE.

Selecting the Export Mode

You can export a filter by generating an ANSI C header file, or by writing the filter coefficients directly to target memory. The following table summarizes when and how to use the two export modes.

Export ModeWhen to UseSuggested Use

Generate ANSI C header file

You have not yet allocated memory in your target DSP for the filter coefficients to export.

(For a sample generated header file, see Contents of the ANSI® Header File Generated in Task 1.)

Create a program file from the generated ANSI C header file. Loading this program file into your target allocates static memory locations in the target, and exports your filter coefficients to these memory locations. You may want to edit the header file so that the program file allocates extra target memory, providing you more freedom to change your filter. See Allocating Sufficient or Extra Memory for Filter Coefficients in the next section.

Write directly to memory

You have already allocated memory in your target DSP for the filter coefficients to export.

Tune your filter coefficients in FDATool, and write the updated filter coefficients directly to the allocated target memory. Refer to the next sectionCautions Regarding Writing Directly to Memory.

Cautions Regarding Writing Directly to Memory

When you write filter coefficients directly to target memory, you need to allocate sufficient memory for the coefficients, and proceed with caution when you update your filter coefficients in target memory.

Allocating Sufficient or Extra Memory for Filter Coefficients

When you export filter coefficients directly to target memory, the filter coefficients overwrite as many memory locations as they need. The export process does not check whether you allocated sufficient memory for your filter coefficients. You must allocate enough memory for your filter coefficients or you may get unexpected results. To ensure you allocate enough target memory for your filter, export the filter by generating a ANSI C header file, as described in Tutorial — Exporting Filters from FDATool to CCS IDE.

You can allocate extra memory by editing the generated ANSI C header file, and then loading the associated program file into your target as described in the tutorial in Step 8 — Export the Filter by Generating a Program File. Allocating extra memory provides more freedom for changing a filter and overwriting its previous version stored in target memory. Even after you allocate extra memory, you should still proceed with caution when overwriting old filter coefficients with updated coefficients as discussed in the next section.

Overwriting Old Filter Coefficients with Updated Coefficients

When you tune a filter to overwrite its previous version in target memory, carefully consider changes that increase the memory required to store the filter coefficients, or that alter the export data type.

Do Not Tune Filter Export Data Type.   Never tune a filter by changing its data type, because the allocated memory expects the data type of the first version of the filter that you exported. Overwriting a filter with a filter that has a different data type usually yields unexpected results.

Be Wary of Filter Changes that Increase Memory Required to Store Filter Coefficients.   If you do not allocate extra memory when exporting the first version of your filter, do not tune the filter in ways that increase the memory required to store its coefficients. For instance, you should not increase the order of the filter. When you overwrite your original filter with one of a higher order, the updated filter may overwrite data in memory locations that you did not intend for storing filter coefficients. Even if you do allocate extra memory for your filter coefficients, be cautious about making changes that increase the memory required to store the coefficients. Examples of such changes include

Variables and Memory Necessary for Filter Export

When you export a filter by generating an ANSI C header file, the header file stores the filter coefficients in filter coefficient variables. You must name these variables in the Export to CCS IDE dialog box. Variable names cannot be reserved words of the ANSI C programming language, such as if. By generating a program file from the ANSI C header file and loading the program file into your target, the filter coefficient variables in the header file appear in the target application symbol table.

When you export a filter by writing directly to target memory, the target stores the filter coefficients in memory locations. These memory locations correspond to filter coefficient variables in the target application symbol table. To export directly to target memory, you specify these variables in the Export to CCS IDE dialog box.

The necessary filter coefficient variables depend on the structure of your filter. The Export to CCS IDE dialog box provides you with the following parameters to specify or name the necessary filter coefficient variables. The dialog box activates only the parameters you need to set; the others become invisible or inactive.

Parameters for Specifying Filter Coefficient VariablesDescription

Numerator

Numerator filter coefficients

Numerator length

Number of numerator filter coefficients

Denominator

Denominator filter coefficients

Denominator length

Number of denominator filter coefficients

Lattice coeffs

Lattice coefficients

Lattice coeffs length

Number of lattice coefficients

Ladder coeffs

Ladder coefficients

Ladder coeffs length

Number of ladder coefficients

Number of sections

Number of filter sections (parameter is inactive if your filter has only one section)

In the following table, x marks indicate the parameters to set for each filter structure.

Selecting the Export Data Type

When you export a filter, the export process suggests the export data type that best preserves the performance of your filter. Use the suggested export data type by selecting Export suggested in the Export to CCS IDE dialog box. The data types that you can export are

Recommended Procedure for Selecting Export Data Type

By adhering to the following procedure when you set the export data type of your filter, the exported filter coefficients closely match the coefficients of the filter you designed in FDATool.

Step 1 — Set the Numerical Precision of Your Filter in FDATool.   Set the numerical precision of your filter in FDATool by using the Filter Quantization pane, available when you install Filter Design Toolbox. If you do not have Filter Design Toolbox™ software, filters in FDATool use double-precision floating point.

Step 2 — Select an Export Data Type in the Export to CCS IDE Dialog.   Use the export data type indicated by the Export suggested parameter in the Export to CCS IDE dialog box. Refer to the following note.

Though Step 2 insists you use the Export suggested parameter, you may find it useful to select the Export as option and select an export data type other than the one suggested. If you deviate from the suggested data type, the exported filter coefficients can be very different from the coefficients of the filter you designed in FDATool.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS
 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS