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 slug | MCU & Clock | Key use case |
|---|---|---|
stm32f4-discovery | STM32F407VG @ 168 MHz | Full-feature F407 with bxCAN, DMA, ADC oracle |
nucleo-f446re | STM32F446RE @ 180 MHz | Dual bxCAN and high-speed SPI motor/sensor nodes |
nucleo-f411re | STM32F411RE @ 100 MHz | Low-power sensor fusion and I2C/SPI controllers |
black-pill-f411ce | STM32F411CE @ 100 MHz | Compact 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.yamlSuite & 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: 30CI 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.xmlTroubleshooting checklist
| Symptom | Fix |
|---|---|
| ADC conversion hangs waiting on EOC flag | Verify RCC_APB2ENR.ADC1EN and channel sequence length ADC_SQR1.L match your HAL init. |
| USART2 prints garbage at 115200 bps | Check APB1 prescaler (42 MHz on F407, 45 MHz on F446) in the UART Baud Calculator. |
| bxCAN stays stuck in INAK mode | Confirm CAN1 clock is enabled before CAN2 (CAN2 is slave to CAN1 filter banks on STM32F4). |
| ISR misses flag clear and loops forever | Run with --record trace/ and inspect repeated IRQ entry timestamps in the JSONL trace. |