Oscilloscope UpdateThe wise embedded engineer will be a master of many tools. The scope is one of the most important.
Published in Embedded Systems Programming, April 1995
For novel ideas about building embedded systems (both hardware and firmware), join the 35,000 engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype and no vendor PR. Click here to subscribe.
By Jack Ganssle
"Give us the tools, and we will finish the job." Perhaps developing embedded systems doesn't need the same amount of equipment Winston Churchill was asking for, but you stand as little chance of winning the development battle without the right armement as England did in winning the war with their island's limited resources.
Flip through this magazine. Ads from every conceivable purveyer of embedded tools leap off the page in their attempt to grab your attention. Yet scope ads are strangly absent. What gives?
Scopes don't get no respect. Too many of us view them as hardware debugging tools, only, when in fact in many cases a scope can perform software debugging miricles.
The January issue of Circuit Cellar Ink, for example, includes an interesting article about 386 protected mode. Scope traces show exatly how much time the 386 takes to execute various call and task gating operations. The author instrumented his code with one or two instructions, and watched their actions on his digital oscilloscope. So, in this case the instrument works as a poor man's software performance analyzer.
Suppose your code periodically, and unexpectedly, resets? Plop the scope probe on the output of the watchdog timer and see if it is the culprit. The best an emulator or ROM monitor could tell you is that, well, yes - the code is going through the reset routine. Only a scope can give the definitive answer with only a few seconds of looking around.
An oscilloscope is nothing more than a graphing machine, displaying one or more plots of voltage (from a probe) versus time. Like the EKG monitor in an intensive care unit, the scope displays traces in on a CRT, in real time. It is the one truly indespinsible tool for working on any kind of electronic equipment, as it is just about hte only way to view non-DC signals. If you can't monitor voltage, you'll never know what your system is doing, and the old standby of applying wetted fingers to a test point just doens't give the quantative data needed on real time digital systems.
A number of related instruments are scope-like in nature, but are used for different applications. Probably the most common of these is the spectrum analyzer, which displays voltage (or power) versus frequency. In effect, it translates input signals from the time to the frequency domain. Anyone working on transmitters or recievers absolutely requires a spectrum analyzer to see what frequencies their systems are creating.
See the August and September 1992 issues of Embedded Systems Programming for ideas about software development using this versitile tool. Like any other tool, you'll have to invest study and time into truly mastering their uses, but the investment will make you a hero when tracking down interrupt latencies or nasty bugs that don't succumb to your usual weapons.
As is true in every other arena of this industry, oscilloscopes continue to evolve rapidly in response to customer demands for features. Though you can still buy an instrument that bears a striking resemblance to the one your dad used in 1965, no embedded developer will be satisfied wtih the performance.
Everything in electronics keeps getting faster; scopes are no exception. Speed, though, may mean different things to different vendors.
As a user, you want to be sure that when looking at the fastest signal in your system, the scope will show it undistorted. We digital folks push speed requirement to the max, not so much because of our sustems' clock rates but because an ideal digital signal slews between a zero and a one infinately fast. A little Fourier theory shows that such a sharp edge is made up of signals that with frequencies way out beyond that of light.
Thankfully our electronics is not so perfect! Real components have rise and fall times typically in the nanoseconds, so you probably won't need that nifty 5 Ghz model with a price tag approaching a Kansas townhouse.
Surely, though, the 50 Mhz standard of old is now adequate only for work on older, slower embedded systems. If you're pushing out clocks up above 20 Mhz, figure on a minimum 100 Mhz scope bandwidth. This will catch those narrow zero-wait state chip selects that a software developer may need to see. With a 30 Mhz clock 100 Mhz will suffice for any realistic software troubleshooting needs, but a hardware guy tracking down wierd problems will probably want more performance.
A few years back we were on the prowl for a FIFO glitch. A 100 Mhz unit showed the FIFO's clock to be ideal - perfect, really. Why were these things clocking erratically? A borrowed 1 Ghz HP quickly identified the culprit: a 1.5 nsec transition that had been smeared into oblivion by the slower scope. Sometimes, when pushing the limits, ya just gotta have the best.
Analog Vs. Digital
Surely the biggest change in scope technology in the last decade is the advent of the digital oscilloscope.
First generation digital products were meant to replace their awkward analog cousins, the storage scope. These old beasts, now essentially extinct, could capture a single, very fast sweep, leaving it displayed for many seconds or minutes. (A non-storage, non-digital, scope has very uses a screen phosphor with short persistance - a single sweep appears and fades in the blink of the eye). Storage scopes used either long-persistance phosphor (in the really old days), or immensely complex CRTs which stored the displayed trace by constantly refreshing it.
Clearly, digital technology offered less expensive alteranives. An A/D converter on each vertical channel digitizes the input; the microprocessor can then paint the trace as often as needed to keep even fleeting events displayed for as long as the user needs. Scope designers could, and often do, handle the screen like the CRT on your computer terminal, rasterizing the display just like a TV.
Seems ideal, doesn't it? Early digital models got a rocky start, though, due to limited speeds of the A/Ds. If you set the sweep to 10 nsec/cm, and expect to see at least 10 points in each cm of the display, the A/D must acquire another sample every nanosecond. That is one fast A/D!
Well... no one could produce equipment that ran that fast until very recently. A number of alternatives existed. One of my favorite models is Tek's 2232, a 6 or 7 year old unit that runs with perfect digital sampling at any sweep rate slower than 1 usec/cm. Faster than this it picks up only a small fraction of the input waveform. You get perhaps one or two points per cm, each of which is displayed as a dot. Assuming your input waveform is periodic and stable, you wait a few seconds as the instrument collects more and more sweeps, each time adding data (dots) to the screen. It's impossible to watch a rapidly changing input (you get a blur of dots all over the screen), but most of what we observe is in fact periodic, so the most common downside is spending time waiting for enough sweeps before the waveform is meaningful.
If you want to look at a one-shot event that is very fast, though, you are basically out of luck. You just don't get enough data to show a decent trace.
The advent of flash A/Ds, which convert the analog input to digital in a single clock cycle) is now greatly improving the acquisition performance of even reasonably-priced digital scopes. The same vendor now offers the TDS series, priced from under $3k, samples 500 million times per second - every two nanoseconds it collects another sample. "Dot mode" is replaced by the conventional smooth wave acquired in a single sweep.
These babies are sweet. No matter where you set the sweep rate you can still get a single shot view of an event. Any fast-sampling scope combines the best from the analog and digital world: analog ease of use and rapid screen updates, combined with the "infinite persistance" of the digital world.
The moral is to look beyond bandwidth when selecting a digital scope. Sampling rate is critical to handling fast single-shot events.
Most digital scopes vary the acquistion rate as a function of the sweep speed you've selected. Be warned: it's not unusual for this effect to create "aliasing", where an inadequate sampling rate creates a trace that is nothing more than an absolute lie. Connect your scope to a 20 Mhz clock. Crank the sweep rate down to the millescond/cm range. Chances are, your digital wonder will show a nice square wave a couple of orders of magnitude slower than the real signal.
Understand your tools. Unexpected results may be from pushing the scope beyond what it is designed to do.
A logic analyzer (LA) differs from the scope in that it is very wide (captures many channels), offers wonderful event triggering, and has infinite persistance - the trace stays put till you re-acquire. We've seen that digital scopes offer the same sort of persistance. Other features are starting to become similar as well, somewhat blurring the traditional lines between these instruments.
Most scopes have two vertical channels. That's great for working on many circuits, but let's face it: digital electronics is organized in wide buses. Sometimes you'll need to see more than two similtanenous events. You can reach for the LA, but now some scopes offer similar width and persistance.
Tek's TLS216 is a digital scope with 16 vertical channels. Like an LA it includes sopisticated trigger. Unlike an LA, each trace is shown with real vertical detail (LA's generally show signals only as a zero or a one, with no analog information). We're generally happy to trade the detail of the signal's analog behavior for the simplified screen an LA gives us by showing things as discrete binarty values.
Sometimes, though, the analog information is truly critical. Last week we found that a new design occasionally fetched from a wild address. The LA confirmed that the address suddenly went wild, but gave not a hint about why things were going wrong. We hung a digital scope on the address lines, a pair at a time, and found that logic zeroes were often not really zero; one's often barely made it into the legal one range. This is typical of bus conflict, where a short or design error causes two sources to drive a single node. With a scope we got the information we needed to track the problem down. The LA just confirmed a mysterious event.
HP's new logic analyzers are approaching scopes from the other LA, presumably using much of the same acquistion electronics.
Have you ever wanted to capture a signal right after an I/O read from a specific port, or the first access to a range of addresses? This again is the standard time to reach for an LA, since its triggering facilities are unmatched. Now, though, some vendors sell scope triggering devices. Connect the device's 16 or so leads to your computer bus, set the right trigger condition, and th output will pulse, triggering your scope.
This fusion of instruments recognizes that we digital folks can never stray far from the electronic realities that lie underneath our neat binary world.
With electronics constantly shrinking, much of the bulk of a scope or LA is concentrated in the display and knobs. CRTs are big, hefty monsters. You can't shrink knobs below a limit set by average finger size.
Do you have a PC at work? You bet - everyone does know. Your desk is already cluttered with its monitor and keyboard. Why not build the analog part of the scope into a module that plugs into a PC? Save cost and space by using the desktop machine's display.
Several companies make oscilloscope cards that plug into the PC's bus. Others produce units that plug into a printer or IEEE-488 port. Software bundled with the instruments handle the display and user-interaction chores. I suppose that under Windows you could open multiple screens - put the scope in one area, your embedded system's RS-232 output in another, and compilers in a third.
Regardless of approach, using a PC as the host for any instrument is has its ups and downs. You can save a ton of money over the conventional one instrument to a box approach. Integrating the output from one, or generating logged data, becomes a lot easier. Your computer's display is curely better than that of most any scope; color is missing from all but the most expensive models, yet surely your PC has at least a VGA controller.
The negatives are somewhat more ethereal, harder to measure, than the advanatages. If the scope probes come out of the back of the PC (which might be on the floor under your desk), will this limit their reach? Will you have to disasemble the PC to move the instrument to another work area?
Some people just cannot get used to operating a virtual instrument. They want a big sweep knob they can crank, generating those satisfying clicks as it detents past each position. I guess this is the reason electronic newspapers haven't caught on yet. I, for one, like to spread out the Sunday paper all over the table, with a big pot of coffee near at hand. Reading on a screen is just not the same.
Yet, virtual instruments will probably serve critical niches in the future. On a road trip why carry boxes of equipment, when a little laptop and an equally tiny acqusition module might serve as scope, LA, and voltmeter?
Even non-virtual scopes are undergoing major changes in their human interface. The sea of knobs that so impresses novices seems to be disapearing. HP pioneered this with the scopes and logic analyzers, substituting a single big knob that did most everything for individual switches and controls.
Knobs are intimadating. They're also expensive to manufacture. All of the major vendors are experimenting with ways to reduce the control count, yet that maintain the same ease-of-use you get when a single knob performs a single function.
On a recent trip I was forced to use a mouse-driven instrument that used hundreds of menus to set up various parameters. Only one soul in the company had even a glimmer of how to operate it. We spent far more time fiddling than working, driving my frustration level, at least, to record levels.
It seems that most digital scopes have non-intuitive controls. This isn't bad if you can learn to live with them. One we're using now substitutes a smooth potentiometer for the "clicking" sweep selector switch. It's a bit wierd at first, but one quickly acclimates to it.
Others, like the 2232 mentioned before, use a knob to position cursors. The cursor moves proportional to the acceleration you apply to the control. It's very counter-intuitive... but after a while grows quite natural.
Cheap, fast RAM means some digital scopes can acquire more data than fits on the screen. This is great to the user - you can get a high resolution view of a waveform for a much longer elapsed time than any analog scope offers - but creates new challenges. If the trigger point scrolls off to the left, it's easy to lose track of where you are in the display.
Most vendors deal with this problem by showing an additional bit of information - some sort of map that gives you a graphical view of where your small "real" screen's data is positioned in the much longer vector of stored data. It's like having a "you are here" marker.
Some smart scopes will now perform all of the setup automaitcally. If you've ever used an autoranging voltmeter, which eliminates the need to select the right range before taking a reading, then you have a good idea how these work. They'll generally set the voltage scale and trigger point, as well as pick a sweep rate. It's a nice feature, though more often than not you'll want to change at least one setting after the machine makes the selections for you.
Convenience features are blossoming. Many scopes now compute the frequency and period of the waveform, and will figure difference times between cursor points, RMS averages, peaks, minimums, and political party. Sometimes it's nice to have the machine do this, but fortunately every unit I've seen lets you disable the calculations, removing a lot of screen clutter.
User interface issues are critical. If the instrument is a pain to set up you'll curse every penny spent on it. Get the machine of your dreams on a trial basis for a week or two before committing real money to it, and see if you can live with the way it works. Remember the goal is easily accesible features (you don't want to spend a lot of time playing to find important menus), and very fast setup for commonly used functions. If it takes you more than a second or two to change the sweep rate, get a unit that will keep you more productive.
You wouldn't expect a Ferrari to run well on regular gas. Don't forget that the best scope is no better than its probes. In the average lab, probes are lost, stepped on, and generally abused. These puppies are expensive, costing $100 or more each. It's very tempting to buy cheap replacements. Don't.
Probes have a number of important characteristics like frequency response, input impedance, length, attenuation, and the like. Here are a few guidelines for selecting them.
First, get a probe whose frequency response is at least that of the scope. Putting a 50 Mhz probe on a 1 Ghz scope essentially tosses a few thousand dollars of capability out the window.
Remember that frequency response is usually measured at the probe's 3 db point. That is, a 100 Mhz probe will attenuate the input signal by up to 50% when a 100 Mhz input is sampled. Couple this with a 3 db rating on the scope (note that different scopes use different definitions of bandwidth, so read the fine print) and your signal could be distorted by 75% in magnitude at the very high end of the frequency limit. It's good practice, in demanding applications, to use a probe with substantially higher bandwidth than the scope (a fast probe is cheaper than a fast scope, so get rid of the errors by improving the inexpensive component).
Second, the probe's impedance will distort your readings, especially as the frequency increases. The primary difference between a X1 and a X10 probe (other than that the X10 probe divides the signal by 10) is impedance. For most digital applications use X10 probes.
Third, you must be able to compensate the probe. Electronics drifts. Stuff happens. That neat new expensive probe will degrade or change with time. Once in a white apply a good square wave (generally found as a test point on the front of the scope) and adjust that tiny little screw on the probe so the trace is indeed nice and square. Skip this step and your readings will be distorted.
Fourth, buy probes with tips appropriate to the work at hand. You'll probably want a big, fat tip for troubleshooting the Studibaker's vacuum tube radio. For fine pitch surface mount components get the smallest tips available... and a big magnifying glass.
If you do really critical analog work you may need differential probes, or active ones with FET inputs. Check the catalogs, gulp once or twice at the price, and get something that will help rather than hinder your efforts.
What Will It Cost?
Despite all the cool features and outrageous performance, scope prices seem to be declining. I'll never forget my dad showing me a state of the art scope in about 1963, costing at the time about $1000. That same $1000 is probably worth more like $15-20k in today's devalued currency, yet a really fine instrument can be had for just a few thousand dollars.
If this is outside your budget, don't despair. Arrange a rental, or even better a lease-to-own. Dozens of companies (two are listed in the sources section) will happily finance the purchase over a year or longer. You'd be surprised how easy a lease is to set up. That $250/month, for two years, sure beats shelling $5000 out all at once.
Another option is to buy used equipment from these same leasing and rental companies. Most of them have a sale once or twice a year as they clear their shelves. Since a good-quality scope lasts almost forever, there's no reason not to buy used. If you get one from a reputable company it will probably come with a warranty as well.
- Emulation Technology - 408-982-0660 - As of January, 1995 they are coming out with a digital scope.
- Allison Technology Corp - 713-777-0401 - Provide a slow, but very low cost ($190) digital scope that connects to your PC's printer port.
- Link Instruments - 201-808-8990 - Their scope board plugs into a slot on your PC and samples at 200 MS/sec. The price is quite reasonable.
- National Instruments - 512-794-0100 - National provides a broad line of data acquition equipment, all of which uses the PC as the display. Their "virtual instrument" GUI is very powerful.
- Tektronix - 503-682-3411 - Tektronix is the traditional source of scopes. The line includes a unit for just about any need.
- HP - 800-452-4844 - HP also provides a number of different scopes.
- Orion Instruments - 415-327-8800 -
- Fluke - 206-347-6100 - Fluke offers digital and analog scopes, including a neat hand held "scope meter" modelled after their popular meter line.
- Leader - 800-645-5104 - Leader also has quite a few offerings, including hand held units for field use.
- Kenwood - 310-761-8295
- Kikusui -800-545-8794
- Hitachi - 310-328-6116