MCU Testing & CI

STM32F4 firmware testing without hardware

Run your STM32F4 Cortex-M4F ELF across NUCLEO-F446RE, NUCLEO-F411RE, Black Pill and STM32F4-Discovery twins in under three seconds per suite.

STM32F4 parts power motor drives, sensor hubs and legacy industrial controllers. Physical F4 benches drift over time: loose jumper wires, browned-out USB hubs and flaky ST-LINK firmware turn CI jobs red for the wrong reason.

CircuitTwin runs the Cortex-M4F binary deterministically with fixed virtual clocks, verified against the ARMv7E-M FPv4 differential suite and HAL ADC oracle on STM32F4-Discovery.

STM32F4 board twins

Board slugMCU & ClockKey use case
stm32f4-discoverySTM32F407VG @ 168 MHzFull-feature F407 with bxCAN, DMA, ADC oracle
nucleo-f446reSTM32F446RE @ 180 MHzDual bxCAN and high-speed SPI motor/sensor nodes
nucleo-f411reSTM32F411RE @ 100 MHzLow-power sensor fusion and I2C/SPI controllers
black-pill-f411ceSTM32F411CE @ 100 MHzCompact carrier modules and 3D printer boards

Local CLI workflow

Shell — run STM32F4 test matrix
ct run --json --board stm32f4-discovery build/f407.elf
ct test matrix run --json tests/f4-fault-matrix.yaml

Suite & fault configuration

tests/f4-fault-matrix.yaml
version: 1
board: nucleo-f446re
firmware: build/f446.elf
matrix:
  - name: i2c-pullup-drop
    faults:
      - at_ms: 50
        bus: I2C1
        kind: nack
        address: 0x40
        count: 2
  - name: spi-sensor-disconnect
    faults:
      - at_ms: 100
        part: lis3dh
        kind: bus_disconnect
        duration_ms: 30

CI pipeline integration

.gitlab-ci.yml — STM32F4 job
stm32f4-twin-test:
  image: ubuntu:24.04
  script:
    - make -j BOARD=nucleo_f446re
    - ct test run --json --junit f446-junit.xml tests/f4-fault-matrix.yaml
  artifacts:
    reports:
      junit: f446-junit.xml

Troubleshooting checklist

SymptomFix
ADC conversion hangs waiting on EOC flagVerify RCC_APB2ENR.ADC1EN and channel sequence length ADC_SQR1.L match your HAL init.
USART2 prints garbage at 115200 bpsCheck APB1 prescaler (42 MHz on F407, 45 MHz on F446) in the UART Baud Calculator.
bxCAN stays stuck in INAK modeConfirm CAN1 clock is enabled before CAN2 (CAN2 is slave to CAN1 filter banks on STM32F4).
ISR misses flag clear and loops foreverRun with --record trace/ and inspect repeated IRQ entry timestamps in the JSONL trace.

Related boards & component twins

More in MCU Testing & CI