Neural Inverse is Open Source →
DocsHIL Testing

HIL Testing

Hardware-in-the-loop (HIL) testing automates the cycle of build → flash → stimulus → observe → evaluate against real hardware.

Test Definition

HIL tests are defined as JSON files in .inverse/hil-tests/:

{
  "name": "uart_loopback",
  "description": "Verify UART TX/RX loopback at 115200 baud",
  "steps": [
    { "action": "build" },
    { "action": "flash" },
    { "action": "wait", "duration": "500ms" },
    { "action": "serial_send", "port": "/dev/ttyUSB0", "data": "HELLO\\r\\n" },
    { "action": "serial_expect", "port": "/dev/ttyUSB0", "pattern": "HELLO", "timeout": "2s" }
  ],
  "pass_criteria": "all_steps_pass"
}

Step Actions

ActionDescription
buildCompile the project
flashFlash binary to target
waitWait for a duration
serial_sendSend data on serial port
serial_expectWait for pattern on serial
gpio_setSet GPIO pin state (via debug probe)
gpio_readRead GPIO pin state
measure_powerMeasure power consumption
capture_logicCapture logic analyzer data
read_registerRead a peripheral register
evaluateCustom evaluation expression

Creating Tests

> fw_hil_define name=uart_loopback

Interactive test definition — the agent helps build the step sequence.

Running Tests

Single Test

> fw_hil_run uart_loopback

Executes the test and reports pass/fail with detailed step results.

Full Suite

> fw_hil_run_suite

Runs all tests in .inverse/hil-tests/ sequentially.

Results

Results are stored in .inverse/hil-results/<timestamp>_<name>.json:

{
  "test": "uart_loopback",
  "timestamp": 1742300000000,
  "duration_ms": 3450,
  "result": "pass",
  "steps": [
    { "action": "build", "result": "pass", "duration_ms": 2100 },
    { "action": "flash", "result": "pass", "duration_ms": 800 },
    { "action": "serial_expect", "result": "pass", "matched": "HELLO" }
  ]
}

Agent Tools

ToolDescription
fw_hil_defineDefine a new HIL test
fw_hil_listList defined tests
fw_hil_runRun a single test
fw_hil_run_suiteRun all tests

Was this page helpful?

Last edited