Logic Analyzer logo

Logic Analyzer

Community
LeoKemp223
logic-analyzer

当需要用 Saleae 逻辑分析仪在线采集数字波形并解码 I2C/SPI/UART/CAN 时使用,通过 Logic 2 自动化服务驱动硬件采集、添加协议解码器并导出数据。

Overview

PublisherLeoKemp223
Repositoryembed-ai-tool
Skill namelogic-analyzer
Stars
995
Forks
168
Bundled files
3
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by LeoKemp223 on GitHub. Read the source before you install it.

Installation

Install the Logic Analyzer AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/LeoKemp223/embed-ai-tool/tree/master/skills/logic-analyzer
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/LeoKemp223/embed-ai-tool.git /tmp/embed-ai-tool
mkdir -p .claude/skills
cp -r /tmp/embed-ai-tool/skills/logic-analyzer .claude/skills/logic-analyzer
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Logic Analyzer in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Logic Analyzer on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Logic Analyzer is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

逻辑分析仪采集(Saleae)

适用场景

  • 嵌入式设备的 I2C/SPI/UART 时序需要用逻辑分析仪验证。
  • 需要在线触发 Saleae 设备采集指定通道的数字波形。
  • 需要对采集到的波形添加协议解码器,导出解码后的数据表(CSV)。
  • 需要导出原始通道波形(CSV)做进一步分析。

必要输入

  • Logic 2 桌面软件已运行,且开启 automation server(Settings/Preferences → Automation,或底部状态栏 Automation 按钮;也可命令行 Logic.exe --automation 启动)。
  • Saleae 设备已连接(或用 Logic 2 的仿真设备测试,--include-sim)。
  • 采集通道、采样率、持续时间。
  • 解码协议时:每个解码器的协议类型与通道映射。

依赖

  • logic2-automation(pip install logic2-automation)
  • Logic 2 桌面软件(提供 automation server,默认端口 10430)

执行步骤

  1. 先阅读 references/usage.md,确认操作参数与解码器设置键。

  2. 探测环境(检查包、端口、Logic 2 连通性与设备):

    bash
    python scripts/la_tool.py --detect
  3. 列出设备:

    bash
    python scripts/la_tool.py --devices
  4. 采集与解码。推荐用可重复的 --analyzer,一次采集可挂多个解码器,各自导出独立 CSV:

    bash
    # 单协议:I2C(SCL=CH0, SDA=CH1)
    python scripts/la_tool.py --capture --channels 0-1 --samplerate 4M --duration 5 \
        --analyzer "i2c:scl=0,sda=1"
    
    # 多协议同时解码:I2C + UART + SPI
    python scripts/la_tool.py --capture --channels 0-6 --samplerate 16M --duration 5 \
        --analyzer "i2c:scl=0,sda=1" \
        --analyzer "uart:rx=2,baud=115200" \
        --analyzer "spi:clk=3,mosi=4,miso=5,cs=6"
    
    # CAN(单线,500kbps)
    python scripts/la_tool.py --capture --channels 0 --samplerate 4M --duration 5 \
        --analyzer "can:can=0,baud=500000"

    --analyzer 格式为 协议:键=值,...:

    • i2c:scl、sda(均必填)
    • spi:clk(必填),mosi、miso、cs(可选,未接的省略)
    • uart:rx(必填)、baud(默认 115200)
    • can:can(必填,CAN 信号通道)、baud(默认 500000)

    同协议出现多次会自动按 i2c、i2c2 区分导出文件名。

  5. 输出位置:默认存到工程根 .captures/logic-analyzer/,文件名带时间戳防覆盖(如 i2c_20260625_201048.csv)。

    • 可用环境变量 LA_CAPTURE_DIR 覆盖默认目录。
    • 单解码器时可用 --output 路径 指定文件;相对路径相对默认目录,绝对路径原样。
    • 数值进制用 --radix hex|dec|bin|ascii(默认 hex)。

自然语言提示词模板

让 AI 调用本 skill 时,通道映射是必须说清的物理接线信息(AI 无法探测),SCL/SDA、CLK 等谁接哪个通道要明确。模板(填空即用):

  • I2C:抓 I2C,SCL=通道5,SDA=通道6,采集20秒
  • SPI:抓 SPI,CLK=通道3,MOSI=通道4,MISO=通道5,CS=通道6,采集10秒
  • UART:抓 UART,RX=通道2,波特率115200,采集10秒
  • CAN:抓 CAN,信号接通道0,波特率500k,采集10秒
  • 多协议:同时抓 I2C(SCL=5,SDA=6) 和 UART(RX=2,波特率115200),采集15秒

可省略项(不说则用默认):采样率(I2C/UART/CAN 用 4M 足够,SPI 高速建议 16M~24M)、时长(默认 5 秒)、端口/地址(默认 10430 / 本机,无需指定)。 采集期间务必让总线有通信,否则解出空表。

自动启动 Logic 2(--launch,实验性)

脚本支持 --launch 自动拉起 Logic 2(用完自动关闭),省去手动开软件。但在部分环境(如从 git bash 后台启动 GUI)实测不可靠——进程无法维持、端口起不来。默认仍建议手动打开 Logic 2 并开启 automation server,用普通连接模式。 仅在确认本机环境支持时使用 --launch。

向后兼容(旧式单协议写法,仍可用)

bash
python scripts/la_tool.py --capture --channels 0-1 --samplerate 4M --duration 5 \
    --decode i2c --i2c-scl 0 --i2c-sda 1

新代码优先用 --analyzer;--decode 仅在未提供 --analyzer 时生效。

扩展新协议

支持新协议(如 1-Wire、LIN、Manchester 等)只需在 scripts/la_tool.py 的 ANALYZER_NAMES 与 ANALYZER_SPECS 各加一条:协议短名 → Logic 2 解码器名、短键到 settings 键的映射、必填键列表。解析、采集、导出逻辑全部自动复用,无需改函数体(CAN 即按此方式加入)。

关键:settings 键名必须与 Logic 2 界面里该解码器的设置项完全一致。不要凭猜——最可靠的做法是在 Logic 2 运行时用 API 试探:对一个临时采集反复 add_analyzer(name, settings=...),成功的那组键名即为正确值。

失败分流

  • tool-missing:logic2-automation 未安装。
  • connection-failure:连不上 Logic 2 自动化服务(软件未运行或未开启 automation server)。
  • no-device:未发现已连接的 Saleae 设备。
  • capture-failure:采集启动或过程出错。
  • decode-error:协议解码器添加失败(通常是设置键或通道映射不匹配)。

输出约定

示例输出格式:

结果: ✅ 采集完成 5.0s,2 个解码器: i2c, uart
  连接: 127.0.0.1:10430 ch=[0, 1, 2] 16000000Hz 5.0s
  📄 输出: E:\work\project\.captures\logic-analyzer\i2c_20260625_201643.csv
  📄 输出: E:\work\project\.captures\logic-analyzer\uart_20260625_201643.csv

导出的 CSV 列:name,type,start_time,duration,ack,address,read,data(随协议略有差异)。 data 列按 --radix 指定进制显示(默认十六进制,如 0x2C)。

交接关系

  • 从 build-keil / build-platformio 烧录固件后,用此 skill 验证总线时序。
  • 与 serial-monitor 互补:serial-monitor 查看串口调试输出,logic-analyzer 做信号级时序验证。
  • 与 visa-debug 互补:visa-debug 用示波器测模拟量,logic-analyzer 解数字协议。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Logic Analyzer AI skill do?

当需要用 Saleae 逻辑分析仪在线采集数字波形并解码 I2C/SPI/UART/CAN 时使用,通过 Logic 2 自动化服务驱动硬件采集、添加协议解码器并导出数据。

Why use Logic Analyzer on TypingMind?

Because you install it once and use it with any model. Logic Analyzer is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Logic Analyzer in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/LeoKemp223/embed-ai-tool/tree/master/skills/logic-analyzer. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Logic Analyzer?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Logic Analyzer?

As many as you like. As long as a model supports skills, you can use Logic Analyzer with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Logic Analyzer AI skill free?

It is published on GitHub by LeoKemp223. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇