0
$\begingroup$

I have been reading on different ways to do this. I have seen this Linear-phase DC Removal Filter This seems like it would work just fine, but it would take some time to implement.

Is there any reason you can't just say average 16192 * 256 samples and every time this completes, use this latest output value to subtract each input sample by this amount?

I have new samples every 12.5 MHz, system clock is 150 MHz.

Resource wise this will take more, but are there any fundamental issues doing this vs a moving average?

$\endgroup$
5
  • $\begingroup$ Aren't you doing a moving average by doing that? Meaning, are you suggesting that for every new input sample, you will average it with the previous 16192*256-1 samples? If so, yes it just takes up that amount of memory and adders but fundamentally would give you an identical result to a CIC filter. If you were concerned about resources you would consider doing it differently but otherwise the result is the same. @RichardLyons is often on here, so I will leave it to him to detail further since he wrote the referenced article. $\endgroup$ Commented Feb 22, 2022 at 23:25
  • $\begingroup$ A bit different, in this case I get the average of 16192*256 samples. Once that finishes, all new inputs are subtracted by this amount. At the same time, it will start making a new average with new samples. It does not use the old average's values for this calculation. Although... writing this out now, I suppose this isn't as good since there will be a jump in the output values. $\endgroup$
    – Kronos
    Commented Feb 23, 2022 at 0:26
  • $\begingroup$ Right, that wouldn't be good for that reason. The average loses its applicability the further you drift from it. This would only work well if you had a stationary signal with a constant average that was the same over each block. I recommend just doing a simple moving average if you are not resource constrained with a FIFO (for every new sample add it and subtract the latest sample, or its CIC reduction if you want to save some addition operations (see here: dsp.stackexchange.com/questions/38377/…), or Richard's cool implementations. $\endgroup$ Commented Feb 23, 2022 at 4:51
  • $\begingroup$ Yup a moving average seems the way to go! I think I'll actually start with the example Richard shows as having that -2.9dB drop and then once that works I'll work my way down. Thanks a lot guys, wish I could upvote. $\endgroup$
    – Kronos
    Commented Feb 23, 2022 at 18:20
  • $\begingroup$ You can! (Richard’s good answer below, and select as “right answer” if he answered your question) $\endgroup$ Commented Feb 23, 2022 at 18:29

2 Answers 2

0
$\begingroup$

Here's a corrected (final multiplier value and a missing minus sign) version of the lower network in my first answer:

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks again Richard! Really appreciate it. Simulating and implementing this will give me some much-needed intuition for this. $\endgroup$
    – Kronos
    Commented Feb 24, 2022 at 19:02
1
$\begingroup$

To add to @DanBoschen's good comments, you might try experimenting with one of the following networks:

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks Richard! Those look a bit easier to implement, and I just realized the top is an IIR lowpass. I kept thinking I'd need a highpass filter, but there isn't any reason I couldn't just use a lowpass filter and use its output and subtract all the values. That's the idea behind that right? $\endgroup$
    – Kronos
    Commented Feb 23, 2022 at 18:24
  • $\begingroup$ @Kronos: Yes, that's the idea. I just remembered that the final multiply in the lower network in my above first answer needs to be 1/(2N), rather than 1/2. Please see my second answer below. $\endgroup$ Commented Feb 24, 2022 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.