Linux Logic Analyser - sigrok

Submitted by sjs205 on Tue, 03/05/2013 - 02:42

I recently acquired an XZL_studio AX logic analyser from a friend, this is a clone of the USBee-AX device with a much lower price, ~£50. I had previously used this device with the USBee software but always found it to be buggy, infact, it was almost unusable. I tried to get this running on a virtual machine without joy, in the end, I had to install Windows XP on an old machine I had lying around, and even then, I found the software was constantly crashing. At the time I was looking for a Linux replacement, but found none, that is, until recently.

sigrok

After I acquired this device nothing was holding me back, I had to find a suitable piece of Linux software that would allow to use the logic analyser without having to virtual-boot a Windows partion, or even worse, a windows machine - something I don't even own anymore!. I soon found the sigrok project which provided exactly what I was looking for.

At present the sigrok support for my device is somewhat limited; based on my model, the analogue channels are currently not working, but everything else should be okay. Also, there doesn't seem to be a sound GUI application as yet, that said, I did have some success with PulseView, and with two more apps on the way, it shouldn't be too long before a stable GUI app is released. Until such a time, I will settle for the command line utility, sigrok-cli (man page). I am a Linux user after all.

picture of pulseview

sigrok-cli

So just some basics at this stage, I have been using sigrok-cli for all of a day, and it certainly seems much more stable that the propriety USBee software I was using on Windows. Some example commands are presented below

Capturing a trace

Okay, so let's start with a simple one, capture a single trace from a RS232 line converter IC, specifically, a MAX232 IC connected to my PC serial port. The following command captures data from a single probe connected to the TTL, R1OUT(12) pin of the MAX232. The command to start the capture is as follows, along with the output when we send a 'U' character to the serial port (We send a 'U' since this provides a nice symmetric 01010101 bit pattern).

--device samplerate=25k - Set the sample rate for the device to 25 KHz;

--samples 50 - Only capture 50 samples.

From the output above we can clearly see the changes that we would expect from sending the 'U' character. What we do notice is that there is a slight mismatch between sampling frequency and the bits actually changing, this is due to us not being able to perfectly match the sampling frequency with the bit rate of the serial port, 115200, in this case. We can get further details on the supported sampling frequencies for our device, along with some additional data using the '--show' flag as follows:

Output formats

As I already mentioned above, there are a number of limitations with the current GUI applications that can be installed with sigrok, however, we can still get "pretty" visual outputs when using sigrok-cli, see Output Formats for more info.

ASCII Output

The simplest method of getting a visual output is to use the 'ASCII' output format as follows:

While very basic, it still provides some visual output, however, it gets better still

pulseview

pulseview is a QT based GUI for sigrok. In these early stages of its lifecycle I did find a number of basic issues, specifically, 1)I found the GUI would often crash when obtaining a trace, and 2) one is not able to select a trigger when performing a capture. However, it is still perfectly usable for graphically viewing a trace when using sigrok-cli to perform the actual capture.

So, first things first, we need to grab a capture using sigrok-cli and output the trace to a file using the sigrok-cli default output format, '.sr' as follows - This '.sr' format it is a binary format. It can be reloaded into sigrok-cli as an input file at any time, allow one to change to a different output format.