Agustín Gimenez Bernad's LogicAnalyzer Turns a Raspberry Pi Pico Into a $4 24-Channel 100Msps Marvel

Requiring nothing more than a Windows PC, a $4 Raspberry Pi Pico, and some cables, this logic analyzer project impresses.

Gareth Halfacree
2 years agoDebugging / HW101

Developer Agustín Gimenez Bernad has creating a surprisingly high-performance yet low-cost 24-channel logic analyzer, capable of offering a hundred megasamples per second (100Msps) — running on a $4 Raspberry Pi Pico microcontroller board.

"LogicAnalyzer is a very cheap analyzer based [on] a Raspberry Pico," Bernad explains of the open-source project. "The analyzer offers up to 24 digital channels, pre and post trigger sampling, edge trigger and pattern trigger up to 16 bits. [It runs at] 100Msps, 32k samples deep."

When Bernad says the LogicAnalyer is based on a Raspberry Pi Pico, he really means it. "The most basic version is purely a Pico as-is, you only need to short GPIO0 and GPIO1, upload the firmware and you're good to go." As a result, aside from cables and a Windows-based desktop computer, you can get started with the project for just $4 in hardware.

"Of course this has some limitations," Bernad admits, "as the Pico only supports 3.3v, if you want to use it to diagnose 5v signals I also have designed a fast level shifter board."

With or without the level-shifting carrier board, or a separate board designed to balance trace lengths to the input pins, the LogicAnalyzer works by using the Raspberry Pi Pico's surprisingly powerful dual-core RP2040 microcontroller — in particular its programmable input/output (PIO) blocks. "You would [normally] need a 1.6GHz [Arm] CPU to sample at 100Msps," Bernad explains.

"So, how the heck [is] the Pico able to achieve this? Well, the key are the PIO units. These units are a wonder, they are coprocessors explicitly designed to handle IO, it uses a very restricted and deterministic assembler (only nine instructions that each take a single cycle to execute) but extremely efficient, so efficient that with only two instructions is possible to create a loop that captures GPIO data up to 30 bits and redirects the program flow based in the status of one of these GPIOs."

The analyzer's three triggers — edge, fast pattern, and complex pattern — all run on the PIO blocks. The edge trigger is a two-instruction program taking up a single one of the Pico's eight state machines, allowing eight to run in parallel for the full 100Msps sampling rate; the complex trigger uses two state machines and runs more slowly; and the fast trigger uses what Bernad calls "a very clever 'hack' that abuses the limitations of the PIO units" to run at 100Msps across up to five channels — "it can work even faster," Bernad claims, "up to 200Msps."

To go along with the Raspberry Pi Pico firmware, which should also be compatible with other boards based on the RP2040 microcontroller so long as all eight PIO state machines are available to the user, Bernad has written a Windows software tool that provides a graphical user interface for capture and protocol analysis.

Asked why he didn't simply add support for the analyzer to the existing Sigrok project, Bernad blames trouble getting the software to run reliably and a history of rapid from-scratch development: "I have been creating Windows apps for more than 20 years," Bernad claims, "and it takes me less time to implement a rendering system, plugins, and so on than implementing a third-party driver."

Full details on the project are available on the LogicAnalyzer GitHub repository, where the source code is made available under the reciprocal GNU General Public License 3.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles