SUMP compatible logic analyzer code for Arduino.

I recently implemented a logic analyzer compatible with the SUMP protocol. It was designed for a 16MHz Arduino with the ATmega328p. It might work fine on the ATmega168 but I haven't tested it. I'm using a Duemilanove. You will have to disable auto reset to make this work. See this topic: http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

The loops that do the sampling have been hand tuned to fairly precise timing using an Open Bench Logic Sniffer to measure the cycles. You absolutely need a 16MHz clock for accurate data. I haven't looked at making a version for other clock speeds but you can file a request at GitHub.

I'm very interested to hear from you if you try it on your hardware and find it useful or have trouble. I have done limited testing of multiple channels as well as basic triggering. If something doesn't work I would appreciate some feedback.

Get the code here: http://github.com/gillham/logic_analyzer

Here's my initial README:

SUMP compatible logic analyzer for Arduino

This Arduino sketch implements a SUMP protocol compatible with the standard SUMP client as well as the alternative client from here: http://www.lxtreme.nl/ols/

This SUMP protocol compatible logic analyzer for the Arduino board supports 5 channels consisting of digital pins 8-12, which are the first 5 bits (0-4) of PORTB. Arduino pin 13 / bit 5 is the Arduino LED, bits 6 & 7 are the crystal oscillator pins. Uncomment CHAN5 below if you want to use the LED pin as an input and have 6 channels.

NOTE: You must DISABLE the Arduino auto reset feature to use this logic analyzer code. There are various methods to do this, some boards have a jumper, others require you to cut a trace. You may also install a precisely 120 Ohm resistor between the reset & 5V piins. Make sure it is really 120 Ohm or you may damage your board.

To use this with the original or alternative SUMP clients, use these settings:

Sampling rate: 1MHz (or lower) Channel Groups: 0 (zero) only Recording Size: 512 (or lower) Noise Filter: doesn't matter RLE: disabled (unchecked)

Triggering is still a work in progress, but generally works for samples below 1MHz. 1MHz works for a basic busy wait trigger that doesn't store until after the trigger fires. Please try it out and report back.

I updated this code today. It now fully supports recording 1024 samples. I had accidentally defined the samples as integers and overlooked this fact until this weekend. The timing / padding was redone now that the loops are doing single byte assignments and compared against the OBLS again.

Note that I recently bought a "Seeeduino V2.21 (Atmega 328P)" which has a switch to disable auto-reset. It works really well with this code. Now that I have tried both, I definitely prefer an auto-reset disable switch or jumper over the 120 ohm resistor method.

I was looking forward this for a while. Finally, we have Arduino based logic analyzer with proper GUI! I appreciate your effort and will try soon.

Let me know how it works for you. I still need to work on triggering, but the basic logic analyzer functionality is there.

Also, I have been working on a device profile with the help of the author (Jawi) of the alternative SUMP client. Once the profile is correct and Jawi adds it, the next release of his client should have better support. The most significant feature is it will no longer require disabling auto-reset as he added the ability to delay a bit until the device is ready after the serial port is opened. If you want to use the original SUMP client you'll need to disable auto-reset, but really Jawi's client is the way to go.

Tried and works great. It was a bit hard to catch sparse I2C signal without triggering but it works. I was planing to buy the bus pirate as a logic analyzer, now I don't need it. :)

Looking forward to see trigger and proper device profile. I don't even bother to try original SUMP, since alternative one look better.

Thank you for testing this code and reporting back.

I think I have a fix for basic triggering, I need to test it further and re-measure the timing before I commit it.

I believe I've made basic parallel triggers work as they should and updated github. Can you try the latest code with some triggers and report back?

Sorry, I forgot to subscribe the thread. I will test and report. Thanks again. :)

Has anyone else had issues with this, I compiled it put it on the arduino and then disabled the auto reset. I tried the settings listed but always get " device can not be found". The tx/rx lights blink when I try to connect so something is happening at least. Just not sure what to test from this point.

Use the Arduino IDE’s Serial Monitor tool, at 115200 bps, to send ‘1’ or ‘2’ and you should get something back from the logic analyzer code if it is running. If you get the debug output, then I would say it is a problem with auto-reset not being fully disabled that prevents the SUMP client from working.

If you can, use a build from github of the newer alternative client that supports device profiles. ( https://github.com/jawi/ols ) You’ll have to check it out with git and build it yourself with maven. Put the attached file in /ols.distribution/src/main/config for the ‘master’ branch.

The github built alternative client won’t require you to disable auto-reset and it will default to values that work with the AGLA. If you can’t build it I could make a known working image available. It is just over 3MB.

Let me know how it goes.

ols.profile-agla.cfg (2.17 KB)

I'm looking to try this code but wanted to know which, if any, pin is used for ground, or doesn't this matter, this seems to be necessary with the original Open Bench Logic Sniffer. I intend to load the sketch to my Arduino, leaving it connected to my PC for power, connect the probe pin(s) to those that I want to monitor and run OLS. Has the device profile been added to the latest version of OLS, I downloaded it last night but couldn't see a specific device for the Arduino.

Thanks for any help.

Use the ground pin on the Arduino and it should work fine. That's how I've been testing it.

The device profile hasn't been added yet, you can use the one attached to my previous post. If enough people are using it, eventually we can get it added to distribution.

If you have any trouble getting it working, let me know.

Hi gillham,

Thanks for posting this, it looks like it is exactly what I was looking for to demonstrate simple Sequential logic, on a breadboard, without having to use a professional logic analyser. However I cant seem to get it to work :)

I Downloaded ols-0.9.4 and placed the ols.profile-agla.cfg into the plugins directory. I have \gillham-logic_analyzer-ff10c1e compiled and loaded on a MEGA256 and it responds to the debug commands 1 and 2. When I capture I can select the Device and the Port, the LEDs on the Arduino flash but OLS returns Capture Aborted! Device not found!. I have not disabled auto-reset, as this is not my board so I don't want to cut the trace :) Do I need the special build of OLS you mentioned? if so would you be willing to provide it as I don't have the capability to Build from source.

Thanks Chris

p.s. I didn't use the make file you provided with the pde file as I was not sure how to, have I compiled incorrectly by not using it?

Hi Chris,

I just did all this on Friday, I've compiled the latest OLS with the AGLA profile, here's a link if you want it :- http://www.mediafire.com/?84nfcq31to7p1bk

Karl

Thanks Karl,

You are a star, downloaded and installed ok, but is still get the Capture Aborted! Device not found! I will have to fish around for a 110ohm resistor and see if that works.

Cheers Chris

Well I Created a header with a 100 and 10 ohm in series to bridge 5v to reset, but it appears that the Mega is still resetting. any other Ideas?

GOT IT :)

Edit the plugins\ols.profile-agla.cfg File line42: device.open.portdelay = 1000

The default was 500ms Delay increasing to 1second (1000ms) works fine without the 110ohm resister.

I was going to post this morning to let you know about that setting, but you found it on your own. Good job! Glad to hear that helps on your Mega.

I have not tried my code on a Mega and the timing is hand tuned to the 16Mhz ATMega328 on the regular Arduino boards. I don't have a Mega to test it, but since it is running at the same clock rate it might be fairly close already.

Let me know how it goes for you and if you have something you can test with to see how accurate the timing is that would be useful. If you have another Arduino with a 16MHz crystal and ATMega328, I could get you a small signal generator sketch that you could use to measure with your Mega running AGLA.

If there is enough interest from other Mega users I can pick one up and test it out. Basically I just use some debugging to toggle an extra pin inside the capture routines and time those toggles with my Open Bench Logic Sniffer. It is accurate up to 100MHz so I can easily measure the Arduino pins. I highly recommend the Open Bench Logic Sniffer for anyone getting further into things than my AGLA can provide. Of course I think the AGLA is pretty nice for "free" on your existing Arduino, but obviously has some inherent limits.

Edit: Forgot to address your question about the Makefile. You did the right thing using the Arduino IDE and ignoring the Makefile. That is only for command line use if you want to skip the Arduino IDE. Especially useful with the 'arduino-core' package under Debian. I have compiled on my ARM based Sheeva plug computer for the Arduino using the Makefile so it can be handy.

Thanks gillham,

For the application on hand accurate timing was not needed, I just wanted to demonstrate the relative timing on a simple sequential logic experiment, but your code has captured my imagination and I would like to take it further. I switched it to using PORTC and adjusted the profile to an 8Bit sample. I saw your timing code, It occurred to me that it could be used as an external clock to run the circuit under test, but I haven't tried that yet. I would be interested to see your signal generator sketch, but unfortunately I only have the 2 Arduino Mega boards on hand.

I have a pic32 explorer and, hopefully, some chipKit MAX32's arriving this week so once the project that they were ordered for is completed, I may dedicate one to this application.

What I have in mind is an interface to a breadboard system, such as this http://www.radioshack.com/product/index.jsp?productId=3814337. A dual channel scope, 8 channel logic analyser, a frequency counter and a simple multimeter application running on a cheap board, possibly enclosed in the Learning Labs case, would make a great learning tool for kids of all ages. Bandwidth in the audio range for the scope and up to one Mhz for the digital portions would probably be within the capability of a high end chip.

Cheers, Chris

I ordered an Arduino Mega 2560 from SFE, should be here later this week. I’ll work on adding better support and get the timing tuned as needed.

I like your idea of combining oscilloscope (“The cheapest dual trace scope in the galaxy” style), logic analyzer, function generator etc into a workbench toolkit that is ready to go. It could be done just by adding a couple extra commands (similar to the debug options) or extend SUMP slightly

My current function generator code is rather simplistic and is set for my 8MHz Arduino Pro Mini. I use 1 button and 1 LED for the UI and it works ok. Timing is fairly accurate according to my OLS hardware, since it is using a hardware timer, but running on a 16MHz Arduino the values will be off by a factor of 2.

Anyway, I’ll attach my simple function generator for anyone interested. Make sure you use current limiting resistors as appropriate so you don’t damage anything. If you connect your target board, logic analyzer, signal generator etc, it is too easy to have pins in the wrong mode, (both output, one high, one low etc) and over current the pins on one or both devices. 1k Ohm for example on the appropriate pins will limit 5V to 5mA.

Rugged Circuits has a great page about what not to do. ( http://ruggedcircuits.com/html/ancp01.html )

function_generator.pde (6.66 KB)

Thanks gillham, I’ll give it a try.

Any Idea where I can get documentation on the SUMP protocol so I can try and integrate the analog read into the data?

Cheers
Chris