Skip to content

Chip Control

The Chip Control component provides 7 tools for detecting ESP devices, managing connections, resetting chips, and capturing serial output. These tools form the foundation for all device interactions in mcesptool.

Port parameters accept physical serial ports (/dev/ttyUSB0, COM3) and QEMU virtual serial ports (socket://localhost:5555). When port is optional and omitted, auto-detection probes common serial ports.


Detect the chip type and gather device information by running esptool chip-id (and optionally flash-id) as a subprocess.

NameTypeDefaultDescription
portstr | NoneNoneSerial port or socket URI. Auto-detects if omitted.
baud_rateint | NoneNoneBaud rate. Uses server default (460800) if omitted.
detailedboolFalseInclude flash size, crystal frequency, and feature list.
# Basic detection
result = await client.call_tool("esp_detect_chip", {
"port": "/dev/ttyUSB0"
})
# Detailed detection with custom baud rate
result = await client.call_tool("esp_detect_chip", {
"port": "socket://localhost:5555",
"baud_rate": 115200,
"detailed": True
})
{
"success": true,
"port": "/dev/ttyUSB0",
"baud_rate": 460800,
"connection_time_seconds": 1.23,
"chip_info": {
"chip_type": "ESP32-S3",
"mac_address": "aa:bb:cc:dd:ee:ff",
"flash_size": "4MB",
"crystal_frequency": "40MHz",
"features": ["WiFi", "BLE", "Embedded PSRAM 8MB"]
}
}

When detailed is False, the chip_info object contains only chip_type and mac_address.


Verify device connectivity with configurable retries, timeout, and stub loader settings. Internally runs esptool chip-id up to retry_count times with a delay between attempts.

NameTypeDefaultDescription
portstr | NoneNoneSerial port or socket URI. Auto-detects if omitted.
baud_rateint | NoneNoneBaud rate. Uses server default if omitted.
timeoutint | NoneNoneConnection timeout in seconds. Uses config default (30) if omitted.
use_stubboolTrueLoad ROM bootloader stub for faster operations.
retry_countint3Number of connection attempts before giving up.
result = await client.call_tool("esp_connect_advanced", {
"port": "/dev/ttyUSB0",
"timeout": 10,
"retry_count": 5
})
{
"success": true,
"port": "/dev/ttyUSB0",
"baud_rate": 460800,
"attempt": 2,
"stub_loaded": true,
"chip_type": "ESP32",
"mac_address": "aa:bb:cc:dd:ee:ff"
}

On failure after all retries:

{
"success": false,
"error": "Timeout (30.0s)",
"attempts": 5,
"port": "/dev/ttyUSB0"
}

Reset the ESP chip using different reset methods. Internally runs esptool chip-id with the --after flag set according to the reset type.

NameTypeDefaultDescription
portstr | NoneNoneSerial port or socket URI. Auto-detects if omitted.
reset_typestr"hard"Reset method: hard, soft, or bootloader.
Valueesptool --afterBehavior
hardhard_resetFull hardware reset via DTR/RTS toggle. Device reboots and runs application.
softsoft_resetSoft reset. Device restarts without full power cycle.
bootloaderno_resetLeaves the chip in bootloader mode after the command completes.
result = await client.call_tool("esp_reset_chip", {
"port": "/dev/ttyUSB0",
"reset_type": "hard"
})
{
"success": true,
"port": "/dev/ttyUSB0",
"reset_type": "hard",
"timestamp": 1708732800.0
}

Scan all common serial ports for connected ESP devices. Also includes any running QEMU virtual devices in the results.

Scans /dev/ttyUSB0-3 and /dev/ttyACM0-3 on Linux, COM1-COM20 on Windows, and /dev/cu.usbserial-* on macOS.

NameTypeDefaultDescription
detailedboolFalseInclude flash ID and extended info for each detected device.
result = await client.call_tool("esp_scan_ports", {
"detailed": True
})
{
"success": true,
"detected_devices": [
{
"port": "/dev/ttyUSB0",
"available": true,
"chip_type": "ESP32",
"mac_address": "aa:bb:cc:dd:ee:ff",
"flash_size": "4MB"
},
{
"port": "socket://localhost:5555",
"chip_type": "esp32c3",
"instance_id": "qemu-1",
"source": "qemu",
"available": true
}
],
"total_scanned": 9,
"checked_ports": ["/dev/ttyUSB0", "/dev/ttyUSB1", "..."],
"available_ports": ["/dev/ttyUSB0"],
"qemu_devices": [{"..."}],
"timestamp": 1708732800.0
}

Load a pre-built test firmware for quick chip validation. Currently returns firmware metadata; actual flashing requires ESP-IDF integration.

NameTypeDefaultDescription
portstr | NoneNoneSerial port or socket URI. Auto-detects if omitted.
firmware_typestr"blink"Test firmware type: blink, hello_world, or wifi_scan.
ValueDescription
blinkSimple LED blink test
hello_worldSerial output hello world
wifi_scanWiFi network scanner
result = await client.call_tool("esp_load_test_firmware", {
"port": "/dev/ttyUSB0",
"firmware_type": "hello_world"
})
{
"success": true,
"port": "/dev/ttyUSB0",
"firmware_type": "hello_world",
"description": "Serial output hello world",
"note": "Test firmware loading requires ESP-IDF integration (coming soon)",
"timestamp": 1708732800.0
}

Load and execute a binary in device RAM without touching flash. Uses esptool load-ram to transfer the binary. The program runs until the device is physically reset.

This is ideal for rapid development iteration — test changes without wearing out flash or waiting for a full flash cycle.

NameTypeDefaultDescription
binary_pathstr(required)Path to the RAM-executable binary. Must be compiled for RAM execution.
portstr | NoneNoneSerial port or socket URI. Auto-detects if omitted.
result = await client.call_tool("esp_load_ram", {
"binary_path": "/path/to/firmware-ram.bin",
"port": "/dev/ttyUSB0"
})
{
"success": true,
"port": "/dev/ttyUSB0",
"binary_path": "/path/to/firmware-ram.bin",
"file_size": 32768,
"elapsed_seconds": 2.15,
"note": "Binary loaded to RAM and executing. Reset device to stop."
}

Open the serial port and capture device output for a specified duration. Useful for reading boot messages, debug output, or application logs without switching to a separate terminal monitor.

NameTypeDefaultDescription
portstr(required)Serial port. No auto-detect for monitor operations.
baud_rateint115200Serial baud rate.
duration_secondsfloat5.0Capture duration. Clamped to 0.1—30 seconds.
reset_on_connectboolTrueReset device before capturing to get boot messages.
result = await client.call_tool("esp_serial_monitor", {
"port": "/dev/ttyUSB0",
"baud_rate": 115200,
"duration_seconds": 10.0,
"reset_on_connect": True
})
{
"success": true,
"port": "/dev/ttyUSB0",
"baud_rate": 115200,
"duration_seconds": 10.04,
"reset_performed": true,
"line_count": 42,
"output": "rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)\nI (0) cpu_start: Starting scheduler...\n..."
}

The output field contains the raw serial text with lines joined by \n. The line_count reflects the number of complete lines captured during the duration window.