SLogic16U3 MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SLogic16U3 MCP capture CH0 at 20 MHz for 10 ms and measure PWM frequency and duty cycle"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SLogic16U3 MCP
参考 ATK-Logic-Mcp 的无界面采集和波形分析方式, 为 Sipeed SLogic16U3 提供 MCP 工具。使用 Sipeed 官方 USB 核心,采集不依赖 PulseView, PWM、死区和协议分析复用 ATK 的分析引擎。支持标准 MCP stdio,可连接 Codex、Claude、Cursor 和 DeepSeek Harness(DSH)。
当前版本 0.1.0。已在 macOS arm64 编译、运行原生测试、Python 测试和模拟 MCP 调用;
开发时未连接 SLogic16U3,真实采样、最高带宽、阈值精度和断开恢复尚未验证。
Windows/Linux 提供源码构建方式,尚未在这两个系统运行验证。
工具
工具 | 用途 |
| 离线查询采样率、通道模式、触发和容量限制 |
| 查询设备、USB 端口、序列号及实际链路允许的采样率 |
| 选择物理通道、采样率、阈值和软件触发并保存采样 |
| 查看电平跳变及采样点时间戳 |
| PWM 频率、占空比、抖动及异常脉冲 |
| 两路有效高电平 PWM 的死区及同时为高的重叠 |
| 三相 PWM 的频率和占空比对称性 |
| UART 8N1、I2C、SPI 四种模式解码 |
| 根据完整采样检查频率、占空比、抖动、无重叠及最小死区 |
参数错误、设备缺失、忙、超时和不完整采集均返回 success: false 与 error_code。
分析成功仅表示完成计算,测量是否有效应查看 measurement.valid,断言是否通过应查看 passed。
Related MCP server: ATK-Logic-MCP
通道与采样率
硬件模式 | 可使用的物理通道 | USB3 最高采样率 | Windows 保守上限 |
4 路 | CH0–CH3 | 800 MHz | 400 MHz |
8 路 | CH0–CH7 | 400 MHz | 200 MHz |
16 路 | CH0–CH15 | 200 MHz | 100 MHz |
按最高通道编号选档,而非所选通道数量。 [0, 3] 使用 4 路模式,[0, 7] 使用 8 路模式,
单独 [15] 也需要 16 路模式。工具只保存所选通道的位文件,硬件仍采集对应完整档位。
需用更高采样率时,Agent 会得到降低通道编号范围的建议;不会擅自丢弃通道或降采样率。
支持离散采样率(MHz):5, 8, 10, 16, 20, 25, 32, 40, 50, 80, 100, 160, 200, 400, 800,
再受模式、平台和 USB 链路限制。USB2 的上限更低,以 logic_status 输出为准。
Windows 根据官方说明采用半带宽限制,避免请求 Windows 原生 USB 栈难以稳定支撑的 400 MB/s。
这些规格来自官方产品介绍
和固定版本的官方驱动模型。
只有流式采集,无 ATK 式板载缓冲模式。触发在主机软件中执行:none/rising/falling/high/low/edge;
触发通道必须在所选通道中,预触发比例 0..90%。阈值 0..6 V,步长 0.1 V。
默认采集 CH0/CH1、20 MHz、10 ms、1.6 V、立即开始。
单次上限 3200 万采样点,防止无界采集占满内存和磁盘;采集点数按时长向上取整。
timeout_ms 覆盖软件触发等待及数据采集,必须长于采样时长,范围 100..300000。
源码安装
需要 Python 3.10+、CMake 3.20+、pkg-config、libusb 1.0.24+ 和 GCC/Clang。 依赖源码随仓库提供,无需额外拉取 ATK 或 Sipeed 仓库。
先克隆本项目,再按对应系统安装:
git clone https://github.com/gjjisadog/slogic-mcp.git
cd slogic-mcpmacOS
brew install cmake pkg-config libusb
python3 -m venv .venv
.venv/bin/python -m pip install -e '.[test]'
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
.venv/bin/python -m slogic_mcp statusLinux(Debian/Ubuntu)
sudo apt install build-essential cmake pkg-config libusb-1.0-0-dev python3-venv
python3 -m venv .venv
.venv/bin/python -m pip install -e '.[test]'
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
.venv/bin/python -m slogic_mcp status若设备可见但没有访问权限,将下列规则保存到 /etc/udev/rules.d/99-slogic16u3.rules,
执行 sudo udevadm control --reload-rules 后重新插拔设备:
SUBSYSTEM=="usb", ATTR{idVendor}=="359f", ATTR{idProduct}=="3031", MODE="0660", TAG+="uaccess"规则适用于有本地登录会话的桌面 Linux;无头系统应由管理员按部署用户配置设备权限。
Windows
官方核心使用 pthread 和 GCC/Clang 原子操作,请用 MSYS2 UCRT64 / MinGW,不支持直接用 MSVC 编译。 在 MSYS2 UCRT64 终端安装编译依赖:
pacman -S --needed mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-pkgconf mingw-w64-ucrt-x86_64-libusb
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel再在 Windows PowerShell 中安装 Python 包并查询设备:
py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e .
# 运行时需要 MSYS2 UCRT64 的 libusb 和 winpthreads DLL。
$env:PATH = "C:\msys64\ucrt64\bin;$env:PATH"
.\.venv\Scripts\python.exe -m slogic_mcp status设备应处于应用固件模式并使用 WinUSB 驱动。采集前关闭 PulseView 等占用设备的程序。 MCP 客户端启动环境也必须能找到 libusb/winpthreads DLL(PATH 或放在 slogic-cli.exe 旁)。 本项目不自动更换 USB 驱动,不提供固件刷写功能。
接入 MCP 客户端
在源码目录安装 Python 包并编译成功后,生成配置:
.venv/bin/python -m slogic_mcp config --client codex
.venv/bin/python -m slogic_mcp config --client claude
.venv/bin/python -m slogic_mcp config --client cursorWindows 把 .venv/bin/python 换成 .venv\Scripts\python.exe。
命令输出当前虚拟环境 Python 和原生 CLI 的绝对路径,复制到客户端配置即可;不会修改已有配置。
若之后移动项目,应重新生成配置。
Codex 使用输出的 TOML;Claude/Cursor 使用输出的 mcpServers JSON。
配置里的 tool_timeout_sec = 330 为最长 300 秒采集和清理保留时间。
其他客户端如使用长时间触发等待,也需调整相应工具调用超时。
DeepSeek Harness(DSH)
.venv/bin/python -m slogic_mcp config --client dsh > slogic.cordis.yml
dsh web --patch ./slogic.cordis.yml输出为 JSON 格式的合法 YAML,可作为 Cordis overlay 加载。
使用 @deepseek-ai/dsh-mcp-client,工具前缀为 mcp__slogic16u3__。
已使用官方 DSH 0.2.2-rc.5 验证 overlay 加载和 MCP 桥接工具注册。
DSH 工具调用超时设置为 330 秒;未运行完整的交互式 Agent 实机采集。
环境变量
变量 | 说明 |
| 原生 slogic-cli 的绝对路径;显式路径错误时直接报错 |
| 采样目录,默认 |
CLI 默认查找顺序:显式路径 → 包内 bin/ → 源码 build/、build/Release/ → PATH。
常规 pip install 只安装 Python 部分;原生程序需要在目标平台构建,再用 SLOGIC_CLI 指定。
源码 pip install -e . 可自动找到当前目录的 build/slogic-cli。
使用示例
可以直接让 Agent:“采集 CH0 和 CH1,20 MHz、10 ms,检查 PWM 是否在 20 kHz ±1% 内。”
对应调用示例:
{"channels":[0,1],"sample_rate_hz":20000000,"duration_ms":10,"threshold_v":1.6}若要高采样率:“用 800 MHz,只采 CH0 和 CH3,持续 1 ms,以 CH0 上升沿触发。”
{"channels":[0,3],"sample_rate_hz":800000000,"duration_ms":1,
"trigger":"rising","trigger_channel":0,"pretrigger_percent":10,"timeout_ms":10000}Windows 需要将上述采样率改为不超过 400 MHz。
工具返回 capture_id,可传入 logic_measure_pwm、logic_measure_pair 或 logic_decode。
多设备时先调用 logic_status,再用 device 指定如 usb/1-2 的端口。
分析工具默认处理前 100 万采样点,返回 analysis_samples 和 analysis_truncated。
需要全部分析时传 max_samples: null;大窗口尤其包含大量 PWM 周期时耗时会增加。
logic_assert 始终处理完整采样,不接受用局部窗口代表全程通过。
{"capture_id":"上一步返回的32位ID","channel":0,
"freq_min_hz":19800,"freq_max_hz":20200,"duty_min":0.45,"duty_max":0.55,
"no_overlap_with_channel":1,"min_deadtime_ns":200}占空比使用 0..1;死区单位 ns。互补分析假定两个输入均为有效高电平。
采样分辨率限制可观测的时间精度;通过只适用于所记录时间段。
数据格式与完整性
每次采集使用独立 ID:
<SLOGIC_DATA_DIR>/<capture_id>/
samples.raw # 官方核心输出:4/8路每样本1字节,16路每样本2字节,小端
ch00.bits # 所选物理通道,LSB-first,每8个采样点打包成1字节
ch01.bits
meta.json # 真实采样率、精确样本数、通道、软件触发和各通道SHA-256仅当驱动报告正常结束、样本数准确、触发满足且文件长度吻合,才生成 meta.json。
失败保留 failure.json 和已有部分数据供排查,不允许作为有效测量输入。
加载时检查元数据、长度和哈希,所有分析排除最后字节的补齐位;不会补零凑齐样本。
SHA-256 用于检测意外损坏,不是对本地可修改文件的签名认证。
验证
ctest --test-dir build --output-on-failure
.venv/bin/python -m pytest -qCTest 检查官方核心的通道/采样率限制、首4字节丢弃、4路打包、16路跨块以及预触发。 pytest 检查参数边界、进程失败/超时、互斥、精确样本数、通道拆分、数据损坏、 PWM/互补/三相/UART/I2C/SPI 合成波形及完整 MCP 初始化、工具发现、采集和分析链路。 模拟 CLI 明确只用于测试,不能代替实机验收。
接上设备后的实机验收步骤覆盖阈值、触发、通道映射和最高带宽。 第三方版本与许可证见 THIRD_PARTY.md。
Available Tools
9 toolslogic_assertB
Evaluate PWM tolerances over the ENTIRE complete capture; fail closed on invalid evidence. Duty is 0..1. Deadtime requires no_overlap_with_channel to identify the other active-HIGH gate. Rejects static/insufficient PWM, incomplete/corrupt artifacts and invalid complementary pairing. A pass applies to the recorded interval at the recorded sample resolution.
Inputs: capture_id (required), channel, duty_max, duty_min, +5 more.
logic_capabilitiesA
Return offline SLogic16U3 rate/channel limits, software triggers and storage limits. Highest channel index determines 4/8/16-channel mode; USB2 further limits rates.
Inputs: no named parameters.
logic_captureA
Capture SLogic16U3 input signals using the official USB engine; defaults to CH0/CH1. Select physical channel numbers 0..15. 800 MHz requires ONLY CH0..CH3; 400 MHz requires ONLY CH0..CH7; CH8..CH15 require <=200 MHz on USB3. Windows conservative caps are 400/200/100 MHz. USB2 has further restrictions. At high rates suggest lower-numbered channels, retaining required signal/trigger channels. Never silently drop channels, remap probes, or reduce the requested rate. trigger: none/rising/falling/high/low/edge (software based, not hardware trigger). Trigger channel must be selected. pretrigger_percent is 0..90, threshold 0..6 V in 0.1 V steps. Maximum 32M samples. timeout_ms includes trigger wait and must exceed capture duration. If multiple devices exist, select a port from logic_status. Returns an ID for analysis, exact sample count and data integrity; failures are explicit.
Inputs: device, trigger, channels, timeout_ms, +5 more.
logic_decodeB
Decode UART (8N1), I2C or SPI (8-bit, MSB-first, active-LOW CS) from verified captures. Select physical channels; SPI supports CPOL/CPHA 0 or 1. UART requires >=4 samples/bit. max_samples=null analyzes all; returned packets are bounded by max_packets (1..1000).
Inputs: capture_id (required), cpha, cpol, protocol, +10 more.
logic_inspectC
Inspect exact digital transitions. max_samples limits the analysis window from sample 0; null analyzes the full capture. Last-byte padding is always excluded.
Inputs: capture_id (required), channel, max_edges, max_samples, +1 more.
logic_measure_pairB
Measure active-HIGH complementary PWM deadtime and simultaneous-HIGH overlap. Does not invert active-LOW gate signals. Check measurement.valid and sampling resolution. max_samples=null analyzes the entire capture.
Inputs: capture_id (required), low_channel, max_samples, high_channel.
logic_measure_pwmA
Measure PWM frequency, duty, jitter and anomalies using ATK's analysis engine. max_samples defaults to the first 1M samples; null analyzes all. Duty is a 0..1 fraction. Static/insufficient signals return valid=false. Sampling resolution is reported in ns.
Inputs: capture_id (required), channel, max_samples.
logic_measure_three_phaseC
Analyze three-phase PWM frequency and duty symmetry with ATK's analysis engine. Does not infer carrier synchronization without a reference signal.
Inputs: capture_id (required), u_channel, v_channel, w_channel, +1 more.
logic_statusA
Enumerate only SLogic16U3 devices and their USB port, serial and link-specific rates. Does not start capture. USB accessibility does not establish exclusive readiness.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct role: capabilities/status are informational, capture acquires data, inspect shows raw transitions, the three measure tools target distinct signal types (single PWM, complementary pair, three-phase), and decode/assert handle protocol and pass-fail logic. The only mild overlap is between logic_inspect (raw transitions) and the measure tools (derived metrics), but descriptions differentiate them well.
All tools share the logic_ prefix and most use a verb_noun pattern (logic_capture, logic_inspect, logic_measure_pwm, logic_decode, logic_assert). The noun-only names logic_capabilities and logic_status are minor deviations but remain unambiguous.
Nine tools is well-scoped for a logic analyzer: one acquisition tool, three distinct measurement tools, one decoder, one assertion tool, and two informational tools. Each earns its place without redundancy.
The surface covers discovery, acquisition, inspection, domain-specific measurements, protocol decode, and tolerance assertion, which is a coherent lifecycle for a logic analyzer. Minor gaps exist: no tool to list/export previously captured artifacts by ID, and no hardware-trigger or channel-configuration operations, though these are likely intentional scope limits.
Maintenance
Related MCP Connectors
8 Embedded & EDA MCP tools: UF2 merge, crash decoder, Intel HEX, CAN, Verilog/VCD, CMake.
Reasoning, code, anti-deception, memory harness MCP tools. Stdio or HTTPS api.ejentum.com/mcp
Self-hosted MCP server: 26 deterministic dev, security, and EVM tools.
Remote MCP for LiveLaunch, the Solana token launchpad. Unsigned-transaction tools for AI agents.
Related MCP Servers
- AlicenseAqualityBmaintenanceAI-driven USB logic analyzer control via FastMCP. Captures digital traces, decodes UART/I2C/SPI, and exports VCD for PulseView, supporting sigrok hardware and built-in simulator.63MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to capture digital waveforms from an ALIENTEK USB logic analyzer, run 208 sigrok protocol decoders with stacked chains (like I2C→SSD1306 or UART→Modbus), and analyze or write .atkdl waveform archives offline without the device attached.4MIT
- AlicenseCqualityCmaintenanceEnables MCP clients like Cursor to control logic analyzers, open capture files, decode buses such as Intel 8080, and reconstruct display framebuffers like ST7789.19MIT
- AlicenseAqualityBmaintenanceEnables an MCP client to configure a Saleae Logic MSO mixed-signal oscilloscope, run timed or edge-triggered captures, and retrieve measurements, decimated waveforms, and digital transitions directly from chat, with captures saved to disk for later re-analysis.11MIT