MCU Testing & CI

# STM32F103 Blue Pill & NUCLEO-F103RB simulation

Test STM32F103 Cortex-M3 firmware without flashing ST-LINK dongles—backed by passing HAL ADC, DMA, EXTI, I2C, SPI, TIM and UART oracles.

STM32F103 remains ubiquitous in motor controllers, BMS boards and industrial adapters, yet F1 peripherals have quirky AFIO remap bits and I2C1 SMBus errata. Testing the compiled ELF directly catches AFIO remap omissions and DMA channel-mapping errors immediately.

Both blue-pill-f103c8 and nucleo-f103rb are tracked in board-dashboard.json, with 7 of 7 STM32F103 HAL peripheral oracles passing on clean-tree records.

## STM32F103 HAL oracle coverage (nucleo-f103rb)

| Oracle                         | Result             | Instructions retired           |
| ------------------------------ | ------------------ | ------------------------------ |
| stm32f103-hal-adc / dma / exti | PASS (3/3)         | \~12.0M instructions each      |
| stm32f103-hal-i2c / spi        | PASS (2/2)         | \~12.0M instructions each      |
| stm32f103-hal-tim / uart       | PASS (2/2)         | \~12.1M–12.2M instructions     |
| ARMv7-M CPU differential       | PASS (0 disagrees) | Clean-tree differential record |

## Local CLI workflow

Shell — simulate Blue Pill ELF

```
ct run --json --board blue-pill-f103c8 build/bluepill.elf
ct debug --board blue-pill-f103c8 --gdb-port 3333 build/bluepill.elf
```

## Suite & fault configuration

tests/bluepill.suite.yaml

```
version: 1
board: blue-pill-f103c8
firmware: build/bluepill.elf
tests:
  - name: eeprom-write-and-readback
    expect:
      console_contains: "EEPROM_CRC_OK"
      exit_code: 0
  - name: i2c-wrong-address-nack
    faults:
      - at_ms: 40
        bus: I2C1
        kind: nack
        address: 0x50
        count: 1
    expect:
      console_contains: "EEPROM_RETRY_OK"
```

## CI pipeline integration

.github/workflows/bluepill-ci.yml

```
name: STM32F103 CI
on: [push, pull_request]
jobs:
  bluepill:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pio run -e bluepill_f103c8
      - uses: circuittwin/action@v1
        with:
          board: blue-pill-f103c8
          firmware: .pio/build/bluepill_f103c8/firmware.elf
          suite: tests/bluepill.suite.yaml
```

## Troubleshooting checklist

| Symptom                                      | Fix                                                                                                                        |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| No output on PB6/PB7 I2C1 or PA9/PA10 USART1 | On STM32F1, alternate function outputs require GPIO CNF=10 (AF push-pull/open-drain) AND RCC\_APB2ENR.AFIOEN if remapping. |
| bxCAN and USB fail simultaneously            | STM32F103 shares 512 bytes of packet SRAM between USB and CAN1; they cannot run concurrently.                              |
| Flash size overrun on 64 KB C8 vs 128 KB CB  | Check linker script FLASH length (64K for strict C8 compatibility) and verify ELF section headers.                         |
| I2C BUSY flag stuck after reset              | Add a 9-clock SCL recovery pulse before I2C1 init and verify it with a stuck-bus fault test.                               |

## Related boards & component twins

[Board: blue-pill-f103c8](https://circuittwin.ai/boards/blue-pill-f103c8) [Board: nucleo-f103rb](https://circuittwin.ai/boards/nucleo-f103rb) [Twin: MPU-6050](https://circuittwin.ai/twins/mpu-6050) [Twin: AT24C256C](https://circuittwin.ai/twins/at24c256c) [Twin: DS3231](https://circuittwin.ai/twins/ds3231) [Peripheral oracle records](https://circuittwin.ai/docs/accuracy) [GDB debugging](https://circuittwin.ai/docs/ide)

## More in MCU Testing & CI

[STM32F7 firmware CI without a bench](https://circuittwin.ai/guides/stm32f7-firmware-ci) [STM32F4 firmware testing without hardware](https://circuittwin.ai/guides/stm32f4-firmware-testing) [STM32H7 digital twin CI for H743 & H747](https://circuittwin.ai/guides/stm32h7-digital-twin-ci) [Nordic nRF52840 firmware CI without hardware](https://circuittwin.ai/guides/nrf52840-firmware-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)
