feature article
Subscribe Now

$4 Logic Analyzer Based on Raspberry Pi Pico

Here’s a truly inspired project. Dr. Agustín Gimenez Bernad, a Senior Developer in ServiZurich S.A. in Spain, has created one of the most brilliant hacks I’ve seen yet. He’s built a 24-bit logic analyzer that samples at 100 Msamples/sec and stores 32K samples from nothing more than a $4 Raspberry Pi Pico board and some clever code. There’s a lot to learn from this project, which is posted with some very fine documentation on GitHub, but if you just need a $4 logic analyzer, there’s still a lot to be admired.

I go way, way, way back with logic analyzers. My Senior Lab project in college was a logic analyzer. I ordered a bunch of 2102 1Kbit SRAMs from Bill Godbout Electronics, which was located in a Quonset hut on the edge of the Oakland airport. Those SRAMs were a hot item back then. Put eight of them together and you had all of 1Kbyte of RAM for your 8080 microprocessor. I didn’t know it at the time, but Godbout supplied parts to all the early microcomputer pioneers at the Homebrew Computer Club in the San Francisco Bay area including Lee Felsenstein (Processor Technology Sol 20) and George Morrow (Thinkertoys and Morrow Microsystems). I mention those two people because I eventually bought 8-bit microcomputers designed by both of them. (Sadly, Bill Godbout perished in one of the 2018 California wildfires.)

My Senior Lab logic analyzer never worked. My portions of the project, the probe front end with variable logic levels and the memory subsystem, worked. However, my project partner did not complete their part of the project and I’m guilty of not coordinating well with my partner during the project development cycle. Nevertheless, I learned a lot about digital instrument design (and team-based design) from the project. That was back in 1975.

Just a few months later, I joined HP’s Calculator Products Division in Loveland, Colorado. When I arrived, I saw that the lab had one of HP’s earliest logic analyzers, the HP 1600A, which was basically an HP portable oscilloscope with a 16-bit digital logic analyzer’s front end. This analyzer was a visually beautiful instrument, but it was so primitive that I never had use for it.

Two years later, in 1977, I was assigned an emergency project to find the root cause of a logic glitch in the soon-to-be introduced HP 9845A desktop computer. It seemed that the machine’s I/O bus was losing data when reading from an HP 9885A external floppy disk drive. A scope was useless for this kind of debugging. The glitch was so infrequent, there was no way for me to catch the glitch with any kind of scope trigger I could imagine.

Fortunately, HP’s Colorado Springs Division – which was about 100 miles south of Loveland on I-25 – had just developed the HP 1615A logic analyzer, and it had a “trigger-on-glitch” function. We were able to borrow a production prototype, and that machine found the source of the glitch in 15 minutes. The problem was the HP 9845A’s I/O backplane. It supplied two amps at 5V to four I/O cards over a 2-layer board with small power supply traces. When a specific data pattern was transferred over the I/O card’s 16-bit parallel interface to the HP 9885A, the I/O card’s internal circuitry dragged the power supply rails down just enough to corrupt the transfer. Converting the backplane to a 6-layer board with ground and power planes and adding more bypass capacitance to the board’s 5V power plane eliminated the problem, and the HP 9845A was released to production on schedule. Without the HP 1615A logic analyzer, I would have been a goat. HP subsequently announced the HP 1615A logic analyzer in early 1978. It was a huge success, for a logic analyzer.

So, yes, I am very partial to logic analyzers, and I like Dr. Bernad’s design quite a bit. Now, if you are familiar with the Raspberry Pi Pico, you know that it’s completely different from the original Raspberry Pi, which is based on an SoC that was originally used in cell phones. The Raspberry Pi Pico is based on a custom microcontroller, the RP2040, which incorporates a dual-core Arm Cortex-M0+ processor running at a maximum clock rate of 133 MHz. Given those two Arm Cortex-M0+ processors and that clock rate, there’s no way to implement a 100Msamples/sec logic analyzer with trigger logic in software on that kind of system. Instead, Dr. Bernad harnessed the power of the two PIO (programmable I/O) engines designed into the device.

Each PIO engine contains four software-controlled state machines that share a 32-entry instruction memory. The PIOs recognize just nine different instructions,and each instruction executes in one cycle. The PIO state machines can run as fast as the Raspberry Pi Pico’s system clock. Even these PIO state machines are not capable of sampling at 100 Msamples/sec with trigger conditions, but gang all eight together with some imaginative hackery, and you have a logic analyzer.

The analyzer has three trigger types: edge, fast pattern, and complex pattern. The edge trigger program requires just two instructions and runs on just one of the Raspberry Pi Pico’s eight state machines, which allows eight such triggers to run in parallel at the full 100Msps sampling rate. The complex trigger requires the use of two state machines and runs more slowly. The fast trigger overcomes the limitations of the PIO units with a “clever hack” (documented on GitHub) and can run at 100Msamples/sec across as many as five channels. Dr. Bernad has already implemented an SPI protocol analyzer for the logic analyzer and plans to implement additional protocol analyzers for I2C and RS-232, and system bus analyzers for old computers with sixteen address bits and eight 8 data bits.

Based on what Dr. Bernad has managed to do with these PIO engines in the Raspberry Pi Pico, I suspect that there’s far more that can be done with these resources. Those exciting applications are just waiting to be discovered.

Of course, a $4 logic analyzer must have limitations. Dr. Bernad’s analyzer based on the Raspberry Pi Pico is limited to 3.3V logic levels, because that’s all the RP2040 microcontroller can handle. However, the resourceful Dr. Bernad has designed a pair of boards to shift the logic levels with on-board voltage translators. One board is a carrier for the Raspberry Pi Pico, and the other board carries the level translators and is designed to plug directly into the Raspberry Pi Pico’s I/O pins.

Like any self-respecting, cheapo logic analyzer these days, Dr. Bernad’s analyzer uses a PC for its user interface. Dr. Bernad developed his own GUI for the logic analyzer, explaining that it’s easier for him to develop his own Windows-based GUI than it is to use a 3rd-party GUI framework. I get this sense that Dr. Bernad is a real individualist. We need more people like him in the industry.

 

For more information about Dr. Bernad’s logic analyzer based on the Raspberry Pi Pico, click here.

One thought on “$4 Logic Analyzer Based on Raspberry Pi Pico”

Leave a Reply

featured blogs
Apr 25, 2024
Structures in Allegro X layout editors let you create reusable building blocks for your PCBs, saving you time and ensuring consistency. What are Structures? Structures are pre-defined groups of design objects, such as vias, connecting lines (clines), and shapes. You can combi...
Apr 24, 2024
Learn about maskless electron beam lithography and see how Multibeam's industry-first e-beam semiconductor lithography system leverages Synopsys software.The post Synopsys and Multibeam Accelerate Innovation with First Production-Ready E-Beam Lithography System appeared fir...
Apr 18, 2024
Are you ready for a revolution in robotic technology (as opposed to a robotic revolution, of course)?...

featured video

How MediaTek Optimizes SI Design with Cadence Optimality Explorer and Clarity 3D Solver

Sponsored by Cadence Design Systems

In the era of 5G/6G communication, signal integrity (SI) design considerations are important in high-speed interface design. MediaTek’s design process usually relies on human intuition, but with Cadence’s Optimality Intelligent System Explorer and Clarity 3D Solver, they’ve increased design productivity by 75X. The Optimality Explorer’s AI technology not only improves productivity, but also provides helpful insights and answers.

Learn how MediaTek uses Cadence tools in SI design

featured paper

Designing Robust 5G Power Amplifiers for the Real World

Sponsored by Keysight

Simulating 5G power amplifier (PA) designs at the component and system levels with authentic modulation and high-fidelity behavioral models increases predictability, lowers risk, and shrinks schedules. Simulation software enables multi-technology layout and multi-domain analysis, evaluating the impacts of 5G PA design choices while delivering accurate results in a single virtual workspace. This application note delves into how authentic modulation enhances predictability and performance in 5G millimeter-wave systems.

Download now to revolutionize your design process.

featured chalk talk

Industrial Internet of Things (IIoT)
Sponsored by Mouser Electronics and Eaton
In this episode of Chalk Talk, Amelia Dalton and Mohammad Mohiuddin from Eaton explore the components, communication protocols, and sensing solutions needed for today’s growing IIoT infrastructure. They take a closer look at how Eaton's circuit protection solutions, magnetics, capacitors and terminal blocks can help you ensure the success of your next industrial internet of things design.
Jun 14, 2023
35,808 views