Hackaday.io Hackaday.io
Projects
Recently Updated Most Likes Newest Project Lists
Discover Contests Courses Stack
More
Courses Tutorials Events Hackerspaces Hackaday.com Tindie Marketplace
Sign up Log in
Close
0%
0%

Logic analyzer using raspberry pi

To evaluate the feasibility of designing a logic analyzer using raspberry pi

vikas-vVikas V
Following Follow project
Liked Like project

Become a Hackaday.io member

Not a member? You should Sign up.

Already have an account? Log in.

Sign up with Github
Sign up with Twitter
OR
Forgot your password?

Just one more thing

To make the experience fit your profile, pick a username and tell us what interests you.

Pick an awesome username
hackaday.io/
Your profile's URL: hackaday.io/username. Max 25 alphanumeric characters.
Pick a few interests
Projects that share your interests
People that share your interests

We found and based on your interests.

Choose more interests.

OK, I'm done! Skip
Join this project
Similar projects worth following
10.3k views
12 comments
24 followers
8 likes
  • Description
  • Details
  • Files 0
  • Components 0
  • Logs 1
    • View all
  • Instructions 0
  • Discussion 12
10.3k
12
24
8

Team (1)

  • vikas-vVikas V

Join this project's team
researching project
hardware
logic analyzer raspberry pi

This project was created on 03/02/2016 and last updated 5 years ago.

Description

A raspberry pi can potentially be programmed to look at the GPIO ports and display them on the screen. But in order to be fast enough, the programming will have to be bare-metal C or assembly. This project aims to evaluate the limitations of doing so.

Project Logs
Collapse

  • Existing projects

    Vikas V • 03/08/2016 at 10:30 • 0 comments

    It seems there are some projects which make the raspberry pi into a minimal logic analyzer with some hardware. Here are the links:

    1. http://tuxbabe.eu/raspalyzer.html
    2. https://github.com/richardghirst/Panalyzer
    3. https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=7696

    There is another project which uses a PC based oscilloscope to achieve a similar result:

    http://codeandlife.com/2012/05/16/worlds-simplest-logic-analyzer-for-5/

    These projects have a max sampling rate of 1us (i.e 1MHz) which is not enough for most uses. I think the bottleneck might be the GPIO speed rather than the processor or software. To get higher sampling rates, the GPIO internal circuitry should be able to reliably read the incoming data. Here is an article showing the GPIO benchmark results for outputting bits:

    http://codeandlife.com/2015/03/25/raspberry-pi-2-vs-1-gpio-benchmark/

View project log

Enjoy this project?

Share

Discussions

Log In/Sign up to comment

Become a Hackaday.io Member

Create an account to leave a comment. Already have an account? Log In.

Sign up with Github
Sign up with Twitter
OR
skoehler wrote 08/27/2019 at 17:47 • point

I don't see the point in using baremetal C code or interrupts. What you want to do here is to DMA the state of the GPIO pins into a memory buffer. If you can manage to use DMA, you can probably record 8 or 16 channels at 100 MHz and more.

The problem (at least for me) is writing the driver for the Linux kernel.

If the CPU is like your typical ARM chip, the GPIO inputs are probably in a 16 or 32-bit register mapped to memory. Telling the DMA-controller to copy that to memory will be the most efficient way to capture data.

  Are you sure? yes | no

markbng wrote 09/29/2016 at 13:25 • point

50MS/s is a good throughput. I thought it would be less samples per second. Another option is a FPGA as frontend. It analyzes the input signals (with time stamp and compression), connect some buffer SDRAM and communicate with SPI and INT with the RPI. This will enhance the sample rate and maybe reduce the system load (of checking the IO's 50.000.000 times per second).

  Are you sure? yes | no

Vikas V wrote 09/29/2016 at 15:07 • point

Thanks for your suggestion. The main goal of this project is to have as little extra hardware connected to the RPi as possible. If it seems impossible to do it just using (bare metal) software, then an alternate solution such as FPGA might have to be added.

  Are you sure? yes | no

Eric Hertz wrote 03/08/2016 at 15:41 • point

I had a similar idea, but it's currently a bit above my head... @usedbytes gave some great info on my project-page, which maybe could be helpful to you... #Operation: Try the Pi

  Are you sure? yes | no

Vikas V wrote 03/08/2016 at 16:32 • point

Thanks. That discussion was eye-opening. It seems there is more to it than I thought. I come from an AVR background and the ARM in the Pi has much more complicated microarchitecture which makes things complex. But even if the programming issues are resolved, I think the bottleneck for speed will still be the GPIO hardware inside the chip.

  Are you sure? yes | no

Eric Hertz wrote 03/08/2016 at 17:56 • point

Similar story, here. But I'm sure it can be done! :) Those benchmarks you showed were a bit enlightening, as well... 22MHz is possible, that's pretty fast. No mention of whether that was bare-metal or not. I'm curious to try toggling a pin on a similarly-spec'd non-arm architecture and see what happens...

  Are you sure? yes | no

Vikas V wrote 03/08/2016 at 16:36 • point

BTW, here are some more RPi bare-metal programming resources:

https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/

http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/

  Are you sure? yes | no

Vikas V wrote 03/08/2016 at 18:11 • point

A fellow hacker @Kumar, Abhishek has designed a logic analyzer using the Beaglebone which goes upto 100MHz sample rate. The project is called #BeagleLogic and was featured on the blog. When I asked him about implementation of a similar thing on the raspberry pi, he said it was possible on the beaglebone because the GPIO is not directly handled by the main processor, rather a co-processor which runs independently and communicates with the main processor.

  Are you sure? yes | no

Vikas V wrote 03/08/2016 at 18:13 • point

@esot.eric

  Are you sure? yes | no

Eric Hertz wrote 03/09/2016 at 06:07 • point

Ah hah! It sounds like the BeagleBone is quite well-suited (if not *designed*) for high-rate I/O, plausibly even a connection of external bus like PCI... Whereas the RPi seems to be more of a "black-box" single-board *computer* with, essentially, the equivalent of a PC's parallel-port as the only means of *direct* bit-level communication. Another way, maybe, to look at it is as though the RPi is a bit like a low-pin-count microcontroller, like the AVR, at the bit-interface-level, but with a *really fast* core hidden in the background, fast enough, maybe for (Linux!) OS-overhead. while still accessing the bit-level interface at the rates of a uC... (as I see it, having *zero* Pi, not PiZero, experience ;)

  Are you sure? yes | no

Vikas V wrote 03/09/2016 at 15:58 • point

@esot.eric Yeah. BeagleBone has what is called a PRU (programmable real-time unit) whose task is to handle high-speed GPIO (http://hackaday.com/2014/06/22/an-introduction-to-the-beaglebone-pru/).

About the RPi lacking such a thing, it kinda makes sense because the RPi was mainly designed to teach programming to kids. To achieve that, a high-speed GPIO is not needed but a high-speed processor core is (for OS overhead as you said).

BTW, this thought occurred to me of using interrupts on the RPi processor to trigger the acquisition of data. I have not done any research on this and am not sure how the cache, branch predictor etc.. will affect it but it might work. The idea is to run a counter and trigger an interrupt when the count reaches a value. This is commonly done in AVR as you might know. Need to read up on the processor architecture to see if it might work.

  Are you sure? yes | no

Eric Hertz wrote 03/13/2016 at 11:03 • point

Curious to see what you find out about your interrupt-idea!

#BeagleLogic has an awesome explanation of the PRU system, thanks for that link!

@K.C. Lee mentioned on another project that it might be possible to use the RPi's SDIO interface as a, plausibly, 50MS/s 4-bit logic-analyzer...

  Are you sure? yes | no

Similar Projects

The 2016 Hackaday Prize
Make Raspberry Pi Again
Project Owner Contributor

Raspberry Pi project

aryaArya

This project explains the best operating systems that suits the various Raspberry Pis'
Project Owner Contributor

The best operating Systems for Raspberry Pi

moses-zikeiMoses Zikei

RPiAPI is a lightweight WSGI API built on top of the RPi GPIO library. It provides endpoints so you can interact with your Raspberry Pi
Project Owner Contributor

RPiAPI

victor-ribeiroVictor Ribeiro

As a beginner, this article helps you come up with various ideas on what you can start doing using your Raspberry Pi.
Project Owner Contributor

The best Raspberry Pi projects for beginners

moses-zikeiMoses Zikei

Does this project spark your interest?

Become a member to follow this project and never miss any updates

Going up?

About Us Contact Hackaday.io Give Feedback Terms of Use Privacy Policy Hackaday API

© 2023 Hackaday

Yes, delete it Cancel

Report project as inappropriate

You are about to report the project "Logic analyzer using raspberry pi", please tell us the reason.

Send message

Your application has been submitted.

Remove Member

Are you sure you want to remove yourself as a member for this project?

Project owner will be notified upon removal.