TL;DR
DS2Agent is an open-source framework that transforms static device datasheets into interactive, hardware-grounded agents for embedded systems design. By constructing a "triple-model" representation (knowledge, behavior, and driver) and allowing optional calibration against real hardware, it slashes the time and token costs of board-level development while virtually eliminating the hallucinations that plague standard LLMs.
What Problem Does This Paper Address?
Embedded board-level design is a notoriously manual and "tedious and laborious" process (as shown in Figure 1a). Engineers must navigate hundreds of pages of datasheets—filled with complex prose, register maps, and timing diagrams—to select components, write drivers, and integrate them into a working system.
While Large Language Models (LLMs) show promise in automating these tasks, they face two major hurdles:
- Static Interpretation: Most agents treat datasheets as simple text for Retrieval-Augmented Generation (RAG), missing the deep functional logic required for system integration.
- Hallucinations: Without a connection to physical reality, LLMs often "invent" register values or timing constraints, leading to broken firmware and wasted engineering hours.
Methods
The authors introduce DS2Agent, which moves beyond simple text retrieval by building a structured, executable representation of a device. Each agent consists of three linked models:
- Knowledge Model: Supports RAG-based question answering and fact retrieval.
- Behavioral Model (Digital Twin): Captures the physical functionality, register semantics, and transfer functions (e.g., how a raw 16-bit value converts to Celsius).
- Interface Model: Manages digital-interface operations and generates portable C driver code.
A key innovation is the Hardware-in-the-Loop (HITL) calibration. If a physical device is available, the agent can run tests to compare real-world measurements against its modeled predictions. This allows the agent to "calibrate" its internal knowledge, ensuring that the generated drivers actually work on the target hardware.
The construction process is handled by a multi-agent pipeline (Scanner, Builder, and Verifier) that extracts data from PDFs and verifies it against reference evidence before exposing the agent's capabilities via the Model Context Protocol (MCP).
Datasets
The framework was evaluated on ten diverse devices spanning seven functional categories, including sensors (SHT31, ADXL345), data converters (HX711, MCP4725), and real-time clocks (DS3231).
The evaluation used three main benchmarks:
- Question Answering: A set of 100 expert-curated questions covering communication, power, and timing.
- Driver Generation: Implementing specific functionality on a NUCLEO-F103RB target board.
- System Integration: Three real-world FreeRTOS applications: Temperature Control (TC), Automatic Leveling (AL), and Current Monitoring (CM).
Key Insights and Ideas
- Shared Intermediate Representation: By linking knowledge, behavior, and drivers, the agent creates a "single source of truth." Once a register is defined for a QA task, that same definition is reused for code generation, ensuring consistency across the entire design lifecycle.
- Hardware as the Ultimate Verifier: The authors treat hardware observations as "instance evidence." This grounding prevents the agent from getting stuck in a loop of hallucinated logic; if the physical chip says "0xEF" for its ID, the agent accepts that over a potentially misread datasheet.
- Efficiency through Structure: Because the agent queries structured models rather than raw PDF text, it requires significantly fewer tokens to reach a correct answer, making it both faster and cheaper to run.
Key Results
The DS2Agent-augmented agent outperformed a baseline LLM agent across every metric:
- Accuracy: Improved the QA score from 87 to 97 out of 100.
- Token Efficiency: Reduced token usage by 44.8% for QA and a staggering 72.9% for driver generation.
- Speed: Downstream task completion time for driver generation dropped from an average of 737 seconds to just 25 seconds—a 96.6% reduction.
- Integration: In complex FreeRTOS tasks, it reduced total completion time by 44.1% (see Figure 4).
Limitations and Future Work
While highly effective for digital-interface devices, the paper notes some areas for growth:
- Analog Complexity: The current behavioral models focus on digital registers and simple transfer functions. Modeling complex analog behaviors or high-speed RF characteristics remains a challenge.
- Extraction Robustness: The "Scanner" phase still relies on LLMs to parse tables and diagrams, which can be a bottleneck if the source PDF is poorly formatted.
- Broader Integration: Future work could involve integrating these agents directly into PCB EDA tools (like KiCad) to automate the entire board design from component selection to final routing.
Summary updated