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
make px4_fmu-v6c_default
ct run --json --scene scenes/pixhawk6c.scene.json build/px4_fmu-v6c_default/px4_fmu-v6c_default.elfSuite & fault configuration
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: 0CI pipeline integration
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.yamlPX4 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 |
ct test run --json --junit results/px4.xml tests/px4-imu-failover.suite.yamlversion: 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: 0Troubleshooting 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. |