Page 188 - The Art of Designing Embedded Systems
P. 188
Troubleshooting 175
chew up, but you can use your general knowledge of systems to make
some ballpark estimates about where problems will occur.
For example, a fast serial link might overrun a busy CPU. Estimate!
A 38,400-baud link carries about 4000 charactershec, or one character per
250 psec. That is not a lot of time for any CPU, particularly the typical
embedded 8-bitter. Your processor will be pretty busy servicing the data.
If it’s polled, then only heroic efforts will keep you within the 250-psec
timing margin.
Suppose you chose to implement the serial receive routine as an
ISR-what is the overhead? An assembly routine to queue incoming data
will need a dozen or two instructions, each of which will no doubt burn up
two or three machine cycles. Surely you know roughly how long a ma-
chine cycle takes (including wait states) for your system. . . don’t you?
Given this information, you can get a reasonable timing estimate before
writing a line of code.
Recently an engineer told me, “That initialization loop is clearly the
problem.” Oh yeah? He was looking for something burning up almost a
second of time, when clearly, regardless of processor, l000h memory zero-
ing iterations will run in a few milliseconds. Use your tools, one of which
is your brain, to make sure you are addressing the real problems.
Recently I saw a technician troubleshooting a board that exhibited
multiple problems. One chip was hot enough to fry eggs, yet he chose to
work on another, “unrelated” symptom. Dumb move-surely the part was
ready to self-destruct. which surely would create yet more grief for the
poor tech.
Always check a bare PC board fresh from the fab for a short between
Vcc and ground. Because there are so many access points for these two
“nodes.” they’re the easiest to short. If there is a short, connect the bare
board to a honking power supply and run some current through the short.
You’ll either blow it or you’ll be able to find it using the “burn your fin-
ger” heat test. Either way, you’ll locate the short.
Then, before you load all of the parts onto the PCB, think deeply
about what subset of components are really needed to start testing. Load
only those required. When you’ve got a dozen parts hanging on a bus, it’s
hell to find the one that asserts the wrong signal at the wrong time. It’s far
more efficient to load parts only as required, populating the board slowly
in step with your testing, to make it easy to find the culprit in multiple-
enable situations.
I like to power boards from a current-limited lab supply that has an
ammeter. I look at the current from time to time to make sure I’m not doing

