EMK850+ Low-Power Analyzer MCP Server
Enables programmatic control of the Yingjia EMK850+ low-power analyzer via a serial port, exposing FastAPI endpoints for reading power, version, configuration, clearing the baseline, and managing the serial port.
README
EMK850+ Low-Power Analyzer — Protocol Reverse Engineering & Python Toolkit
Reverse-engineered the serial protocol of the Yingjia (英加) EMK850+ low-power analyzer from its vendor host software (
EMK850+.exe, .NET) and live probes on a real device, then built a Python driver and a FastAPI (MCP-style) HTTP server.
Disclaimer
This project is free and non-profit — released for learning, personal, and internal use only.
- It was created solely for the author's automated-testing workflow and for AI assistants to drive the analyzer programmatically. It is not affiliated with, endorsed by, or sponsored by the manufacturer (英加 / Yingjia).
- The serial protocol documented here was reverse-engineered from the vendor host software and a specific device. Firmware/model upgrades may change or break the protocol; this project makes no guarantee of compatibility with future versions.
- Use at your own risk. The author accepts no responsibility for any damage or loss caused by protocol incompatibility, misuse (e.g., clearing the counter while a device under test is connected), or any other use of this software.
Table of Contents
- Disclaimer
- Features
- The Reverse-Engineered Protocol
- How It Was Reverse-Engineered
- Quick Start (CLI)
- FastAPI HTTP Server (MCP)
- Requirements
- Project Structure
- Warnings
- Detailed Protocol Doc
Features
- Read power consumption — start sampling, decode voltage / current / power.
- Clear counter (no-load zero) — measure the floating baseline and subtract it.
- Read device version & calibration config.
- Two-stage stream parser — byte-level state machine (frame extraction) → frame queue → command dispatch. Any misaligned byte drops only 1 byte and resyncs.
- FastAPI HTTP interface — control the analyzer from any HTTP client / MCP.
Real measured readings (COM19, EMK850+ low-power analyzer):
Voltage: 4.202 V Current: 6.94 µA Power: 29.2 µW
The Reverse-Engineered Protocol
Serial link
| Param | Value |
|---|---|
| Baud rate | 115200 |
| Data bits / Stop / Parity | 8N1 |
| Frame length | Fixed 64 bytes |
Frame format
[0] 0x33 (magic)
[1] cmd command byte
[2] len payload length (0..60)
[3] seq sequence/flag — 0x00 for normal frames;
for big-data continuation frames (cmd 0x40) this is the frame index 1,2,3...
[4..63] payload (60 bytes, zero-padded)
Important gotcha: byte 3 is not always 0x00. The vendor host reads
64-byte aligned blocks and discards any trailing partial block — do not
copy that behavior. Use a byte-by-byte streaming state machine instead.
Key commands
| cmd | name | direction | payload |
|---|---|---|---|
| 0x10/0x11 | REQ/RES_VERSION | →/← | ASCII version string |
| 0x16 | REQ_START | → | PLStart{short threshold; short threshold2} |
| 0x18 | REQ_STOP | → | — |
| 0x21 | RESULT (sample) | ← | 14×Sample{ushort voltage; short current} |
| 0x32 | REQ_READ_CONFIG | → | — |
| 0x42 | BIG_DATA_FIRST | ← | hdr(12B) + data; [4..7]=total len, [8..11]=checksum |
| 0x40 | BIG_DATA (cont.) | ← | data chunk |
| 0x64/0x65 | USER_START/END_CLEAR | → | — |
| 0x84 | HIGH_SPEED_DATA | ← | 9B ch-hdr + 25×short + 1B flag |
Sample data (cmd 0x84, high-speed frames)
payload = [9-byte channel header][25 × short samples][1-byte flag]
sample[0] = voltage ADC
samples[1..24] = current ADC
channel no. per sample = 3 bits in the 9-byte header (0..4)
Conversion math
Current (mA): I = (raw + offset) × cfg.voltage / 65536 / gain / omX × 1000 × (1+pX) + oX
Voltage (V): V = (raw & 0xFFFF) × cfg.voltage / 65535 × 7.8 × (1+pv) + ov
Power: P = V × I
cfg (calibration) is read from the device as a 232-byte block of doubles
(PLConfig2), assembled from the 0x42/0x40 big-data frames.
Read-power flow
1. cmd 0x32 read config → reassemble PLConfig2
2. cmd 0x16 start sampling
3. continuously receive cmd 0x84 high-speed frames (~400 fps)
4. decode V / I per frame, average, P = V × I
5. cmd 0x18 stop
Clear counter (no-load zero)
The device echoes cmd 0x64 (ack) but does not change its high-speed stream. In the vendor app the no-load zero is a PC-side operation: measure the floating baseline for ~10 s, store it as an offset, subtract from later readings. This tool does the same.
How It Was Reverse-Engineered
- Decompiled the vendor host —
EMK850+.exeis a .NET 4.7.2 WPF app. Decompiled it to C# with ILSpy/ilspycmd (no system .NET SDK needed — a portable self-contained ILSpy was downloaded). The protocol classes (mpa.protocol,mpa.SerialManager,mpa/Protocol.cs) contain the entire frame/command definition. - Extracted the calibration math — from
MainWindow.HandleSample/HandleSampleHighSpeed, the raw ADC → current/voltage conversion formulas and thePLConfig2calibration struct were recovered. - Probed a live device on COM19 — captured raw bytes, validated the frame
format, discovered the
seqbyte on continuation frames (byte 3 ≠ 0), and confirmed the big-data config reassembly (232 bytes, sum checksum). - Verified power reading — start → stream → decode produced stable values
(
4.202 V / 6.9 µA / 29 µW). - Verified clear — compared baseline before/after clear
(
7.2 µA → 0.01 µA), confirming the PC-side zero-offset approach.
Quick Start (CLI)
# Option A: uv (recommended)
uv sync # creates .venv from pyproject.toml
uv run python emk850_analyzer.py power COM19
# Option B: pip
pip install pyserial
python emk850_analyzer.py power COM19
# Read power (V / I / P)
# Read device version
# Clear counter (⚠️ device input MUST be floating/no-load first!)
Commands:
uv run python emk850_analyzer.py power COM19 # read power
uv run python emk850_analyzer.py version COM19 # read version
uv run python emk850_analyzer.py config COM19 # read calibration config
uv run python emk850_analyzer.py clear COM19 # clear counter (⚠️ floating first!)
$ python emk850_analyzer.py power COM19
Voltage: 4.202 V Current: 6.94 uA Power: 29.2 uW
FastAPI HTTP Server (MCP)
# uv
uv sync
uv run python emk850_mcp_server.py --port COM19 --http 8000
# or pip
pip install pyserial fastapi uvicorn
python emk850_mcp_server.py --port COM19 --http 8000
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | service / port / device status |
/version |
GET | device version |
/power?sample_s=0.8 |
GET | read power (V/I/P; auto start→sample→stop) |
/config |
GET | calibration config (PLConfig2) |
/start |
POST | start sampling manually |
/stop |
POST | stop sampling manually |
/clear |
POST | clear counter — requires {"confirm":true} and floating input |
/output |
POST | set output voltage (cmd 181 sub=6, mV): {"state":"on","voltage":3.3} → 3.3 V, {"state":"off"} → 0 mV. No direct output-off command exists, so "off" cuts the output indirectly via 0 mV |
Power-cycle use case (wake a sleeping chip so the debugger can connect):
When a target MCU is in low-power sleep/stop mode and the debugger (J-Link /
ST-Link, ...) cannot connect:
1. POST /output {"state":"off"} # 0 mV — power down
2. wait 10–15 s # let the chip fully discharge
3. POST /output {"state":"on","voltage":3.3} # restore 3.3 V — chip resets & wakes
4. debugger can now connect to the target
| /port | GET | get current serial port status |
| /port/open | POST | open / switch serial port, body {"port":"COM19"} |
| /port/close | POST | close serial port (reader thread stays alive) |
curl -s http://localhost:8000/power
curl -s -X POST http://localhost:8000/clear \
-H "Content-Type: application/json" -d '{"confirm":true}'
curl -s http://localhost:8000/port
curl -s -X POST http://localhost:8000/port/open \
-H "Content-Type: application/json" -d '{"port":"COM19"}'
curl -s -X POST http://localhost:8000/port/close
Requirements
pyserial>=3.5
fastapi>=0.100
uvicorn>=0.23
See requirements.txt.
Project Structure
emk850_MCP/
├── emk850_analyzer.py # Python driver (pyserial): power / clear / version / config
├── emk850_mcp_server.py # FastAPI HTTP server (MCP-style)
├── tools/
│ └── emk850_proto.py # Protocol library: two-stage parser + decode
├── docs/
│ └── EMK850_PROTOCOL.md # Full reverse-engineered protocol spec (Chinese)
├── README.md # This file (English)
└── README.zh-CN.md # Chinese README
Warnings
- Serial port is exclusive — the HTTP server holds the port; do not run the vendor app / CLI at the same time.
- Clear is risky — the analyzer input MUST be floating (no DUT). Clearing while a device is connected zeroes out its current baseline.
- Gear limits — the analyzer auto-ranges. On uncalibrated gears (om=0) the current cannot be converted; the parser skips those samples.
Detailed Protocol Doc
See docs/EMK850_PROTOCOL.md for the full protocol
specification: complete command table, all payload structs, calibration
constants, verified test results, and legacy notes (Chinese).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。