Current location - Education and Training Encyclopedia - Graduation thesis - Help me find the paper on filters.
Help me find the paper on filters.
FIR digital filter is a classic method of digital signal processing, and there are many design methods. When designing FIR filter with DSP chip, the FIR digital filter can be simulated on MATLAB first, and the generated filter coefficients can be directly poured into DSP for programming. In programming, FIR digital filter can be designed with DSP-specific cyclic buffer algorithm, which can greatly reduce the design complexity and make the filter design fast and simple.

Fir; Fir; DSP circular buffer algorithm

1 Introduction

Filtering plays a very important role in signal processing. Digital filtering is the basic method of digital signal processing. Compared with analog filtering, digital filtering has many advantages, which can not only avoid the inherent problems of voltage drift, temperature drift and noise of analog filters, but also meet the strict requirements of filters on amplitude and phase. Low-pass finite impulse response filter has its unique advantages, because the FIR system has only zero, so the system is always stable, and it is easy to realize linear phase, allowing multi-channel filtering.

The basic structure and design method of 2 FIR filter

2. Basic structure of1fir filter

Let A i (i = 0, 1, 2, …, n- 1) be the impulse response of the filter, and the input signal is x(n), then the input-output relationship of the FIR filter is as follows:

The structure of FIR filter is shown in figure 1:

Figure 1

2.2 design method of fir filter

Design method of (1) window function

Starting from the time domain, the ideal infinite hd(n) is cut into finite h(n) with a certain window function, and h(n) is used to approximate hd(n), so that the frequency response H(ejω) obtained is close to the required ideal frequency response Hd(ejω). The advantage is simple and practical, but the disadvantage is that the cut-off frequency is difficult to control.

(2) The frequency sampling design method starts from the frequency domain, samples the given ideal frequency response HD (EJ Ω) at equal intervals, and performs inverse discrete Fourier transform on the obtained h(k) to obtain H(k), and approximates the ideal frequency response HD (EJ Ω) with the corresponding frequency response H (EJ Ω). The advantage is that the design is carried out directly in frequency domain, which is convenient for optimization. The disadvantage is that the cut-off frequency cannot be freely selected.

(3) The errors of the first two equal ripple approximation computer-aided design methods are very small at frequency sampling points, but the errors at non-sampling points are not evenly distributed along the frequency axis, and the selection of cut-off frequency is also unnecessarily limited. Therefore, based on Chebyshev theory, a computer-aided design method of equal ripple approximation is proposed. It can not only specify the edges of passband and stopband accurately, but also achieve the best approximation to the expected frequency response in a sense.

3 circular buffer algorithm

For the N-level FIR filter, a buffer of N units called sliding window is opened in the data memory, and the latest N input samples are stored in the sliding window. Every time a new sample is input, the new sample will overwrite the oldest data in the sliding window, and other data in the sliding window do not need to be moved. On-chip BK (Ring Buffer Length) register is used to indirectly address the sliding window, and the first address of the ring buffer is adjacent. Next, taking the circular buffer of FIR filter with N=5 as an example, it explains how the data in the circular buffer is addressed. The structure of the 5-level circular buffer is shown in the figure, with the low address at the top.

……

It can be seen from the above that although the old and new data in the circular buffer are not straightforward, the advantages of using the circular buffer to realize Z- 1 are obvious: there is no need for data movement, and there is no data memory that needs to be read and written once in extreme times, so the circular buffer can be located anywhere in the data memory (the linear buffer is required to be located in DARAM).

The key problem to realize circular buffer indirect addressing is: how to make the first positions of n circular buffer units adjacent? Therefore, BK (Cyclic Buffer Length) memory must be used to realize modular indirect addressing. The available commands are:

… *ARx+%; Increment and modulus correction ARX: ADDR = ARX, ARX = CIRC (ARX+ 1)

… *ARx-%; Reduce and modify ARX by modulus: addr = ARX, ARX = CIRC (ARX- 1)

…* ARx+0%; Add AR0, and modify ARX according to the module: addr = ARX, ARX = CIRC (ARX+AR0).

…* ARx-0%; Subtract AR0 and modify ARX by module: ADDR = ARX, ARX = CIRC (ARX-AR0).

…*+ARx(lk)%; Add (lk) and modify ARX by module: addr = CIRC (ARX+lk), ARX = CIRC (ARX+AR0).

Wherein the symbol "circ" is the value in BK (Circular Buffer Length) memory (such as the N value after FIR filtering) and is used for (ARx+ 1), (ARx+AR0), (ARx-AR0) or (ARx+lk). This can ensure that the pointer ARx of the circular buffer always points to the circular buffer, and realize that the upper and lower units of the circular buffer are adjacent.

The algorithm of cyclic addressing can be summarized as follows:

If 0 index+step size & ltBK: index = index+step size

Otherwise, if index+step BK: index = index+step–bk.

Otherwise if index+step <; BK: index = index+step size+BK

In the above algorithm, index is the address pointer stored in the auxiliary register, and step is the step size (that is, the index value). The step size can be positive or negative, and its absolute value is less than or equal to the length BK of the circular buffer). According to the above circular addressing algorithm, the first cell in the circular buffer can be adjacent.

In order to make the circular buffer run normally, except that the circular buffer length register (BK) is used to specify the size of the circular buffer, the k least significant bit of the starting address of the circular buffer must be 0. The value of k satisfies the buffer length of 2k> microcirculation.

Realization of 4 FIR filter on DSP

Symmetric coefficient FIR filter is widely used because of its linear phase characteristics, especially in modem and other occasions where high phase distortion is needed.

For example, a FIR filter with N=8 is symmetric if a(n)=a(N- 1-n), and its output equation is:

y(n)= A0X(n)+a 1x(n- 1)+A2x(n-2)+A3x(n-3)+A3x(n-4)+a 1x(n

If it is rewritten as: y (n) = A0 [x (n)+x (n-7)]+a1[x (n-1)+x (n-6)]+A2 [x (n-2)+x (n-) It can be seen that the number of multiplication operations is reduced by half. This is another advantage of symmetric FIR.

The key points of realizing symmetric FIR filter C54X are as follows:

(1) Open two circular buffer calculation areas in the data memory: the new circular buffer stores new data and the old circular buffer stores old data. The length of the circular buffer is N/2.

(2) Set the circular buffer pointer: AR2 points to the latest data in the new circular buffer and AR3 points to the oldest data in the old circular buffer.

(3) Set the coefficient table in the program memory.

(4)AR2+ AR3 AH (high bit of accumulator A), AR2- 1AR2, AR3- 1 AR3.

(5) Empty the accumulator B and repeat for 4 times (I = 0, 1, 2,3): ah * coefficient ai+B B, coefficient pointer (PAR) plus 1. AR2+ AR3AH, AR2 and AR3 minus 1.

(6) Save and output the result.

(7) Correct the data pointer so that AR2 and AR3 point to the oldest data in the new circular buffer and the oldest data in the old circular buffer respectively.

(8) Replace the oldest data in the old circular buffer with the oldest data in the new circular buffer, and the pointer of the old circular buffer is reduced by 1.

(9) Input new data in the new circular buffer to replace the oldest data.

Repeat steps (4) to (9).

FIRS (Coefficient Symmetric Finite Impulse Response Filter) instruction is used for programming, and its operation steps are as follows:

FIR Xmem、Ymem、Pmem

Perform Pmad analysis

When (RC)0

(B)+(A(32- 16))× (Pmem)B is treated by par) b.

((Xmem)+(Ymem))& lt; & lt 16A

(parity)+1 parity

(RC)- 1RC

FIRS instruction reads data memory twice through C and D buses in the same cycle, and reads a coefficient through P bus at the same time.

The implementation of FIR filter on DSP in this paper is based on MATLAB, and its design idea is as follows:

(1)MATLAB environment generates filter coefficients and input data, simulates the filtering process of the filter, and visualizes the real-time filtering effect of the filter on dynamic input data;

(2) The obtained filter coefficients are directly imported into CCStudio, and then the input data of the filter are stored in C54x data space as the filter input test data designed by CCStudio;

(3) In CCStudio environment, the FIR filter program is designed with the FIR filter formula of assembly language, and the filter coefficients generated by MATLAB and the input test data are calculated, and the input data and filter results are displayed graphically with the help of the View/Graph/Time/Frequency submenu in CCStudio menu (the result is shown in Figure 2);

Figure 2 (a) Input Data (Input)

Figure 2(b) filtered data (output)

Change the entry data address of FIR filtering to the read-write data address of external I/O space or McBSP port, or the built-in buffer address of data space; By changing the result data address of FIR filtering to the output data address of external I/O space or McBSP port, or the address of built-in buffer in data space, the real-time data FIR filtering program based on C54xDSP is completed.

References:

[1] Cheng Peiqing. Course of Digital Signal Processing [M]. Beijing: Tsinghua University Publishing House 1999.

[2] Sun Zongying, Xie Honglin. Design and application principle of TMS320C5xDSP [M]. Beijing: Tsinghua University Publishing House. 2002

Chen Yayong et al. Detailed explanation of MATLAB signal processing [M]. Beijing: People's Posts and Telecommunications Publishing House.2001year

[4] Texas Instruments. User's Guide for TMS320C54x Assembly Language Tools

[5] Texas Instruments. TMS320C54x DSP Programmer's Guide