This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problems using DLMSfast in active noise cancellation

Hi

The setup

I am working on a prototype for a one channel feedforward active noise cancellation. I am using the C5517EVM. 

I have been adviced to use the following code:

- The audio codec example: "McBSP_Master_AIC3204_48kbps_DMA" from the Chip support library

- The dlmsfast function from the DSP library

The problem

But I have run into problems using the dlmsfast function. The block diagram below is refered to in the following text.

1. Issue: The error microphone will measure e(n). But dlmasfast expects to get d(n) as input. But I can calculate d(n), so no problem.

2. Issue: The algoritm does not seem to work when it decrease the buffer size of input (x(n)) and output (y(n)) to 2 samples.

The reasion for using a buffer size of 2 is (ideally one):

-          The LMS algorithm uses the error e(n) as input

-          For every input sample new filter coefficients are calculated

-          The new calculated coefficients affects the value of the e(n)

-          So I cannot process N input samples using N samples of e(n), because I cannot predict e(n). e(n) depends on the filter adaption from previous iteration.

Using abuffer size of 2, the dmsfast function did not update the dbuffer with the old input values, it only saved two values and the circular buffer index remained zero all the time. In order for the LMS algorithm to function, it needs to save a number previous input values that equals the number of coefficients in the FIR filter.

 I tried to update the circular buffer index from the code, but I still got incorrect results.

A more thorough documentation of dlmsfast would be great.I cannot deduce from the documentation if updating the dbuffer is handled by the dlmsfast function or if it should be addressed by the application code. I speculate if the input/output buffer length is required to be longer than the number of coefficients.

The questions

Can someone help me with the above described problems using dlmsfast?

Maybe there is a better DSP library function for active noise cancellation? If so can anyone recommend a better one?

Any help will be appreciated.

 

 

  • Hello,

    I need to look further into details of C55x implementation, but here are some general remarks:

    1) The DSPLIB LMS functions are provided as a reference code which has to be modified by customers to suit your needs. For example, the API may not provide a way to control step size. It may mention “scaled” or “weighted” error, but it really requires the step size input as well. Additionally, when implementing adaptive filters, one has to control the adaptation based on the signal power, etc. So, you may need to implement “normalized” LMS in a suitable way as well as providing additional control to freeze the updates during times when signal content is not “valid”. That would depend on the application, etc.

    So, just sticking in LMS algorithm within a block diagram will not work. (even when you fix your current problem) customers would be aware of this and would probably modify the code to suit their needs. That is, you would provide additional step size handling and adaptation control logic, including normalization, etc.

    2) The particular problem you talk about may be related to some limitations of the C55x implementation. I am not sure what is the shortest frame size for the input/output that the C55x implementation supports. A also do not know if the algorithm is implemented as “single-sample” LMS or “block” LMS. (that would determine how gradient is calculated). In those cases there might be limitation for the minimum frame size based on the LMS block size. You cannot calculate gradient unless you have enough samples for a single block.


    regards,
    David