Digital logic

Lead Image © Oleksiy Tsupe,

Analyze This

We show how to use a logic analyzer to isolate problems in your hardware setup.

Designing software and hardware on Raspberry Pi and Arduino computers can be pretty easy and clear. However, when things don't work, and you aren't sure where the problem is, it can be very frustrating. Many software engineers are used to finding bugs in software by using source code debuggers and print statements and by working to duplicate and isolate the problem. And, you get pretty good at it after a while.

However, in small computer systems, you add another layer, which is the hardware. Trying to figure out why your I2C device isn't responding can be very difficult when you have no idea what is actually going out on the I2C bus. Why is your stepper motor not turning? Why can't you get your Raspberry Pi to talk to your Arduino across a serial interface? Often, the answer is either in the wiring or the grounds, or you just aren't writing the correct data out; however, the answer can be difficult to find when you can't see the signals and the data coming across the lines. This is when a logic analyzer can be worth its weight in gold.

What Is a Logic Analyzer?

A logic analyzer is a test instrument that captures and displays multiple signals from a digital circuit. It converts the captured digital data (as opposed to analog data) into timing diagrams, decoded protocols, state machine traces, and sometimes even assembly language. Logic analyzers have triggering capabilities, which can help you locate a problem, and they are useful when a user needs to see the timing relationships between many signals in a digital system.

Decent logic analyzers aren't very expensive anymore. The eight-channel USB logic analyzer I use in this article costs about $150. You can find other brands for less and other models for a lot more. A USB-based logic analyzer tends to be cheaper because you use your computer screen, keyboard, and your own computer to crunch the data – unlike units that include all of the above. Typical USB brands include:

  • Saleae
  • Intronix
  • USBee
  • Knockoff Saleae brands (emulating the Saleae API) all over eBay
  • BitScope
  • ChronoVu

Note: When you are debugging hardware, remember the golden rule: "You can always trust your mother, but you can never trust your ground." Make sure you have connected a common ground between your devices. Things act really funny when your ground is loose or not connected. Make sure it is solid.

The Logic Analyzer I Use

A few years ago, I bought a Saleae eight-channel USB logic analyzer. It was $150 at the time, and I'm pleased with its performance. This particular model has been discontinued, but similar products are available. A logic analyzer is a great tool, and when you need it, you need it.

Twenty years ago when I started designing VLSI (Very Large Scale Integration) integrated circuits (ICs), I spent many hours looking at the outputs of my chip to make sure things were working properly. After a period of bench testing, I would take the simulation data that was generated during a design and put it on a VLSI tester, which can easily cost $2 million or more. And yet, the results needed to match (functionally anyway) my results on the bench. A million dollar VLSI tester can do a lot more than a logic analyzer. It can check parametric-like rise and fall times and voltage levels, switch loads to require more current, and vary the power supplies (even change the ripple) to make sure your ICs work. I can't do that with this $150 logic analyzer, but I can see if the digital signals are coming out at the right time in the right sequence.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content