Automotive & Robotics Buses

# CAN bus firmware simulator.

Wire multi-ECU STM32, NXP FlexCAN, and Teensy boards over CAN and CAN FD without physical transceivers. Inspect DBC-decoded frames, inject ACK and bus-off faults, and run deterministic regression tests in CI.

[Start now](https://app.circuittwin.ai/try) [CAN bit timing calculator](https://circuittwin.ai/tools/can-bit-timing-calculator)

## SocketCAN vs physical benches vs CircuitTwin.

Test real peripheral registers, filter banks, and error-passive transitions before hardware arrives.

| Option                            | Firmware executed                                       | Bit timing & registers                              | Fault testing                                                  |
| --------------------------------- | ------------------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------- |
| Linux SocketCAN (vcan)            | Host Linux processes only                               | No MCU bit timing or bxCAN/FlexCAN registers        | No physical ACK or bus-off controller state machine            |
| Physical CAN bench + USB adapters | Real flashed boards                                     | Real hardware timing, manual cabling                | Requires relay rigs; hard to automate in parallel CI           |
| CircuitTwin CAN Simulator         | Real STM32, NXP, Teensy, and multi-ECU ELF/HEX binaries | Register-level bxCAN, FDCAN, and FlexCAN bit timing | Scripted bus shorts, missing ACK, bus-off recovery, DBC decode |

## Multi-ECU CAN FD scene in YAML.

Define ECUs, bitrate, DBC file, and timed fault injection in one version-controlled file.

Run the scene locally or in CI with `ct scene run` to verify arbitration, acceptance filter masks, and bus-off recovery across every commit.

scenes/dual-ecu-canfd.yaml

scene: dual-ecu-canfd
nodes:
  - id: motor-ecu
    board: nucleo-f767zi
    firmware: build/motor-controller.elf
  - id: bms-ecu
    board: stm32g474-nucleo
    firmware: build/bms.elf
buses:
  - name: can0
    protocol: can_fd
    bitrate: 500000
    data_bitrate: 2000000
    dbc: specs/powertrain.dbc
    members: [motor-ecu.CAN1, bms-ecu.FDCAN1]
faults:
  - at_ms: 600
    target: can0
    kind: ack_drop
    duration_ms: 80

`ct scene run --json scenes/dual-ecu-canfd.yaml --record can-trace/`

## Common questions.

**Can I simulate multiple STM32 or NXP ECUs talking over CAN and CAN FD?**

Yes. Wire two or more microcontroller twins together on a shared CAN or CAN FD bus in the browser editor or a YAML scene file. CircuitTwin runs all nodes in lock-step virtual time across STM32 bxCAN/FDCAN, NXP S32K/i.MX RT FlexCAN, and Teensy controllers.

**Does CircuitTwin support DBC signal decoding and bus-off fault injection?**

Yes. Attach your DBC file to decode live CAN frames in the bus monitor or JSON traces, and inject missing ACK errors, bit flips, bus shorts, or node disconnects to verify TEC/REC error counters and bus-off recovery logic.

**Do I need physical CAN transceivers or USB-CAN dongles?**

No. You can wire MCU CAN pins directly or include transceiver twins such as SN65HVD230 or TJA1051 in your scene, then run everything locally on Windows, macOS, Linux, or inside GitHub Actions.

**Can I test CANopen, J1939, or UDS diagnostic stacks?**

Yes. Because CircuitTwin runs your compiled firmware binary and transfers real CAN frames across virtual transceivers, CANopenNode, J1939, ISO-TP, and UDS stacks work without modifying protocol code.

## Related guides.

Virtual HIL (vHIL) Simulator Combine multi-ECU CAN networks with FMI plant models and CI fault matrices. [Explore vHIL →](https://circuittwin.ai/virtual-hil-simulator)

STM32 Simulator Online & CLI Run STM32F4, F7, H7, and G4 binaries with bxCAN and FDCAN peripheral checks. [Read STM32 guide →](https://circuittwin.ai/stm32-simulator)

CAN Bit Timing Calculator Compute prescaler, BS1, BS2, and SJW values for STM32 and NXP CAN controllers. [Open calculator →](https://circuittwin.ai/tools/can-bit-timing-calculator)

Altium Firmware Simulation Import your Altium PCB netlist with transceivers and test real CAN firmware. [Read Altium guide →](https://circuittwin.ai/altium-firmware-simulation)
