Logic analyzer mode

From DP

Jump to: navigation , search

sump-dataii

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 SUMP-compatible open source logic analyzer clients. The logic analyzer can record 4096 samples at up to 1MHz, each channel has a selectable sample trigger.

Contents

Limitations

***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).

Features

  • 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-compatible open source logic analyzer client, we now recommend Jawi's OLS client that contains extended support for the Bus Pirate (v0.9.4+)
  • Bus Pirate firmware v3.0 or later. Update to the latest Bus Pirate firmware using your normal USB firmware update method

Using the logic analyzer

These instructions are for Jawi's OLS client v0.9.4+

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 after the capture is complete.

Bp-sump-config.png


Start SUMP and press the capture button (or Device->capture from the menu) to configure an acquisition.

Jawi's latest OLS client has a profile for the Bus Pirate so setup is a snap. In the Connection Settings tab:

  1. Change the serial port to match the normal Bus Pirate serial port on your system
  2. Set the speed to 115200bps or higher
  3. Choose the Bus Pirate device type

Bp-sump-acquire-ii.png

Client v0.9.4+ limits the Acquisition tab settings to those supported by the Bus Pirate:

  1. We can capture a maximum of 4K samples (actually 4096), but the Bus Pirate will send fewer depending on the recording size setting
  2. Speed settings 10Hz to 1MHz are valid. Higher speeds default to about 1MHz
  3. Only the first channel group is selected
  4. Click capture to start. The MODE LED lights to indicate that the analyzer is active


Bp-sump-trigger.png

Sampling can also be triggered by a change on one or more pins. Setup is done in the trigger tab of the Capture Settings window:

  1. Enable triggers by checking the Trigger Enabled box
  2. Check the mask bits (bits4-0) to set a trigger on one or more pins
  3. Value bits are currently ignored, any change triggers the capture
  4. 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 above.

RC5toggle-bitii

Samples are sent to SUMP and displayed.

Connection and timeout problems

Many connection and timeout problems can be fixed by changing the read timeout in the FTDI driver. SUMP is a little temperamental and thinks latency from the USB->serial driver is an error.

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) fixes problems on many systems. Another fix 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)…


Bus-Pirate-SUMP-fix.png

Improving the logic analyzer

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

Old SUMP client instructions

We recommend the newer client above
These are instructions for a much older version of the client

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.