Yes, your Arduino Uno can be turned into a logic analyzer.
Andrew Gillham has created a sketch that turns the UNO into a 6 channel SUMP compatible analyzer.
The maximum sample speed is 4 MHz. You can get 256 µS worth of samples for that frequency. At 500 kHz you can sample 2 ms.
At the lowest rate of 10 kHz you can sample 102 seconds worth of signal.
The picture below shows a 25 kHz signal sampled at 1 MHz.
Although you can get up to 4 MHz captures, using it at that frequency is a bit of a stretch. The trigger logic isn't up to the mark at that speed. The lag between the trigger detection and the sample start is too big.
But at 1MHz and below it works just fine.
As client, I use the Logic Sniffer from jawi (OLS). I've tested it on Windows 8.x and on Ubuntu 12. It works fine in both configurations.
The above capture is showing the signals of the Arduino ShiftOut example, where the values of 'DS In' are shifted into a register by the clock on line 2, and the output on Q0 -> Q2 can be seen after the latch up at line 3.
In the image above, I'm shifting in the values 1, 2 and 3 - each of them followed by a latch.
The Logic Sniffer has a set of protocol decoders, e.g I2C, UART and SPI.
Channel 5 is on the same pin as the LED13. You have to be careful if you want to use it as an input channel for the logic analyzer.
The signal that you connect to that pin will be loaded by the led and its series resistor. It's best to use it on a not-so-sentive signal.
If you want to disable that channel, follow the instructions in the sketch and disable a line of code:
/* Comment out CHAN5 if you don't want to use the LED pin for an input */ #define CHAN5 13
I've tested the sketch with a UNO and a Duemilanove. I have worked with someone who got it to work on a Mega (where it has more capabilities).
I couldn't get it to work on my Yún. The sketch compiles and runs on the Yún, but the connection between the Arduino ond the Logic Sniffer software hangs halfway sampling.
In the next part, I'm using a Papilio FPGA development board (with Xilinx Spartan 6) as analyzer. We'll jump up to 32 channels and loads of MHz there.
|Make a Logic Analyzer from your Dev Kit Part 1: Arduino UNO|
|Make a Logic Analyzer from your Dev Kit Part 2: Papilio FPGA|
|Make a Logic Analyzer from your Dev Kit Part 3: Level Translator and Buffer|