Thursday, May 2, 2013

Open Bench Logic Sniffer with OS X

While trying to debug a High Voltage Parallel Programming experiment and trying to get an idea of the state of the 15 or so signals involved, I decided I had outgrown the ability of my Bus Pirate (which works quite nicely as a logic analyzer, but is limited to 5 channels, 4096 samples at 1MHz, and very simple triggers).

I decided on an Open Bench Logic Sniffer, made by the same people as the Bus Pirate, and working with the same logic analyzer clients. Logic Sniffer allows sampling rates up to 200MHz, and 24K samples with 8 channels, 12K samples with 16 channels, or 6K samples with 32 channels, and much more sophisticated triggers. As my OS X client, I used Logic Sniffer Java client, which by now has pretty much supplanted the original SUMP client for which the Logic Sniffer was designed.

Initial experiments were not entirely satisfactory. It seemed that 8 channel mode mostly worked, but 16 channel mode tended to work only at the 200MHz sample rate, which was too fast for my purpose and only gave me brief snippets of the transactions I wanted to examine (at least, thanks to the advanced triggers, picking those snippets was feasible).

I decided to look for a firmware update, and at this point, the seamy underbelly of the Logic Sniffer ecosystem came into plain view:

  • There is a confusing tangle of web pages purporting to have Logic Sniffer documentation, pointing to obsolete versions of each other, with some of the links just broken.
  • The pertinent information on the web forum discussing Logic Sniffer is distributed across several threads, and it’s not always evident which information is authoritative.
  • Some key tools for upgrading are Windows specific, making life for OS X users a bit harder.
  • The Logic Sniffer authors were not always entirely aware of what the actual manufacturers did with the devices (My brand new Logic Sniffer from Seeed Studio shipped with firmware that was more than 2 years out of date!).
As a result, my upgrade took a rather circuitous route, and at one point had me believe I had bricked my logic sniffer (turns out I had just uploaded firmware into the wrong flash memory region). For future generations, here’s what I now believe are best practices:

  • The most useful starting page for Logic Sniffer is at Dangerous Prototypes (while the Gadget Factory page linked is so outdated that even the “updated” link it contains leads to a mostly broken page).
  • The discussion forum is part of the Dangerous Prototypes Forum.
  • The latest firmware, however, is still hosted at Gadget Factory (Don’t be discouraged by the “Mac OS X coming soon” links—see below).
To actually upgrade the firmware from an OS X machine (most other platforms are quite a bit simpler), I got the following procedure to work:

  • Get the ols-fwloader source from github and compile it (you’ll need to install autoconf through Fink or MacPorts). Most likely, you won’t need to install the resulting tool, but if you do, pick a suitable --prefix:
  • Get the Diolan dummy kext from the discussion forums and install it. You may see some scary looking warnings, but everything’s perfectly safe.
  • Get the “Linux Expert” package from the Gadget Factory download page (latest release right now is 3.08). Change into the OLS_Upgrader directory.
  • Put your logic sniffer into “ROM update mode” by holding the “update” button on the board and then pressing the “reset” button while the “update” button is held. If successful, both green LEDs (ACT and PWR) above the USB connector should be lit.
  • Determine the serial port of your Logic Sniffer, which will be of the form /dev/tty.usb*. Use that port in the code below.
  • Upgrade the FPGA bitstream, and then the Logic Sniffer firmware:
  • Now unplug and re-plug the logic sniffer. Everything should be working.
With the latest firmware, everything seems to work great. The hardware is capable of much more than the software currently supports, but even so, it’s a fairly nice instrument: