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

LayerPX4 SITL (x86 POSIX)CircuitTwin Pixhawk 6C twin
Binary testedHost x86/arm64 POSIX executableActual px4_fmu-v6c ARM Cortex-M7 ELF
RTOS & HALPOSIX wrapperNuttX + STM32H7 RCC, SPI DMA, I2C, timers
Sensor driversBypassed via simulator_mavlinkReal BMI088 / BMP388 / mag SPI & I2C drivers
Fault testingHigh-level sensor topic flagsBus 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

SensorInjected faultExpected PX4 action
BMI088 / ICM-42688-Pfrozen_reading on primary SPI IMUsensors module switches primary IMU without EKF divergence
MS5611bus_disconnect on barometer SPIBaro health flag clears and failsafe logs event
NEO-M9Nuart_drop_rx GNSS blackoutEKF2 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

SymptomFix
BMI088 probe fails with wrong CHIP_IDVerify SPI accelerometer read discards the mandatory 1 dummy byte (gyroscope does not send one).
NuttX console silent on UARTCheck board_config.h console UART assignment (USART2 / Telem port) in the scene wiring.
SPI DMA transfer fails on STM32H7Ensure DMA buffers sit in non-cached AXI/D2 SRAM rather than DTCM.
Timeout before EKF2 convergenceKeep fault injection after sensor calibration settles (e.g. at_ms: 2500).
SPI IMU driver reports WHO_AM_I mismatchVerify SPI CPOL/CPHA mode and dummy-byte count for BMI088 accelerometer vs gyroscope.
NuttX console prints nothingConfirm the board console binding maps to the NuttX debug UART.

Frequently asked questions

QuestionAnswer
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

More in RTOS & Firmware Stacks