Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 16 Adaptive Filter Implementation

Similar presentations


Presentation on theme: "Chapter 16 Adaptive Filter Implementation"— Presentation transcript:

1 Chapter 16 Adaptive Filter Implementation
DSP C5000 Chapter 16 Adaptive Filter Implementation Copyright © 2003 Texas Instruments. All rights reserved.

2 Outline Adaptive filters and LMS algorithm
Implementation of FIR filters on C54x Implementation of FIR filters on C55x

3 Generalities of Adaptive Filters
The coefficients of Adaptive filters are variable with time in order to optimize a given criterion. The most commonly used algorithm to adapt the coefficients is the LMS (Least Mean Square) algorithm. Most adaptive filters are implemented as FIR filters, because they are inherently stable. They are widely used in digital communications: Echo cancellation, equalizers ...

4 Diagram and Notations of Adaptive Filters

5 Mean Square Error Solution
Rx is the autocrrelation matrix of. rxr is the intercorrelation vector between x and reference r.

6 Gradient Algorithm Gradient of criterion J vs b:
Gradient algorithm: iterative solution Max Eigenvalue of Rx Converges if: Adaptation step

7 Stochastic Gradient Algorithm: LMS
The mean values E(e(n)x(n-i)) are not known. In the stochastic gradient algorithm, they are replaced by e(n)x(n-i). The algorithm converges if the adaptation step is small enough. Algorithm named: LMS (Least Mean Square) or Widrow algorithm:

8 LMS Algorithm For each sample, the LMS algorithm:
Filters the input using bi Updates the bi coefficients.

9 LMS Algorithm at Each Sample Time
FIR Filtering equation: Coefficient updating equation:

10 Fixed Point Implementation
When LMS adaptive filter is implemented on a fixed point DSP: The precision of calculation is important: If rnd(ei*xn-i) is smaller than the used precision, no adaptation is performed. The precision of convergence depends on: Adaptation step : the largest , the fastest convergence but the worst precision. The number of coefficients N: the residual error is proportional to N. When N is too large, it may be worth considering using block adaptive filtering.

11 LMS steps Each time iteration (only once):
Calculates error en =rn-yn Scale error by adaptation step : e’n= en. Each time iteration, for each coefficient: Multiply error with signal: ei = e’nxn-i Multiply xn-ibi and accumulate Calculate new coefficients: newbi = bi+ei Update coefficients: bi = newbi.

12 Implementing LMS Algorithm on C54x
Filter and coefficients updating equations: To be done at each sample time n: LMS specific instruction to realize: Filter and coefficient updating. B = B + (bi*xn-i); A = rnd(ei+bi) Rounding is important because  may be very small.

13 LMS instruction With LMS instruction, LMS FIR: LMS Xmem, Ymem
2N Cycles per tap. LMS Xmem, Ymem (A) + (Xmem)<< A (B) + (Xmem) x (Ymem)  B Uses both ACCUs A and B. This instruction does not modify T. Xmem points on bi, Ymem on xn-i Data x are stored in a circular buffer.

14 Example of LMS adaptive filter on C54x
Defines 2 sections for data and coefficients

15 Implementing LMS Algorithm on C54x
Initializations

16 Implementing LMS Algorithm on C54x
LMS adaptive filter program:

17 Implementating LMS algorithm on C55x
Filter and coefficients updating equations: To be done at each sample time n: LMS specific instruction to realize: Filter and coefficicent updating. ACy = ACy + (bi*xn-i); ACx = rnd(ei+bi) Rounding is important because  may be very small.

18 Example of LMS adaptive filter on C55X
Pre-calculate *e(n) ... . AR3 pts to coeff table: a[n] AR4 pts to data table: x[n] T3 holds error step amount ... while loading BRCO AC0=error*oldestsample: x(n-N) …while clearing AC1 (run FIR) Overwrite x(n-N) with x(n) Start FIR, update oldest coef… … and start repeat block Store update coefficient ... ...while calc. next update term Calc FIR, update coefficient Store final coefficient... …while storing FIR output

19 Follow on Activities Application 10 for TMS320C5416 DSK
Implements a guitar tuner using an adaptive filter. Here the desired note is used as the reference. The LEDs on the DSK indicate when the guitar is tune.


Download ppt "Chapter 16 Adaptive Filter Implementation"

Similar presentations


Ads by Google