A clone of the Saleae Logic 8-channel Analyser

I purchased a cheap clone of the Saleae Logic 8 port logic analyser (LA) from Banggood.com on Dec 16th 2014. This page reflects my initial experiments with using the device under Windows 7 and FreeBSD 9.1.

Top panel of Saleae Logic clone

Top panel of Saleae Logic clone

The clone does 8 channels of digital capture (no analog capture) and peaks at only 24MHz sample rate, but is otherwise compatible with version 1.1.30 of Saleae’s official firmware/GUI for their Saleae Logic analyser. Links to version 1.1.30 can be found here for 64 bit Linux32 bit LinuxOS X and Windows.

sigrok, an open-source UI and controller for a range of logic analysers, also appears capable of controlling this clone.

Experiments with Saleae’s official firmware/GUI

Installed Logic+Setup+1.1.30.exe on a Windows 7 laptop, fired up the new software and it recognised the LA painlessly.

Initial experiment with the LA involved reading output from a serial line. I had a cheap USB-Serial adaptor connected to my PCBSD 9.1 desktop (yes, PCBSD 9.1 — don’t ask).  The following line on my desktop generated a continuous stream of characters (repeated instances of “hello there”) out the serial port at 115200 baud, no parity:

yes "hello there" | cu -l /dev/cuaU0 -s 115200

Connected the LA’s CH0 to the TX (output) line of the USB-Serial adaptor, and similarly tied the GND lines of the LA and the Serial port together.

Using the Saleae Logic UI was very easy. Configured the LA to trigger on an edge, then configured “Async Serial” as the ‘analyser” with decoding to ASCII. The UI was pretty comfortable decoding the serial stream @ 500kHz sample rate. The UI placed each decoded ASCII character on the screen above the drawing of the hi-low transitions.

Nice!

The Saleae ‘Logic’ program’s GUI seems okay, although it did tend to crash when changing the triggering mode of CH0. It also seemed capable of handling tens of thousands of samples (I tried up to 7 seconds @ 0.5MHz).

Experiments using sigrok

There’s a FreeBSD Port under science/sigrok-cli that provides CLI access to a wide range of logic analysers. My clone requires custom firmware provided by the science/sigrok-firmware-fx2lafw Port.

Summary: Was able to decode serial traffic from a generic USB-Serial adaptor @ 115200 and 9600 baud, using sigrok’s built-in ‘uart’ protocol decoder and 500kHz or 40kHz sample rates respectively.

Sigrok and related resources

See http://www.jwandrews.co.uk/2011/12/saleae-logic-analyser-clone-teardown-and-reprogramming/ for some background on the re-programmable device inside this a similar clone unit. I have not (yet) confirmed that my unit is similar.

See http://www.hermann-uwe.de/blog/sigrok–cross-platform-open-source-logic-analyzer-software-with-protocol-decoder-support for information on ‘sigrok’, the open source LA software.

See http://www.sigrok.org/blog/ for lots of recent info and other uses for sigrok and supported LAs.

Create sigrok PBI for my desktop and grab fx2lafw firmware

Built sigrok-cli v0.5 as a PCBSD PBI using EasyPBI under PCBSD 9.1, then installed the resulting sigrok-cli-0.5.0-amd64.pbi on my desktop. (http://www.sigrok.org/blog/new-major-release-various-sigrok-components suggests that sigrok-0.5 is the most current main release as of May 2014.)

My PBI was fairly rudimentary, so it didn’t put the man pages in the right place. Reading the man page required:

man -M /usr/pbi/sigrok-cli-amd64/man sigrok-cli

The science/sigrok-firmware-fx2lafw Port provides a way to build community firmware for “…all Cypress FX2 based logic analyzers…”, including “..Saleae Logic,…” (http://sigrok.org/wiki/Fx2lafw). Rather than build the firmware myself, I grabbed a pre-built sigrok-firmware-fx2lafw-bin-0.1.2.tar.gz from http://sigrok.org/download/binary/sigrok-firmware-fx2lafw.

Plug LA into PCBSD 9.1 desktop:

When plugged in, the console reports:

Jan 2 20:22:52 gjadesktop kernel: ugen4.2: <vendor 0x0925> at usbus4
Jan 2 20:22:52 gjadesktop root: Unknown USB device: vendor 0x0925 product 0x3881 bus uhub4

Without its firmware (which is uploaded by sigrok-cli or similar tool) the device is a simple USB entity that (dubiously) has the USB Vendor ID of a Saleae device.

[gja@gjadesktop] ~% usbconfig -d 4.2
ugen4.2: <product 0x3881 vendor 0x0925> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
[gja@gjadesktop] ~%

Initial tests with sigrok-cli and fx2lafw-saleae-logic.fw firmware

Run a general scan with sigrok-cli

[gja@gjadesktop] /usr/pbi/sigrok-cli-amd64% sigrok-cli --scan
sr: ezusb: Unable to open firmware file /usr/pbi/sigrok-cli-amd64/share/sigrok-firmware/fx2lafw-saleae-logic.fw for reading: No such file or directory
sr: fx2lafw: Firmware upload failed for device 0.
The following devices were found:
demo - Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3
fx2lafw - Saleae Logic with 8 channels: 0 1 2 3 4 5 6 7
[gja@gjadesktop] /usr/pbi/sigrok-cli-amd64%

Not surprisingly, in the absence of the actual firmware binary, sigrok-cli is not able to program the device for its intended use.

Extracted fx2lafw-saleae-logic.fw from ./sigrok/sigrok-firmware-fx2lafw-bin-0.1.2.tar.gz
and copy it to /usr/pbi/sigrok-cli-amd64/share/sigrok-firmware/, then retried the scan:

[gja@gjadesktop] /usr/pbi/sigrok-cli-amd64/share/sigrok-firmware% sigrok-cli --scan
The following devices were found:
demo - Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3
fx2lafw - Saleae Logic with 8 channels: 0 1 2 3 4 5 6 7
[gja@gjadesktop] /usr/pbi/sigrok-cli-amd64/share/sigrok-firmware%

Okay, looks promising. Repeated scans now return the USB port information along with the device name:

[gja@gjadesktop] /usr/pbi/sigrok-cli-amd64/share/sigrok-firmware% sigrok-cli --scan
The following devices were found:
demo - Demo device with 12 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3
fx2lafw:conn=4.2 - Saleae Logic with 8 channels: 0 1 2 3 4 5 6 7
[gja@gjadesktop] /usr/pbi/sigrok-cli-amd64/share/sigrok-firmware%

The “:conn=4.2” appended to device name relates to the USB port as reported by usbconfig. usbconfig itself now shows the device self-reporting as “<fx2lafw sigrok>” (rather than the non-descript “<product 0x3881 vendor 0x0925>” reported when first plugged in).

[gja@gjadesktop] ~% usbconfig
[..]
ugen4.2: <fx2lafw sigrok> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
[gja@gjadesktop] ~%
[gja@gjadesktop] ~% usbconfig -d 4.2 dump_device_desc
ugen4.2: <fx2lafw sigrok> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0200
bDeviceClass = 0x00ff
bDeviceSubClass = 0x00ff
bDeviceProtocol = 0x00ff
bMaxPacketSize0 = 0x0040
idVendor = 0x0925
idProduct = 0x3881
bcdDevice = 0x0001
iManufacturer = 0x0001 <sigrok>
iProduct = 0x0002 <fx2lafw>
iSerialNumber = 0x0000 <no string>
bNumConfigurations = 0x0001
[gja@gjadesktop] ~%

More about the attached device:

[gja@gjadesktop] ~% sigrok-cli --driver fx2lafw --show
fx2lafw:conn=4.2 - Saleae Logic with 8 channels: 0 1 2 3 4 5 6 7
Supported driver options:
conn
Supported configuration options:
Supported triggers: 0 1
samplerate - supported samplerates:
20 kHz
25 kHz
50 kHz
100 kHz
200 kHz
250 kHz
500 kHz
1 MHz
2 MHz
3 MHz
4 MHz
6 MHz
8 MHz
12 MHz
16 MHz
24 MHz
[gja@gjadesktop] ~%

Capturing and decoding serial data

Simple serial data @ 115200 baud

As above, used a USB-serial adaptor on my PCBSD 9.1 desktop with the LA’s CH0 attached to the serial adaptor’s TX line. Used the following line to generate serial line output when I mash the desktop’s keyboard:

cu -l /dev/cuaU0 -s 115200

Used sigrok-cli as follows to capture the signal from CH0:

[gja@gjadesktop] ~% sigrok-cli --driver fx2lafw --config samplerate=1M --samples=200 -t 0=0 -C 0
libsigrok 0.3.0
Acquisition with 1/8 channels at 1 MHz
0:00000000 01111111 10000000 00111111 11111111 11110000 00000000 00000000
T:^ 0
0:00000000 00000011 11111111 11111111 11111111 11111111 11111111 11111111
0:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
0:11111111
[gja@gjadesktop] ~%

The example above means:

  • 1M samples/sec (–config samplerate=1M)
  • Use/capture only channel 0 (-C 0)
  • Take 200 samples (–samples=200) from the trigger point when CH0=0 (-t 0=0)

You can specify a sequence of samples that make up a trigger. For example, to
trigger on “01” use:

[gja@gjadesktop] ~% sigrok-cli --driver fx2lafw --config samplerate=1M --samples=200 -t 0=01 -C 0
libsigrok 0.3.0
Acquisition with 1/8 channels at 1 MHz
0:11111111 10000000 00111111 11111111 11100000 00000000 00000000 00000000
T:^ 0
0:00000011 11111111 11111111 11111111 11111111 11111111 11111111 11111111
0:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
0:11111111
[gja@gjadesktop] ~%

The sequence captured above is the same character sent over the serial line as before, but the capture begins at the first “1” of the first “01” (which occurs 8 samples later relative to the previous example where we simply triggered on the first “0”).

Decoding “hello there” at 115200 baud serial

To test sigrok-cli’s ability to decode serial streams I used the following to generate a constant stream of “hello there” text at 115200 baud, no parity:

yes "hello there" | cu -l /dev/cuaU0 -s 115200

To decode the serial traffic, I used the following parameters to sigrok-cli:

--protocol-decoders uart:baudrate=115200:parity_type=none -A uart=rx-data

This translates to: Decode the samples on CH0 as a received serial line bitstream @ 115200 baud, with no parity, and output just the reassembled bytes (as ascii by default)

As shown below, when run at a sample rate of 500k samples/second, sigrok-cli successfully decoded a brief fragment of the serial line’s output (after a few garbled decoded bytes):

[gja@gjadesktop] ~% sigrok-cli --driver fx2lafw --config samplerate=500k --samples=4K -C 0 --protocol-decoders uart:baudrate=115200:parity_type=none -A uart=rx-data|more
Y
[8B]
[EB]
[0B]
[A2]
[A1]
[95]
[C9]
[95]
)
h
e
l
l
o

t
h
e
r
e
[0A]
h
e
l
l
o

t
h
e
r
e
[0A]
[...and so on...]

I also tried with samplerate=400k (got some characters correct each time) and
samplerate=300k (most characters garbled).

Decoding “hello there” at 9600 baud serial

I then used the following to generate a constant stream of “hello there” text at 9600 baud, no parity:

yes "hello there" | cu -l /dev/cuaU0 -s 9600

I had trouble getting much decoded at relatively high sample rates, as the LA (or sigrok) wouldn’t buffer up enough samples to do a useful decode.

I had good success after dropping the sample rate to 40Khz:

[gja@gjadesktop] ~% sigrok-cli --driver fx2lafw --config samplerate=40k --samples=4K --protocol-decoders uart:baudrate=9600:parity_type=none:rx=0 -A uart=rx-data | more
[B1]
[B1]
[BD]
[81]
t
h
e
r
e
[0A]
h
e
l
l
o

t
h
e
r
e
[0A]
[...and so on...]
[gja@gjadesktop] ~%

Any samplerate lower than 40kHz and the protocol decoding became erratic.

Notes on samples

http://sigrok.org/wiki/Saleae_Logic/Info#Getting_samples suggest there may be a limit of 4096 samples per USB request to the LA, and that further storage is (by implication)  provided by the external UI (in this case sigrok-cli). I certainly found in my preceding experiments that sigrok-cli would simply hang waiting for more samples if I set N to be higher than a few thousand. By contrast, the official Saleae Logic GUI was quite happy to capture orders of magnitude more samples, presumably concatenating the short bursts of samples coming in from the LA itself.

Advertisements

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

%d bloggers like this: