RTOS & Firmware Stacks

# PX4 Pixhawk 6C simulation on real ARM ELF

Go beyond host-compiled PX4 SITL: run the actual px4\_fmu-v6c Cortex-M7 ELF against real SPI/I2C sensor twins including BMI088 and BMP388.

PX4 SITL compiles autopilot code for x86 Linux and injects simulated MAVLink sensor packets, bypassing NuttX board startup, STM32H7 SPI DMA drivers, BMI088 dummy-byte framing and sensor bus failover logic.

CircuitTwin runs the real STM32H743 autopilot ELF against datasheet-generated twins of the onboard IMUs, barometer and magnetometer so you can inject SPI disconnects, frozen gyros or barometer spikes and watch EKF2 failover in CI.

## PX4 SITL vs Pixhawk 6C digital twin

| Layer          | PX4 SITL (x86 POSIX)            | CircuitTwin Pixhawk 6C twin                          |
| -------------- | ------------------------------- | ---------------------------------------------------- |
| Binary tested  | Host x86/arm64 POSIX executable | Actual px4\_fmu-v6c ARM Cortex-M7 ELF                |
| RTOS & HAL     | POSIX wrapper                   | NuttX + STM32H7 RCC, SPI DMA, I2C, timers            |
| Sensor drivers | Bypassed via simulator\_mavlink | Real BMI088 / BMP388 / mag SPI & I2C drivers         |
| Fault testing  | High-level sensor topic flags   | Bus NACK, SPI disconnect, frozen reg, wrong CHIP\_ID |

## Local CLI workflow

Shell — build px4\_fmu-v6c & run twin

```
make px4_fmu-v6c_default
ct run --json --scene scenes/pixhawk6c.scene.json build/px4_fmu-v6c_default/px4_fmu-v6c_default.elf
```

## Suite & fault configuration

tests/px4-imu-failover.suite.yaml

```
version: 1
scene: scenes/pixhawk6c.scene.json
firmware: build/px4_fmu-v6c_default/px4_fmu-v6c_default.elf
tests:
  - name: primary-imu-frozen-failover
    timeout_ms: 8000
    faults:
      - at_ms: 2500
        part: bmi088
        kind: frozen_reading
    expect:
      console_contains: "EKF2 switched primary IMU"
      exit_code: 0
```

## CI pipeline integration

.github/workflows/px4-fmu-ci.yml

```
name: PX4 FMU-v6C Twin CI
on: [push, pull_request]
jobs:
  fmu-v6c:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make px4_fmu-v6c_default
      - uses: circuittwin/action@v1
        with:
          suite: tests/px4-imu-failover.suite.yaml
```

## PX4 Autopilot IMU and barometer fault CI

Verify PX4 EKF2 sensor failover on real Cortex-M7 binaries without risking airframes or maintaining HITL racks.

PX4 SITL compiles to a POSIX host binary and mocks uORB topics directly, bypassing SPI drivers, NuttX DMA interrupts and sensor voting logic.

Running your compiled STM32H7 or STM32F7 flight-controller ELF against BMI088, ICM-42688-P and MS5611 twins tests the real sensor driver, FIFO watermark ISR and EKF2 fallback when a sensor freezes mid-flight.

### PX4 sensor fault tests

| Sensor               | Injected fault                     | Expected PX4 action                                        |
| -------------------- | ---------------------------------- | ---------------------------------------------------------- |
| BMI088 / ICM-42688-P | frozen\_reading on primary SPI IMU | sensors module switches primary IMU without EKF divergence |
| MS5611               | bus\_disconnect on barometer SPI   | Baro health flag clears and failsafe logs event            |
| NEO-M9N              | uart\_drop\_rx GNSS blackout       | EKF2 transitions cleanly to dead-reckoning / failsafe      |

Shell - run PX4 ELF with IMU fault suite

```
ct test run --json --junit results/px4.xml tests/px4-imu-failover.suite.yaml
```

tests/px4-imu-failover.suite.yaml

```
version: 1
board: nucleo-h743zi2
firmware: build/px4_fmu-v6c_default/px4_fmu-v6c_default.elf
tests:
  - name: primary-imu-freeze-failover
    timeout_ms: 6000
    faults:
      - at_ms: 1500
        part: bmi088
        kind: frozen_reading
    expect:
      console_contains: "IMU_FAILOVER_OK"
      exit_code: 0
```

## Troubleshooting checklist

| Symptom                                    | Fix                                                                                              |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| BMI088 probe fails with wrong CHIP\_ID     | Verify SPI accelerometer read discards the mandatory 1 dummy byte (gyroscope does not send one). |
| NuttX console silent on UART               | Check board\_config.h console UART assignment (USART2 / Telem port) in the scene wiring.         |
| SPI DMA transfer fails on STM32H7          | Ensure DMA buffers sit in non-cached AXI/D2 SRAM rather than DTCM.                               |
| Timeout before EKF2 convergence            | Keep fault injection after sensor calibration settles (e.g. at\_ms: 2500).                       |
| SPI IMU driver reports WHO\_AM\_I mismatch | Verify SPI CPOL/CPHA mode and dummy-byte count for BMI088 accelerometer vs gyroscope.            |
| NuttX console prints nothing               | Confirm the board console binding maps to the NuttX debug UART.                                  |

## Frequently asked questions

| Question                                   | Answer                                                                                                                                                                                   |
| ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| How does CircuitTwin differ from PX4 SITL? | PX4 SITL compiles a host Linux executable and skips STM32 startup, SPI/I2C register drivers and DMA ISRs. CircuitTwin runs the compiled ARM Cortex-M7 ELF directly against sensor twins. |

## Related boards & component twins

[Board: nucleo-h743zi2](https://circuittwin.ai/boards/nucleo-h743zi2) [Board: teensy-4-1](https://circuittwin.ai/boards/teensy-4-1) [Board: nucleo-f767zi](https://circuittwin.ai/boards/nucleo-f767zi) [Twin: BMI088](https://circuittwin.ai/twins/bmi088) [Twin: BMP388](https://circuittwin.ai/twins/bmp388) [Twin: DPS310](https://circuittwin.ai/twins/dps310) [Twin: LIS3MDL](https://circuittwin.ai/twins/lis3mdl) [Twin: ICM-42688-P](https://circuittwin.ai/twins/icm-42688-p) [Twin: MS5611](https://circuittwin.ai/twins/ms5611) [Twin: NEO-M9N](https://circuittwin.ai/twins/neo-m9n) [CircuitTwin vs PX4 SITL](https://circuittwin.ai/compare/px4-sitl) [Proving Ground 3D physics](https://circuittwin.ai/docs/proving-ground) [PX4 Pixhawk 6C guide](https://circuittwin.ai/guides/px4-pixhawk-6c-simulation)

## More in RTOS & Firmware Stacks

[Zephyr RTOS CI without hardware benches](https://circuittwin.ai/guides/zephyr-rtos-ci-without-hardware) [FreeRTOS headless testing in CI](https://circuittwin.ai/guides/freertos-headless-testing) [ESP-IDF CI simulation for ESP32, S3 & C3](https://circuittwin.ai/guides/esp-idf-ci-simulation) [Marlin 3D printer firmware testing in CI](https://circuittwin.ai/guides/marlin-firmware-testing-ci)

> ## 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)
