MCU Testing & CI

# ESP32-S3 firmware CI on Xtensa LX7 twins

Run ESP32-S3 binaries headlessly on esp32s3-devkitc and adafruit-qualia-esp32s3 twins to test drivers, state machines and bus faults.

ESP32-S3 runs dual-core Xtensa LX7 at 240 MHz with a flexible GPIO matrix and SPI/I2C/UART/TWAI controllers. In CI, flashing USB boards across runners creates serial port contention and brittle resets.

CircuitTwin executes Xtensa LX7 instructions (160,000 differential cases, 0 disagreements on clean-tree records) and reports any access to unmodelled Wi-Fi/BLE baseband registers explicitly with exit code 4 rather than faking a pass.

## ESP32-S3 simulation scope

| Area                   | Status on twin                           | Practical guidance                                   |
| ---------------------- | ---------------------------------------- | ---------------------------------------------------- |
| Xtensa LX7 CPU core    | 160,000 diff cases, 0 disagrees          | Run full C/C++ firmware and FreeRTOS tasks           |
| UART / SPI / I2C       | Active peripheral models                 | Test sensor drivers, displays and fault recovery     |
| Native Wi-Fi / BLE PHY | Not modelled (exit code 4)               | Use mocked/transport seam or ESP-AT UART module twin |
| Tracked boards         | esp32s3-devkitc, adafruit-qualia-esp32s3 | See board-dashboard.json for live suite breakdown    |

## Local CLI workflow

Shell — run ESP32-S3 ELF

```
idf.py set-target esp32s3 && idf.py build
ct run --json --board esp32s3-devkitc build/app.elf
```

## Suite & fault configuration

tests/esp32s3.suite.yaml

```
version: 1
board: esp32s3-devkitc
firmware: build/app.elf
tests:
  - name: sensor-poll-and-watchdog
    timeout_ms: 3000
    expect:
      console_contains: "APP_MAIN_OK"
      exit_code: 0
  - name: spi-display-disconnect
    faults:
      - at_ms: 150
        part: bmi270
        kind: bus_disconnect
        duration_ms: 40
    expect:
      console_contains: "IMU_REINIT_OK"
```

## CI pipeline integration

.github/workflows/esp32s3-ci.yml

```
name: ESP32-S3 Twin CI
on: [push, pull_request]
jobs:
  esp32s3:
    runs-on: ubuntu-latest
    container: espressif/idf:v5.3
    steps:
      - uses: actions/checkout@v4
      - run: idf.py set-target esp32s3 && idf.py build
      - uses: circuittwin/action@v1
        with:
          suite: tests/esp32s3.suite.yaml
```

## Troubleshooting checklist

| Symptom                              | Fix                                                                                                   |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| Exit code 4 inside esp\_wifi\_init() | Guard Wi-Fi startup behind a build flag or test your protocol/driver layer with the ESP-AT UART twin. |
| UART0 console silent at 115200 bps   | Verify CONFIG\_ESP\_CONSOLE\_UART\_DEFAULT=y (USB-Serial-JTAG console does not emit on UART0).        |
| SPI clock divider off on 80 MHz APB  | Check integer divider math with the SPI Clock Divider Calculator.                                     |
| Watchdog triggers during heavy init  | Inspect virtual elapsed time in ct run --json output to see which loop stalled.                       |

## Related boards & component twins

[Board: esp32s3-devkitc](https://circuittwin.ai/boards/esp32s3-devkitc) [Board: adafruit-qualia-esp32s3](https://circuittwin.ai/boards/adafruit-qualia-esp32s3) [Board: esp32-devkitc](https://circuittwin.ai/boards/esp32-devkitc) [Twin: BMI270](https://circuittwin.ai/twins/bmi270) [Twin: BME680](https://circuittwin.ai/twins/bme680) [Twin: VL53L1X](https://circuittwin.ai/twins/vl53l1x) [Twin: SX1280](https://circuittwin.ai/twins/sx1280) [Board dashboard](https://circuittwin.ai/docs/board-dashboard) [Exit code 4 & verdicts](https://circuittwin.ai/docs/concepts)

## More in MCU Testing & CI

[STM32F7 firmware CI without a bench](https://circuittwin.ai/guides/stm32f7-firmware-ci) [STM32F4 firmware testing without hardware](https://circuittwin.ai/guides/stm32f4-firmware-testing) [STM32H7 digital twin CI for H743 & H747](https://circuittwin.ai/guides/stm32h7-digital-twin-ci) [STM32F103 Blue Pill & NUCLEO-F103RB simulation](https://circuittwin.ai/guides/stm32f103-bluepill-simulation)

> ## Run this workflow on your own ELF
>
> Start free on CircuitTwin to run local board twins, fault matrices and CI checks with zero per-run credits.
>
> [Start now](https://app.circuittwin.ai/try) [Read the quickstart](https://circuittwin.ai/docs/quickstart) [Connect a coding agent](https://circuittwin.ai/docs/agents)
