Using the parallel port as a logic sniffer

[Fernando] wrote in to share his take on building a logic analyzer. He’s using the parallel port to capture data and feed it to the display software of your choice.

The method depends on a custom kernel which alters the way the parallel port works. The kernel he compiled includes a method of intercepting the signals coming in from the hardware, passing that data to the /dev/parport* as it should, but also sending a copy to /dev/parportsnif*. It also creates a log file which is in the OpenBench Logic Sniffer format for easy use with various display software.

Of course this is easiest to use with a Linux system, but can also be run as a virtual machine under Windows. We’d plan on using a virtual machine within Linux as well since this is a custom kernel and will probably only see occasional use.

26 thoughts on “Using the parallel port as a logic sniffer

  1. - Very nice, I vote parallel ports get brought back. Jeez, my last build I found the hard way many MB’s don’t even have an IDE bus anymore so I could use a dvd drive I had laying around…

    1. good to hear. As I read it I thought “Why didn’t they just make it a module?” :P That’s what hybrid structures are for!

  2. Perhaps a link for the under 20′s as to what a parallel port is might be appropriate.

    Yes I’m saying no computer has those anymore, and in fact unfortunately not even serial ports :/ but damn floppy ports live on though.. so we need hacks to do something with those since currently they are not in use.

  3. Both my PC’s have them. They’re so much faster for prototyping than USB (im a windows user and holy shit at the things you need to do for libusb).

    1. Good luck getting access to the parallel port in a modern windows OS (Windows freaks out if you try to read/write from arbitrary IO ports…)

      V-USB and an AVR chip on the other hand will have you up and running pretty damn quickly.

  4. There is no explanation why the Author is removing the existing LP kernal support and using his kernel module. Sounds like a lot of trouble. Why not just use the existing parallel port support?

    1. By the sounds of it the real ports remain I haven’t looked at his code but the old module is just a modprobe away anyways.

    2. “It also creates a log file which is in the OpenBench Logic Sniffer format for easy use with various display software”

      Not sure why you couldn’t just write code that watches the port and creates the log file, though.

    3. Well, this is actually a parallel port sniffer, to see what programs do with the parallel port. In fact I was able to analyze a BlueLab program that uses the parallel port to program a bluetooth chip with this kernel module. I didn’t think of it as a logic analyzer as hackaday suggest, but I guess it will work. To use it as an analyzer, you would need to make a small program that keeps reading the parallel port in a loop, and then use any of the data pins.

      1. Oh, weird, yeah I thought HaD was implying something completely different. So this is like Wireshark for your LPT port? O.o Just plain bizarre, especially on a platform that runs mostly OSS.

      2. You could run windows in a virtual machine and map window’s parallel port to the real one, and snif that traffic.

    4. I’d assumed it was because Linux is not (by default) an RTOS, and you’d want to keep the OS from messing up your timing; in which case this would be pretty cool, just pop the module in, instead of having to recompile your entire kernel (as some CNC software makes you do).

      However, Fernando hit it on the head, methinks.

  5. A very old project like this was to use an 8-bit ADC and read the data thru the LPT port, giving you a way to log analogue data (battery voltages etc).

    An even older project sent the data as 2 sets of 4 bits (via the status lines) as the data lines were output only.

    The parallel port has survived for a surprisingly long time. If your motherboard doesn’t have the connector it may have a header for it on there somewhere, you’ll need to find the cable for it.

    1. You really need an RTOS if you want to do any kind of analog data logging with the parallel port — and even then you’re only going to get 5 bits of precision — since the parallel port only has 5-input bits.

  6. I did this project many years ago, first useing QBasic, Remember that? the i went on to make a graphical version with Borland Visual C++, fine till you get to winXP, no special hacks, just used portIO for winXP to open the ports up, I still use a Compaq evo N6000c for deving from time to time, it has just abou every hardware port you could want

  7. How timely :) I was just browsing some parallel port tricks last week and getting all inspired. Found a lil dell craptop P3 700Mhz that is all linuxed out and ready to play. Love the old stuff :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s