# damienmaguire/stm32-vcu architecture

> Architecture diagram of the GitHub repository damienmaguire/stm32-vcu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/damienmaguire/stm32-vcu
- Repository: https://github.com/damienmaguire/stm32-vcu

## Overview

ZombieVerter is STM32 firmware for a configurable electric-vehicle conversion VCU. The principal workflow is vehicle signals and driver inputs entering the firmware, which manages drive/precharge behavior and communicates with selected drivetrain, charging, battery, and vehicle systems. The repository supports many interchangeable vehicle-specific implementations; the README documents these capabilities, while only a subset of runtime wiring is visible in the excerpts. Dashed links mark those documented or likely integrations whose exact dispatch is not shown.

Main entry points: [`src/stm32_vcu.cpp`](https://github.com/damienmaguire/stm32-vcu/blob/master/src/stm32_vcu.cpp) (VCU Main Loop), [`src/CANSPI.cpp`](https://github.com/damienmaguire/stm32-vcu/blob/master/src/CANSPI.cpp) (CAN Interface), [`src/throttle.cpp`](https://github.com/damienmaguire/stm32-vcu/blob/master/src/throttle.cpp) (Throttle Control), [`src/iomatrix.cpp`](https://github.com/damienmaguire/stm32-vcu/blob/master/src/iomatrix.cpp) (I/O Mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["VCU Runtime"]
  node_firmware["VCU Main Loop<br/>[stm32_vcu.cpp]"]
end

subgraph group_inputs["Control Inputs"]
  node_throttle["Throttle Control<br/>[throttle.cpp]"]
  node_io_matrix["I/O Mapping<br/>[iomatrix.cpp]"]
  node_temperature["Temperature Sensing<br/>[temp_meas.cpp]"]
end

subgraph group_drive["Vehicle And Drive"]
  node_vehicle_adapters["Vehicle Adapters<br/>[BMW_E39.cpp]"]
  node_toyota_drive["Toyota Hybrid Drive<br/>[GS450H.cpp]"]
  node_leaf_drive["Leaf Inverter<br/>[leafinv.cpp]"]
  node_outlander_drive["Outlander Drive"]
end

subgraph group_energy["Energy Systems"]
  node_battery["Battery / BMS<br/>[leafbms.cpp]"]
  node_charging["Charger Control<br/>[charger.cpp]"]
  node_chademo["CHAdeMO Charging<br/>[chademo.cpp]"]
  node_ccs["CCS Charging<br/>[i3LIM.cpp]"]
  node_foccci["FOCCCI Charging<br/>[Foccci.cpp]"]
end

subgraph group_io["Hardware And CAN"]
  node_can["CAN Interface<br/>[CANSPI.cpp]"]
  node_can_controller["MCP2515 Driver<br/>[MCP2515.cpp]"]
  node_hardware_init["Hardware Initialization<br/>[hwinit.cpp]"]
  node_shunt["ISA Shunt<br/>[isa_shunt.cpp]"]
end

node_driver(("Driver / Vehicle"))

node_driver -.->|"provides inputs"| node_firmware
node_firmware -.->|"runs control"| node_throttle
node_firmware -.->|"reads and sets I/O"| node_io_matrix
node_firmware -.->|"uses sensing"| node_temperature
node_firmware -.->|"selects vehicle"| node_vehicle_adapters
node_firmware -.->|"controls drivetrain"| node_toyota_drive
node_firmware -.->|"supports drivetrain"| node_leaf_drive
node_firmware -.->|"supports drivetrain"| node_outlander_drive
node_firmware -.->|"supports battery"| node_battery
node_firmware -.->|"manages charging"| node_charging
node_firmware -.->|"supports fast charge"| node_chademo
node_firmware -.->|"supports fast charge"| node_ccs
node_firmware -.->|"supports fast charge"| node_foccci
node_firmware -.->|"initializes CAN"| node_can
node_can -.->|"uses controller"| node_can_controller
node_firmware -->|"initializes hardware"| node_hardware_init
node_firmware -->|"initializes shunt"| node_shunt

click node_firmware "https://github.com/damienmaguire/stm32-vcu/blob/master/src/stm32_vcu.cpp"
click node_throttle "https://github.com/damienmaguire/stm32-vcu/blob/master/src/throttle.cpp"
click node_io_matrix "https://github.com/damienmaguire/stm32-vcu/blob/master/src/iomatrix.cpp"
click node_temperature "https://github.com/damienmaguire/stm32-vcu/blob/master/src/temp_meas.cpp"
click node_vehicle_adapters "https://github.com/damienmaguire/stm32-vcu/blob/master/src/BMW_E39.cpp"
click node_toyota_drive "https://github.com/damienmaguire/stm32-vcu/blob/master/src/GS450H.cpp"
click node_leaf_drive "https://github.com/damienmaguire/stm32-vcu/blob/master/src/leafinv.cpp"
click node_outlander_drive "https://github.com/damienmaguire/stm32-vcu/blob/master/src/outlanderinverter.cpp"
click node_battery "https://github.com/damienmaguire/stm32-vcu/blob/master/src/leafbms.cpp"
click node_charging "https://github.com/damienmaguire/stm32-vcu/blob/master/src/charger.cpp"
click node_chademo "https://github.com/damienmaguire/stm32-vcu/blob/master/src/chademo.cpp"
click node_ccs "https://github.com/damienmaguire/stm32-vcu/blob/master/src/i3LIM.cpp"
click node_foccci "https://github.com/damienmaguire/stm32-vcu/blob/master/src/Foccci.cpp"
click node_can "https://github.com/damienmaguire/stm32-vcu/blob/master/src/CANSPI.cpp"
click node_can_controller "https://github.com/damienmaguire/stm32-vcu/blob/master/src/MCP2515.cpp"
click node_hardware_init "https://github.com/damienmaguire/stm32-vcu/blob/master/src/hwinit.cpp"
click node_shunt "https://github.com/damienmaguire/stm32-vcu/blob/master/src/isa_shunt.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_firmware toneBlue
class node_throttle,node_io_matrix,node_temperature toneAmber
class node_vehicle_adapters,node_toyota_drive,node_leaf_drive,node_outlander_drive toneMint
class node_battery,node_charging,node_chademo,node_ccs,node_foccci toneRose
class node_can,node_can_controller,node_hardware_init,node_shunt,node_driver toneIndigo
```

## Components

### VCU Runtime

- [VCU Main Loop](https://github.com/damienmaguire/stm32-vcu/blob/master/src/stm32_vcu.cpp): `src/stm32_vcu.cpp`

### Control Inputs

- [Throttle Control](https://github.com/damienmaguire/stm32-vcu/blob/master/src/throttle.cpp): `src/throttle.cpp`
- [I/O Mapping](https://github.com/damienmaguire/stm32-vcu/blob/master/src/iomatrix.cpp): `src/iomatrix.cpp`
- [Temperature Sensing](https://github.com/damienmaguire/stm32-vcu/blob/master/src/temp_meas.cpp): `src/temp_meas.cpp`

### Vehicle And Drive

- [Vehicle Adapters](https://github.com/damienmaguire/stm32-vcu/blob/master/src/BMW_E39.cpp): `src/BMW_E39.cpp`
- [Toyota Hybrid Drive](https://github.com/damienmaguire/stm32-vcu/blob/master/src/GS450H.cpp): `src/GS450H.cpp`
- [Leaf Inverter](https://github.com/damienmaguire/stm32-vcu/blob/master/src/leafinv.cpp): `src/leafinv.cpp`
- [Outlander Drive](https://github.com/damienmaguire/stm32-vcu/blob/master/src/outlanderinverter.cpp): `src/outlanderinverter.cpp`

### Energy Systems

- [Battery / BMS](https://github.com/damienmaguire/stm32-vcu/blob/master/src/leafbms.cpp): `src/leafbms.cpp`
- [Charger Control](https://github.com/damienmaguire/stm32-vcu/blob/master/src/charger.cpp): `src/charger.cpp`
- [CHAdeMO Charging](https://github.com/damienmaguire/stm32-vcu/blob/master/src/chademo.cpp): `src/chademo.cpp`
- [CCS Charging](https://github.com/damienmaguire/stm32-vcu/blob/master/src/i3LIM.cpp): `src/i3LIM.cpp`
- [FOCCCI Charging](https://github.com/damienmaguire/stm32-vcu/blob/master/src/Foccci.cpp): `src/Foccci.cpp`

### Hardware And CAN

- [CAN Interface](https://github.com/damienmaguire/stm32-vcu/blob/master/src/CANSPI.cpp): `src/CANSPI.cpp`
- [MCP2515 Driver](https://github.com/damienmaguire/stm32-vcu/blob/master/src/MCP2515.cpp): `src/MCP2515.cpp`
- [Hardware Initialization](https://github.com/damienmaguire/stm32-vcu/blob/master/src/hwinit.cpp): `src/hwinit.cpp`
- [ISA Shunt](https://github.com/damienmaguire/stm32-vcu/blob/master/src/isa_shunt.cpp): `src/isa_shunt.cpp`

### Other components

- **Driver / Vehicle**

## Connections

- Driver / Vehicle → VCU Main Loop: provides inputs
- VCU Main Loop → Throttle Control: runs control
- VCU Main Loop → I/O Mapping: reads and sets I/O
- VCU Main Loop → Temperature Sensing: uses sensing
- VCU Main Loop → Vehicle Adapters: selects vehicle
- VCU Main Loop → Toyota Hybrid Drive: controls drivetrain
- VCU Main Loop → Leaf Inverter: supports drivetrain
- VCU Main Loop → Outlander Drive: supports drivetrain
- VCU Main Loop → Battery / BMS: supports battery
- VCU Main Loop → Charger Control: manages charging
- VCU Main Loop → CHAdeMO Charging: supports fast charge
- VCU Main Loop → CCS Charging: supports fast charge
- VCU Main Loop → FOCCCI Charging: supports fast charge
- VCU Main Loop → CAN Interface: initializes CAN
- CAN Interface → MCP2515 Driver: uses controller (evidence: `src/CANSPI.cpp`)
- VCU Main Loop → Hardware Initialization: initializes hardware (evidence: `src/stm32_vcu.cpp`)
- VCU Main Loop → ISA Shunt: initializes shunt (evidence: `src/stm32_vcu.cpp`)
