Global Sources
EE Times-Asia
Stay in touch with EE Times Asia
EE Times-Asia > Amplifiers/Converters

Designing custom digital filter (Part 1)

Posted: 17 Aug 2015 ?? ?Print Version ?Bookmark and Share

Keywords:filter design? digital decimation filter? audio communication? MATLAB? passband?

Some time back, I had to unearth some ancient filter design tools. I needed a special-purpose digital decimation filter for a "quite high quality" audio communication system. Of course, I was trying to cram this onto one of my company's Programmable Systems on Chip (you know the acronym by now...).

I wrote an internal report on the design process, just in case anyone from the far future would be interested. So I thought I'd edit it into a nice long blog post or three for all you filter fans out there. This is quite a complicated filter with several design constraints. Well, I thought it was; some of you MATLAB jocks out there might be able to do it in ten seconds while asleep. Whatever. I still think that occasionally designing something 'longhand' is a good way of highlighting constraints and how they affect the design process.

It's designed as an analogue lowpass filter and is transformed into the digital domain as late in the process as possible. The final filter is a 10th order filter; each of the two required signal channels will be implemented as a cascade of five Direct Form biquad sections on the Digital Filter Block in a Cypress PSoC. But I'm getting ahead of myself! First:

Step 1: Choose passband and stopband frequencies
Passband choice was pretty simple, if only because people tend to give you a funny look if you defy convention in such matters. So, stuck as I was with an output sample rate of 44.1 ksps, I went straight for a 20kHz passband edge frequency, with a magnitude ripple of 0.1 dBpp in the passband. Nothing too surprising there.

The system whose output this filter processes does some unconventional internal modulation and it throws up a full-scale modulated sideband pair centred around the input sampling frequency of 352.8 ksps. They get aliased back down to the base band upon decimation. The frequencies 'go back to where they came from', so this isn't audibly harmful. But the passband frequency response will be altered by these components adding to or subtracting from the existing base band signal, so we'll need the stopband attenuation of the filter to be high enough that the overall response doesn't deviate too much from flat.

To achieve this, I defined the primary stopband to extend 20kHz either side of 44.1kHz, i.e. from 24.1kHz to 64.1kHz. A stopband attenuation of at least 46 dB between these frequencies will ensure that the extra passband ripple caused by the aliased components is less than 0.086 dB. As for the inherent passband ripple, I went for 0.05 dB, giving us a worst possible passband ripple of 0.136B, which is acceptable for this particular system.

Why only define the stopband over a finite range of frequencies? Because you can get more attenuation where you need it, if you don't ask for attenuation at frequencies where you don't actually need it. As it happens, in this particular case forcing the attenuation over this range of frequencies also ensured that it was at least that good at higher frequencies. It doesn't always work out that way.

The filter is driven from a source with an out-of-band noise floor that's rising at +18 dB per octave (it's actually the output of a processed and partially-filtered delsig modulator). To stop this from becoming an issue, we'll need a stopband rejection slope of at least -18 dB per octave in the frequency range where the noise is rising like this. This is another way of saying this is that there are (at least) three transmission zeroes at infinity. That means that we can't use 'catalogue' elliptic filters, which have a maximum final high frequency stopband slope of -12 dB per octave in even-order form.

One more thing: because this analogue filter will eventually be transformed into the digital domain using the bilinear transform, we'll need to 'prewarp' our design frequencies. This is done to ensure that the final passband and stopband frequencies are in the desired place after the transform. The bilinear transform 'warps' the frequency axis, with the digital filter's features always ending up at a somewhat lower frequency compared to their starting point in the analogue domain. Taking this into account means that the design passband edge for the initial analogue filter should be at 20.21417kHz. OK, that's only a 1% difference. The amount by which you need to shift the frequency can really shoot up if your sample rate isn't a high multiple of the frequency point being warped, though. The warped stopband points are 24.47692kHz and 72.10644kHz; that upper one has shifted up by a significant 12.5%.

Step 2: Generate an s-domain polynomial for the basic lowpass response
The solution used here to define both an arbitrary stopband and a specific upper stopband slope is to use a 'zero placer' program of the type that delivers an equiripple (i.e. flat to within a maximum ripple value) passband with a user-defined count of finite and infinite poles. I dug out some of my ancient self-penned filter design tools to do this (containing code that dates back to the early 80s, informed by classic filter design texts dating back to the 60s).

1???2?Next Page?Last Page

Article Comments - Designing custom digital filter (Par...
*? You can enter [0] more charecters.
*Verify code:


Visit Asia Webinars to learn about the latest in technology and get practical design tips.

Back to Top