Hi, All.
So I have this gig building a cathodoluminescence system for use in electron microscopes. It needs a programmable-gain amp with about 0.2 dB steps, low noise, and a bandwidth of > 40 MHz.
A previous voltage-controlled amp board for a biomed customer used a
256-step dpot and a power-of-two PGA made from a 74HC4051 MUX and a resistor string. Except at the very lower limit, the dpot's attenuation is never more than 6 dB, which helps the noise a lot.A little Cortex M0+ (LPC804) measures the control voltage and sets the dpot and PGA. It has a calibration loop that executes in a second or so at boot-up, so everything is kept relatively copacetic and accurate.
Thing is, its BW is limited to less than 1 MHz by the dpot, and depends on the dpot setting, so there's no straightforward way of compensating. Thus there's no way it's ever getting to 40 MHz. For this one, I wanted to use a distributed attenuator--an RC ladder network with switches in the shunt legs, like this:
In 0-*--Rser1---*---...---*--RserN---* ---------*---0 Out | | | | | *--Cpar1---* *--CparN---* Cload | | | *-----* *-----* GND | | | | Rsh1 Csh1 RshN CshN | | | | | | | | *-----* *-----* | | | | SWITCH Csw SWITCH Csw | | | | Rsw | Rsw | | | | | *-----* *-----* | | GND GND
The math for this is fairly ugly, so I coded up a smallish C++ program to optimize it, using the Nelder-Mead downhill simplex method (amoeba in Numerical Recipes, 2nd Ed.).
The penalty function for the optimizer is a linear combination of the accuracy of the steps (mean error over frequency) and the rolloff, with an adjustable constant setting the balance.
Turns out that with fairly garden-variety CMOS bus switches (5 ohms, 3.5 pF Coff) I can do a 4-bit distributed 0-6 dB attenuator with RMS error of a couple of tenths of a percent over the whole range. (There are better ones, but few I know of work above 3.6 V.)
I made some effort to include realistic strays in the analysis, so I expect it to work pretty well.
Fun.
Cheers
Phil Hobbs
(If anybody has a similar problem, I'll happily share the code.)