Page 181 - The Art of Designing Embedded Systems
P. 181

168  THE ART OF  DESIGNING EMBEDDED SYSTEMS

                        is not toggling. Scoping the pins will prove  this one way  or the other,
                        though now you’ll need another hypothesis and experiment to figure out
                        why the selects are not where you expect to see them.
                             Sometimes,  though,  the  hypothesis-experiment  model  should  be
                        much less casually applied. When Intel started shipping the XL version of
                        the 186 (supposedly compatible with the older series), I had a system that
                        just would not start with this version of the CPU. Scoping around showed
                        the processor to be stuck in a weird tristate, though all of its inputs seemed
                        reasonable.  One hypothesis was that the  186XL was not coming out of
                        reset properly, an awfully hard thing to capture since reset is a basically
                        non-scopable one-time event. We finally built a system to reset the proces-
                        sor repeatedly, to give us something to scope. The experiment proved the
                        hypothesis, and a fix was easy to design.
                             Note that an alternative would have been to glue in a new reset circuit
                        from the start to see if the problem went away. Problems that mysteriously
                        go away tend to mysteriously come back; unless you can prove that the
                        change really fixed the problem, there may still be a time bomb lurking.
                            Occasionally the bug will be too complicated to yield to such casual
                        troubleshooting.  If the timing of  a PAL will have to be adjusted, before
                        you wildly  make changes visualize the new timing  in your  mind or on
                        a sheet of  graph paper.  Will  it work? It’s  much faster to think  out the
                        change than to actually implement it. . . and perhaps troubleshoot  it all
                        over again.
                             Rapid troubleshooting  is as important as accurate troubleshooting.
                        Decide what your experiment will be, and then stop and think it through
                        once again. What will this test really prove? I like experiments with binary
                        results-the   signal is there or it is not, or it meets specified timing or it
                        does not-since   either result gives me a direction to proceed. Binary re-
                        sults have another benefit: sometimes they let you skip the experiment al-
                        together! Always think through the actions you’ll take ufrer the experiment
                        is complete, since sometimes you’ll find yourself taking the same path re-
                        gardless of the result, making the experiment superfluous.
                             If the experiment is a nuisance to set up, is there a simpler approach?
                        Hooking up 50 logic analyzer probes or digging through a million trace
                        cycles is rather painful if you can get the same information in some easier
                        way. I’d hate to be in a lab without a logic analyzer, since they are so use-
                        ful for so many things . . . but I try to keep it as the tool of last resort, since
                        most often it’s possible to construct an easier experiment that is complete
                        in a fraction of the time it takes to connect the LA.
                            Don’t be so enamored of your new grand hypothesis that you miss
                        data that  might  disprove  it! The  purpose  of  a hypothesis  is  simply  to
   176   177   178   179   180   181   182   183   184   185   186