The logic command configures the logic analyzer core, and can display logic capture graphs directly in the terminal. It supports the “follow along” logic analyzer mode that triggers each time you send data to a bus. It eliminates the need setup triggers and arm a second tool for debugging.

The Bus Pirate can be used as a logic analyzer in multiple ways. This page documents the logic command in the terminal.

Capabilities

  • 62.5MSPS (or more if overclocked)
  • 131K samples
  • 8 channels
  • Trigger: single pin, high or low
  • Follow along logic analyzer mode
  • Base pin can be set to an internal pin for debugging the Bus Pirate itself

Latest Features and Help

Bus Pirate [/dev/ttyS0]
SPI> logic -? h
usage:
logic analyzer usage
logic	[start|stop|hide|show|nav]
	[-i] [-g] [-o oversample] [-f frequency] [-d debug]
start logic analyzer: logic start
stop logic analyzer: logic stop
hide logic analyzer: logic hide
show logic analyzer: logic show
navigate logic analyzer: logic nav
configure logic analyzer: logic -i -o 8 -f 1000000 -d 0
undocumented: set base pin (0=bufdir, 8=bufio, 20=follow along) -b: logic -b 20

logic analyzer control
start	start logic analyzer
stop	stop logic analyzer
hide	hide logic graph
show	show logic graph
nav	navigate logic graph with arrow keys, x to exit
-i	show configuration info
-o	set oversample rate, multiplies the sample frequency
-f	set sample frequency in Hz
-0	set character used for low in graph (ex:_)
-1	set character used for high in graph (ex:*)
-d	set debug level: 0-2
-h	Get additional help

SPI> 

logic -h will display the help menu with the latest options for the logic command.

Start Logic Analyzer

logic start configures the logic analyzer core for follow along mode and draws a blank logic graph. Use logic stop to stop the logic analyzer and release any resources used.

Show/Hide Logic Graph

If the graph isn’t needed, use logic hide to release it from the toolbar. Use logic show to draw the graph again showing the current capture buffer.

Auto Capture Speed

Bus Pirate [/dev/ttyS0]
Actual speed: 10kHz
Logic analyzer speed: 80000Hz (8x oversampling)
Use the 'logic' command to change capture settings

Mode: SPI
SPI> 

When changing protocol modes with the m command, FALA will automatically set the capture speed to oversample the bus speed by a factor of 8.

Change Capture Speed

Bus Pirate [/dev/ttyS0]
SPI> logic -o 16
Oversample rate set to: 16

Logic Analyzer settings
 Oversample rate: 16
 Sample frequency: 10000Hz

Note: oversample rate is not 1
Actual sample frequency: 160000Hz (16 * 10000Hz)

SPI> 

The base capture speed or the oversample rate can can be changed with the logic command. Changing the oversample rate with the -o flag is probably easiest as the Bus Pirate will calculate the new sample frequency for you.

Capture Samples

Bus Pirate [/dev/ttyS0]
SPI> [ 0xaa 0x55]

CS Enabled
TX: 0xAA 0x55 
CS Disabled

Logic analyzer: 144 samples captured
SPI> 

Every time you send data to the bus, the logic analyzer will capture samples and the logic graph will update (if visible).

If there are too many samples to display at once, use logic nav to navigate the graph. The arrow keys will move the graph left and right, and x will exit the navigation mode.

Logic Analyzer System