0

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?

GrapefruitIsAwesome
  • 1,110
  • 7
  • 19
Kronos
  • 3
  • 1
  • 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. – Dan Boschen Feb 22 '22 at 23:25
  • 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. – Kronos Feb 23 '22 at 00:26
  • 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: https://dsp.stackexchange.com/questions/38377/cic-cascaded-integrator-comb-spectrum/38385#38385), or Richard's cool implementations. – Dan Boschen Feb 23 '22 at 04:51
  • 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.

    – Kronos Feb 23 '22 at 18:20
  • You can! (Richard’s good answer below, and select as “right answer” if he answered your question) – Dan Boschen Feb 23 '22 at 18:29

2 Answers2

1

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

enter image description here

Richard Lyons
  • 5,777
  • 13
  • 25
  • 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? – Kronos Feb 23 '22 at 18:24
  • @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. – Richard Lyons Feb 24 '22 at 09:23
0

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

Richard Lyons
  • 5,777
  • 13
  • 25
  • Thanks again Richard! Really appreciate it. Simulating and implementing this will give me some much-needed intuition for this. – Kronos Feb 24 '22 at 19:02