Ir al contenido

Saleae Logic Cheat Sheet

Overview

Saleae Logic analyzers are USB-based digital and mixed-signal logic analyzers widely used for debugging embedded systems, reverse engineering hardware, and analyzing communication protocols. The Logic 2 software provides an intuitive interface for capturing, viewing, and decoding digital and analog signals with built-in protocol analyzers for SPI, I2C, UART, CAN, 1-Wire, and many more. Saleae devices range from the 8-channel Logic 8 to the 16-channel Logic Pro 16, supporting digital sample rates up to 500 MS/s and analog sampling up to 50 MS/s.

Saleae Logic analyzers are known for their ease of use, high signal integrity, and extensive protocol decoder library. The Logic 2 software supports cross-platform operation (Windows, macOS, Linux), offers a powerful automation API for scripting and CI/CD integration, and provides extensions and high-level analyzers (HLAs) written in Python for custom protocol decoding. The analyzers connect via USB 3.0 and feature voltage-tolerant inputs that handle signals from 1.2V to 5.5V, making them suitable for debugging everything from low-voltage FPGA I/O to legacy 5V TTL circuits.

Installation

Logic 2 Software

# Linux - Download AppImage
wget https://logic2api.saleae.com/download?os=linux64 -O Logic-2-latest-linux-x64.AppImage
chmod +x Logic-2-latest-linux-x64.AppImage
./Logic-2-latest-linux-x64.AppImage

# Or install via package
# Download .deb from https://www.saleae.com/downloads/
sudo dpkg -i Logic-2*.deb

# macOS
# Download .dmg from https://www.saleae.com/downloads/
# Or via Homebrew
brew install --cask saleae-logic-2

# Windows
# Download installer from https://www.saleae.com/downloads/

USB Permissions (Linux)

# Add udev rules for Saleae devices
cat << 'EOF' | sudo tee /etc/udev/rules.d/99-saleae-logic.rules
# Saleae Logic Analyzers
SUBSYSTEM=="usb", ATTR{idVendor}=="21a9", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="0925", MODE="0666"
EOF

sudo udevadm control --reload-rules
sudo udevadm trigger

Python Automation API

# Install Saleae automation package
pip install saleae

# Alternative: Logic 2 Automation API
pip install logic2-automation

Hardware Models

ModelDigital ChAnalog ChMax DigitalMax AnalogBandwidth
Logic 888100 MS/s10 MS/s5 MHz
Logic Pro 888500 MS/s50 MS/s25 MHz
Logic Pro 161616500 MS/s50 MS/s25 MHz

Input Specifications

SpecificationValue
Voltage range-0.5V to 5.25V
Input impedance1 MOhm / 8 pF
Threshold voltageConfigurable per channel
Common thresholds1.2V, 1.8V, 3.3V, 5.0V

Basic Capture

Logic 2 GUI Workflow

1. Connect Logic analyzer via USB 3.0
2. Open Logic 2 software
3. Configure channels:
   - Click channel label to rename
   - Set voltage threshold per channel
   - Enable/disable channels
4. Set sample rate and duration
5. Click "Start" to capture
6. Add protocol analyzers for decoding

Capture Settings

SettingDescription
Sample RateSamples per second (higher = more detail)
DurationCapture time length
TriggerStart condition for capture
Buffer ModeTimer (fixed), trigger, looping
Voltage ThresholdLogic high/low threshold per channel

Trigger Configuration

Trigger types:
- Rising Edge    ↑  (low to high)
- Falling Edge   ↓  (high to low)
- High Pulse     ⎍  (specific width)
- Low Pulse      ⎽  (specific width)
- Pattern        Multiple channels matching state

Trigger settings in GUI:
1. Click trigger button on channel
2. Select trigger type
3. Set pre/post-trigger buffer

Protocol Analyzers

Built-in Analyzers

AnalyzerRequired ChannelsKey Settings
Async SerialTX and/or RXBaud rate, data bits
SPICLK, MOSI, MISO, EnableCPOL, CPHA, bit order
I2CSCL, SDAAddress display
CANCAN_H or CAN_LBaud rate
1-WireOWROverdrive mode
I2S / PCMSCK, WS, SDWord size, alignment
JTAGTCK, TMS, TDI, TDO-
SWDSWCLK, SWDIO-
USB LS/FSD+, D-Speed
HDLCData-
HDMI CECCEC line-
ManchesterDataBaud rate
ModbusTX/RX (via Serial)Baud, mode
SMBusSCL, SDA-
MDIOMDC, MDIO-
LINLIN busBaud rate

Adding an Analyzer

In Logic 2:
1. Click "+" next to "Analyzers" panel
2. Select protocol (e.g., "Async Serial")
3. Map channels:
   - Input Channel: D0
   - Bit Rate: 115200
   - Bits per Frame: 8
   - Stop Bits: 1
   - Parity: None
   - Bit Order: LSB First
4. Click "Save"

Analyzer Settings Examples

UART/Serial

Analyzer: Async Serial
- Input Channel: D0 (TX), D1 (RX)
- Bit Rate: 115200 (or 9600, 57600, etc.)
- Bits per Frame: 8
- Stop Bits: 1
- Parity Bit: No Parity
- Significant Bit: Least Significant Bit First
- Signal Inversion: Non-Inverted

SPI

Analyzer: SPI
- MOSI: D0
- MISO: D1
- Clock: D2
- Enable: D3
- Significant Bit: Most Significant Bit First
- Bits per Transfer: 8
- Clock State: Clock is Low when inactive (CPOL=0)
- Clock Phase: Data is Valid on Clock Leading Edge (CPHA=0)
- Enable Line: Enable line is Active Low

I2C

Analyzer: I2C
- SDA: D0
- SCL: D1

Automation API

Python Capture Script

from saleae import automation
import os

# Connect to Logic 2 (must be running)
manager = automation.Manager.connect(port=10430)

# Configure device
device_config = automation.LogicDeviceConfiguration(
    enabled_digital_channels=[0, 1, 2, 3],
    digital_sample_rate=24_000_000,
    digital_threshold_volts=3.3,
)

# Configure capture
capture_config = automation.CaptureConfiguration(
    capture_mode=automation.TimedCaptureMode(duration_seconds=5.0)
)

# Start capture
with manager.start_capture(
    device_configuration=device_config,
    capture_configuration=capture_config,
) as capture:

    # Wait for capture to complete
    capture.wait()

    # Add SPI analyzer
    spi_analyzer = capture.add_analyzer(
        'SPI',
        label='SPI Bus',
        settings={
            'MISO': 0,
            'Clock': 1,
            'MOSI': 2,
            'Enable': 3,
            'Bits per Transfer': '8 Bits per Transfer',
        }
    )

    # Export raw data
    capture.export_raw_data_csv(
        directory=os.getcwd(),
        digital_channels=[0, 1, 2, 3],
    )

    # Export analyzer results
    capture.export_data_table(
        filepath='spi_data.csv',
        analyzers=[spi_analyzer],
    )

    # Save capture
    capture.save_capture(filepath='capture.sal')

Trigger-Based Capture

from saleae import automation

manager = automation.Manager.connect()

# Digital trigger
trigger_config = automation.CaptureConfiguration(
    capture_mode=automation.TimedCaptureMode(
        duration_seconds=2.0,
        trim_data_seconds=0.5,  # Pre-trigger buffer
    ),
    trigger=automation.DigitalTrigger(
        channel_index=0,
        type=automation.DigitalTriggerType.RISING,
        linked_channels=[
            automation.DigitalTriggerLinkedChannel(
                channel_index=1,
                type=automation.DigitalTriggerLinkedChannelState.HIGH
            )
        ]
    )
)

High-Level Analyzers (HLA)

Creating Custom HLA

# my_protocol_hla.py
from saleae.analyzers import HighLevelAnalyzer, AnalyzerFrame, StringSetting, NumberSetting

class MyProtocolHLA(HighLevelAnalyzer):
    # Settings
    device_address = NumberSetting(min_value=0, max_value=127)

    result_types = {
        'command': {
            'format': 'CMD: {{data.command}} DATA: {{data.payload}}'
        },
        'response': {
            'format': 'RSP: {{data.status}} DATA: {{data.payload}}'
        }
    }

    def __init__(self):
        self.state = 'IDLE'
        self.buffer = []

    def decode(self, frame: AnalyzerFrame):
        if frame.type == 'data':
            byte_val = frame.data['data'][0]
            self.buffer.append(byte_val)

            if len(self.buffer) >= 4:  # Complete packet
                return AnalyzerFrame(
                    'command',
                    frame.start_time,
                    frame.end_time,
                    {
                        'command': hex(self.buffer[0]),
                        'payload': bytes(self.buffer[1:]).hex()
                    }
                )
                self.buffer = []

Installing HLA

In Logic 2:
1. Extensions > Load Existing Extension
2. Navigate to directory containing extension.json
3. Extension appears in analyzer list

# extension.json
{
    "name": "My Protocol HLA",
    "apiVersion": "1.0.0",
    "author": "Your Name",
    "version": "1.0.0",
    "description": "Custom protocol decoder",
    "entry": "my_protocol_hla.py"
}

Advanced Usage

Measurement Tools

In Logic 2:
- Timing cursors: Click and drag on waveform
- Frequency: Right-click > Measure Frequency
- Duty cycle: Timing markers show high/low duration
- Pulse count: Timing markers between cursors

Keyboard shortcuts:
- 1/2: Place timing markers
- +/-: Zoom in/out
- Scroll: Pan horizontally
- Shift+Scroll: Zoom
- F: Fit to screen

Data Export

# Export via automation API
capture.export_raw_data_csv(
    directory='/path/to/output',
    digital_channels=[0, 1, 2, 3],
    analog_channels=[0, 1],
)

# Export analyzer data table
capture.export_data_table(
    filepath='decoded_data.csv',
    analyzers=[spi_analyzer],
    iso8601_timestamp=True,
)

# Supported export formats:
# - CSV (raw digital/analog data)
# - CSV (analyzer data tables)
# - .sal (Saleae capture file)

Protocol Timing Analysis

Measure protocol timing:
1. Capture signal
2. Add protocol analyzer
3. Use timing markers to measure:
   - Clock-to-data setup/hold time
   - CS assertion to first clock edge
   - Inter-frame gaps
   - Total transaction time
4. Verify against datasheet specifications

Configuration

Performance Optimization

For maximum sample rate:
- Use USB 3.0 port (not hub)
- Reduce number of active channels
- Use shorter capture duration
- Close other USB-heavy applications

Sample rate vs. channels (Logic Pro 16):
- 1-4 channels: 500 MS/s digital
- 5-8 channels: 250 MS/s digital
- 9-16 channels: 125 MS/s digital

Logic 2 Settings

Preferences:
- Theme: Dark/Light
- Capture path: Set default save location
- Memory usage: Adjust buffer size
- Automation: Enable/disable API server (port 10430)

Troubleshooting

IssueSolution
Device not detectedTry different USB 3.0 port, reinstall drivers
Low sample rateReduce active channels, use USB 3.0
Garbled protocol decodeVerify sample rate is 4x+ signal frequency
Analog noiseUse shorter probes, add ground clip
Capture stops unexpectedlyCheck disk space, reduce duration
Automation API won’t connectEnable in Logic 2 settings, check port 10430
Trigger not firingVerify threshold voltage, check signal levels
Missing data in decodeIncrease sample rate, check channel mapping

Signal Integrity Tips

- Keep probe wires as short as possible (< 15cm)
- Always connect ground clip near the signal source
- Match voltage threshold to target logic level
- Use 10:1 probe for high-frequency signals
- Avoid routing probe wires near power supplies
- For SPI > 10MHz, use 4+ channels on same side of connector

Sample Rate Guidelines

Protocol          Minimum Sample Rate
UART 115200       1 MS/s
SPI 1 MHz         4 MS/s
SPI 10 MHz        50 MS/s
I2C 100 KHz       1 MS/s
I2C 400 KHz       4 MS/s
CAN 500 Kbps      4 MS/s
1-Wire             1 MS/s
JTAG 10 MHz       50 MS/s
USB Full Speed    50 MS/s

Rule: Sample at 4-10x the clock frequency