Categories

Bus Pirate logic analyzer mode

Posted on Tuesday, November 3rd, 2009 in Bus Pirate, logic analyzer by Ian

sump-dataii

See the latest version on the documentation wiki.

This is an updated guide to the Bus Pirate logic analyzer mode, it expands on the initial documentation posted earlier.

Bus Pirate firmware v3.0 introduced a logic analyzer mode that works with the SUMP open source logic analyzer client. The logic analyzer can record 4096 samples at up to 1MHz, each channel has a selectable sample trigger.

***BIG WARNING*** The Bus Pirate will never be a substitute for a ‘proper’ logic analyzer, the hardware isn’t designed for it. The Bus Pirate can’t store a lot of samples, it can’t feed live samples very fast, and speeds are in the kHz range, not MHz.

Despite the limitations of the Bus Pirate hardware, the logic analyzer worked well enough to examine decoded IR remote signals. It’s also well suited to debug environments where you can control the bus speed (and the Bus Pirate may already be connected for other reasons). It should also be able to look at most I2C traffic (400kHz clock).

Documentation below. There’s still time to get a Bus Pirate v3, $30 including worldwide shipping.

Logic analyzer specs

  • 4096 samples (4K)
  • 10Hz to ~1MHz low-speed sample rate
  • Selectable sampling trigger on each pin
  • SUMP compatible

The five major IO pins are included in analyzer output:

  • chan0 – CS
  • chan1 – MISO
  • chan2 – CLK
  • chan3 – MOSI
  • chan4 – AUX

SUMP follows a simple protocol. We’ve only implemented the minimum command set: reset, run, ID, speed (divider), samples, and trigger. Other commands are received, but the contents are ignored. Trigger direction, pre-sampling, and other advanced features could be handled with an update.

What you’ll need

  • SUMP open source logic analyzer client
  • Bus Pirate firmware v3.0 or later

Update to the latest Bus Pirate firmware using your normal Windows or Python (MAC OSX/Linux) update method.

Install Java, the rxtx serial port library, and the SUMP client.  Jack Gassett at the Gadget Factory has a version compiled from the latest source code. He also has a Windows compile of SUMP for his ButterFly Platform that doesn’t require you to install Java. SUMP has a SourceForge page, but it’s not very active.

Using the logic analyzer

The Bus Pirate understands the SUMP initialization commands, no special configuration is required to put the Bus Pirate into logic analyzer mode. It will also return to user terminal mode automatically.

SUMP-config

Open SUMP. Press the rocket button. Configure SUMP as shown here.

  1. Change the serial port to match the normal Bus Pirate serial port on your system.
  2. Uncheck channel groups 2, 3, and 4.
  3. We can capture a maximum of 4K samples (actually 4096), but the Bus Pirate will send fewer depending on the recording size setting.
  4. Speed settings 10Hz to 1MHz are valid. Higher speeds default to about 1MHz.
  5. Click capture to start. The MODE LED lights to indicate that the analyzer is active.

SUMPtrigger

Sampling can also be triggered by a change on one or more pins.

  1. Enable the trigger by checking the enable box.
  2. Check the mask bits (bits4-0) to set a trigger on one or more pins.
  3. Click capture. The MODE LED lights to indicate that the analyzer is active. A change on any of the selected pins triggers sampling.

Note that sampling is triggered by a change on any of the selected pins. There’s currently no direction configuration. Channel triggers are set with mask bits 4-0, ordered according to the channel table.

RC5toggle-bitii

Samples are sent to SUMP and displayed.

Improving the logic analyzer

The logic analyzer could be upgraded with a rolling sample buffer that can show activity prior to the trigger.

This entry was posted on Tuesday, November 3rd, 2009 at 2:31 pm and is filed under Bus Pirate, logic analyzer. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

10 Responses to “Bus Pirate logic analyzer mode”

  1. Ian says:

    Had some error reports. I used portmon to look at the traffic, and after a few bytes sometimes there’s a read timeout. SUMP takes that to be an error, but really it’s latency from the USB->serial driver.

    Changing the minimum read timeout (msec) in the FTDI driver setting to at least 4000 (device manager->ports->COMx properties->port settings->advanced in Windows) cleared any remaining problems on my system. Another way is to decrease the latency timer, but that hurts performance a lot.

    Ideally, SUMP would have a simple text .ini file with settings for things like read timeout (one byte, really?), device types, and clock divider, so this stuff is easier to address. But that’s not how it’s built (yet)…

  2. Ian says:

    Has anyone tried this yet?

    • James says:

      I had been having trouble getting this mode to work as well.

      Ian’s suggestion does the trick all right. Seems to work now.
      I tried setting it to a couple of different values. 2000 didn’t work for me but 3000 did.

  3. Rob T. says:

    As a first experiment, I’m trying to do some simple consumer IR decoding as mentioned in this article. My first question is how can I enable power (+5V) from the bus pirate to power the IR detector? I tried going into terminal mode, setting up raw 2 wire mode so I can enable the volt reg. output. However after that it won’t go into sump logic analyzer mode.

    Thanks.

  4. Rob T. says:

    I was afraid of that. It sure would be nice if that were possible.

    I was able to get 3.3V off the ICSP header, which was sufficient to drive my IR detector (PNA-4602).

    As far as I can tell there isn’t a good place to get 5V off the (v3) board.

    Thanks,
    –Rob

  5. Mike says:

    Sump works with BP 4.2 here.
    I am impessed!

    I am wondering about on the triggering?

    The instructions say to use “Mask” bit. Does masking a certain bit enable triggering on that bit or disable triggering on that particular bit.

    Masking usually means to ignor a bit or make it zero.

    I look forward to “rising or falling edger triggering” on a future BP firmware version.

    Since Sump is going to be our interface with the Sniffer (I am on order) will it have support and a manual or help instructions.

    It seems to work but I wonder if the writter will have time to keep it up to Sniffing with the Seeed Hardware?

    I still like the name someone suggested ” Buss Nija”!

    Thanks for great projects!
    Mike

  6. Mike says:

    I love using Sump with the Bus Pirate.
    Sometimes I get an error, the BP not seeing the com port?
    I will have to use it more to see if I can fix that.

    I have it looking at a Pic counting with 1ms delays.

    Get 5 channels Logic analyzer.

    I made a cheat sheet with the Pins, cable wire color, and EZ hook Color.

    You can’t beat the price on Seeeds connector. Probably fragile, I bought 2.

    I had to send my Logic Sniffer back! Sad…
    Messed with it for 2 days, would not trigger correctly as far as I could see.

    Mike

  7. Roman says:

    Just wanted to say thanks for a great tool. Can’t beat the price to be able to throw it on something to take a quick look. Also small enough to carry around in laptop case with you.

  8. Sven says:

    Hi,

    i having trouble to detect something right via I2C Protocol analysis.

    I’m sending “X” from one Arduino to another. And the sparkfun bus pirate is also on the bus.

    What i get is this (also to mention that the channel records between -1ms and 0ms ?!?)

    0
    0.0ns
    START

    1
    0.0ns
    0x96
    0b10010110
    150
    –
    2
    0.0ns
    ACK

    3
    0.0ns
    BUS-ERROR

    So DEC 150 is not X
    BUT:
    150 in BIN is
    10010110
    and X (Ascii 88) is
    01011000

    Could be i time problem Ian mentioned years ago…
    Will try this. But has anyone another idea?

    Thanks

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • KH: A power-off current draw of 4mA for the Sony A6000 is a defect, product recall territory. It hits the camera battery with unacceptable wear and...
  • Olav Storstrøm: Please add 9-pin D-sub RJ45 and RJ12 connectors! Thanks!
  • KH: Hydroponics is like home automation. Every year you have folks who start projects like these and think it will take off and become a big...
  • KH: Read the linked article. The A6000 has an unusually high standby/sleep current. The adapter's quiescent current is not an issue, but the A6000 sleep current...
  • Drone: Jeez, the very limited DCA: 40A/400A±3.0% capability, no RMS at all, and the CAT=DEATH rating makes this a NO BUY at any price - much...