An improved design of FIR digital filter

Publisher:MysticGlowLatest update time:2006-04-29 Keywords:simulation Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

      In digital signal processing, filtering plays an extremely important role. Digital filters are basic processing algorithms in spectrum analysis, radar signal processing, and communication signal processing applications. Currently, commonly used filter design methods generally use Matlab simulation and DSP implementation. However, this traditional design method requires a long development cycle and the design process is repeated, which is very inconvenient.

  In response to this problem, the idea of ​​a system-level design method emerged to integrate Matlab algorithm simulation and DSP implementation. In this article, Matlab Link For CCS Development Tools is used for system-level design to complete the design of the FIR filter.

  1 Basic steps of FIR digital filter design

  Digital filters can be divided into two types according to the time domain characteristics of their impulse response functions, namely infinite impulse response (IIR) filters and finite impulse response (FIR) filters. The FIR system is not as easy to obtain better passband and stopband attenuation characteristics as the IIR system. To obtain better attenuation characteristics, the H(z) order is generally required to be high, that is, M must be large. The FIR system has its own outstanding advantages: the system is always stable; it is easy to realize linear phase; it allows the design of multi-passband (or multi-stopband) filters. The latter two are not easy to implement in the IIR system. There are many design methods for FIR digital filters, such as window function design method, frequency sampling method and Chebyshev approximation method. With the continuous improvement of Matlab software, especially Matlab's signal processing workbox, not only is the computer-aided design of digital filters possible, but the design can also be optimized.

  The basic steps of FIR digital filter design are as follows [1]:

  (1) Determine technical indicators

  Before designing a filter, the technical specifications of the filter must first be determined based on the actual needs of the project. In many practical applications, digital filters are often used to implement frequency selection operations. Therefore, the form of the indicator generally gives the amplitude and phase response in the frequency domain. Amplitude indicators are mainly given in 2 ways. The first is an absolute indicator. It provides requirements for the amplitude response function and is generally used in the design of FIR filters. The second type of indicator is a relative indicator. He gives the requirements in terms of decibel values. The filter design in this article takes the design of a linear phase FIR filter as an example.

  (2) Approximation

  After the technical indicators are determined, a target digital filter model can be established (usually an ideal digital filter model is used). Afterwards, use digital filter design methods (window function method, frequency sampling method, etc.) to design an actual filter model to approximate the given target.

  (3) Performance analysis and computer simulation

  The result of the previous two steps is a filter described by a differential or system function or impulse response. Based on this description, you can analyze its frequency characteristics and phase characteristics to verify whether the design results meet the index requirements; or use computer simulation to implement the designed filter, and then analyze the filtering results to judge.

  2 Traditional design methods of FIR digital filters

  The traditional FIR digital filter design process is divided into two parts: development design and product implementation. In the development and design part, the solution design and algorithm design and verification are completed. Matlab language is generally used for simulation. When the simulation results are satisfactory, the product implementation stage is entered. In the implementation stage, the algorithm in the development and design stage is implemented in C/C++ or assembly language, and implemented on the hardware microcontroller or DSP target board.

  The following takes the low-pass filter used to filter out high-order harmonics in the power system as an example to introduce the traditional design method of designing a linear phase FIR low-pass digital filter.

  2.1 Matlab simulation of FIR filter[2]

  In the power analysis experiment instrument, only the harmonics below the 20th order are required to be analyzed, the harmonics above the 30th order are filtered by the anti-aliasing filter, and the 20-30th harmonics are filtered out by the digital filter. Therefore, the technical specifications of the low-pass filter of the power system are as follows: passband cutoff frequency is 1000Hz, stopband cutoff frequency is 1500Hz, passband ripple is 0.001, stopband ripple is 0.001, sampling frequency is 4000Hz, stopband attenuation Less than 50 dB, so it is more appropriate to use the Hamming window in the design.

  It is very convenient to directly obtain the design of FIR filter using the special function provided by the Matlab digital signal processing software package.

  First find the order N of the filter: N=ceil(n)+1, and N=28 can be calculated through simulation of related programs.

  The coefficients of filter h(n) and its amplitude-frequency characteristics:

  The calling format is: b=fir1 (N, wc, 'ftype', window) or b = fir2 (N, wc, m, window); compile the program and run it. Table 1 shows the calculated filter coefficients, as shown in Figure 1 The frequency response curve of the designed low-pass filter. It can be seen that the performance indicators are basically met. The coefficients of h(n) are shown in Table 1.

  Input an aliasing signal to test the function of the designed filter: the input signal is a sinusoidal AC signal with frequencies f1=400Hz and f2=1800Hz.

  S1=sin(400×2πt);

  S2=sin(1800×2πt);

  S=S1+S2

  Figure 2 shows the aliasing signal waveform S=S1+S2.

  Figure 3 Waveform after filtering. It can be seen that the simulation results are basically satisfactory. Then use DSP to implement the system.

  Save the above system to disk and create a data file fir01.txt. The fir01.txt file generated in Matlab will be automatically converted into the Firdata.inc filter coefficient file by executing the conversion command. The conversion command is (under Matlab):! firdatafic01.txt

  2.2 C54 implementation of FIR digital filter

  TMS320C5416 has a strong data processing function [3]. When the addition instruction MACD with data shift is executed in a loop, once the pipeline is started, the instruction becomes a single-cycle instruction. Filter design and calculation can be completed quickly.

  The design of the FIR filter obtained through the above simulation is discussed below [4]. The program flow chart is shown in Figure 4.

  Prepare a symmetrical FIR low-pass filter program based on the above operations and flow chart. The source program list is omitted. Perform simulation debugging on CCS5000, use the observation window to see the following graphics, and analyze the spectrum of the input signal and output signal. The results are shown in Figure 5 and Figure 6.

  The input signal is the superposition of sinusoidal AC signals with frequencies f1=400Hz and f2=1800Hz. By observing the frequency domain and time domain diagrams, we know that the low-frequency waveform in the input waveform passes the filter, while the high-frequency part is filtered out. The filter achieves the target requirements.

  Although this method can design better filters. However, CCS needs to be used to save the intermediate results of the target DSP program to the hard disk of the PC, and then transfer it to the Matlab work space. Compare it with the intermediate results of the Matlab algorithm to find the result deviation in the DSP program due to design or accuracy. Repeating this process is very inconvenient.

  An improved design method is proposed below.

  3 Improvement methods for filter design

  The idea of ​​a system-level design method is currently proposed [5]. The core of the system-level design method is to conduct algorithm design and system-level design simulation in a unified environment, thereby effectively combining the two parts of the development process. System-level design requires a unified development environment, in which the system structure and algorithms can be described, and different levels, components, and data types of the system can be modeled. Matlab Link for CCS Development Tools appeared to complete system-level design.

  3.1 Introduction to Matlab Link for CCS Development Tools

  Matlab Link for CCS Development Tools (CCS Link) jointly developed by Mathworks and TI provides an interface between Matlab and CCS, that is, connecting Matlab with TI CCS and the target DSP. This tool can be used to operate the memory or register of TI DSP in the same way as Matlab variables. That is, the entire target DSP seems to be transparent to Matlab, and developers can complete the operation of CCS in the Matlab environment. Matlab Link for CCS Development Tools can support any target board that CCS can recognize, including TI's DSP, EVM boards and user-developed target DSP (C2000, C5000, C6000) boards.

  3.2 System-level design discussion

  The three interfaces provided by CCS Link to users are shown in Figure 7, which can complete system-level design.

  3.3 System-level design method of digital filter

  Use the Link for CCS IDE interface to realize the connection between CCSIDE and Matlab to design FIR digital filters. Use this connection to operate DSP applications under the control of Matlab, and use the powerful calculation analysis and visualization tools in Matlab to analyze and compare the target program. The running results greatly shorten the cycle of debugging and developing the system.

  The specific design steps are as follows [6]:

  (1) Select the DSP model: TMS320C5416DSP was used in the experiment;

  (2) Create CCS IDE connection object;

  (3) Use Matlab to load the file into CCS IDE;

  (4) Operate the CCS IDE connection object in the Matlab environment;

  (5) Close the CCS IDE connection object.

  It can be seen from this design step that it is very convenient to operate variables or registers in DSP in the Matlab environment. In this way, the simulation debugging of the DSP program can be completed in the Matlab environment. There is no need to transfer the DSP running results back to the PC for verification like traditional development, which facilitates development and design and shortens the development cycle.

  The results of the filter designed using this method are basically the same as above, except that the design process is greatly simplified, which facilitates development and design.

  4. Conclusion

  Applying Matlab to system-level design of DSP has greatly improved the traditional design method. Matlab's system-level design environment helps to detect errors in the early stages of design and cope with the challenges of increasing system complexity, and facilitates the design of complex DSP application systems. Compared with the traditional designed filter, the designed digital filter has a much faster speed, and the design process has been greatly simplified, which facilitates development and design.
 
      Source: Modern Electronic Technology

Keywords:simulation Reference address:An improved design of FIR digital filter

Previous article:A DSP processor design based on power consumption management
Next article:Integrate motor control and power factor correction with DSP controller

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号