# souhaattia/can-bus-stm32 architecture

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

- Interactive diagram: https://gitdiagram.com/souhaattia/can-bus-stm32
- Repository: https://github.com/souhaattia/can-bus-stm32

## Overview

This is a five-node STM32 automotive-style CAN network with a Python/PyQt5 dashboard on each PC. The main workflow is dashboard commands over UART to a node, then CAN commands broadcast on the bus; CAN telemetry is also bridged back to the dashboard for live display. Firmware responsibilities below share the sampled main.c implementation; the dashboard is represented by its sampled Python file. The README documents the multi-node network and monitoring capabilities, but unsampled code limits detail about their implementation.

Main entry points: [`Core/Src/main.c`](https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c) (Node Runtime), [`Dashboard/interface2.py`](https://github.com/souhaattia/can-bus-stm32/blob/main/Dashboard/interface2.py) (Dashboard UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["STM32 Firmware"]
  node_node_runtime["Node Runtime<br/>[main.c]"]
  node_periodic_tx["Periodic CAN TX<br/>[main.c]"]
  node_can_rx["CAN Reception<br/>[main.c]"]
  node_uart_bridge["UART Bridge<br/>[main.c]"]
  node_uart_parser["UART Parser<br/>[main.c]"]
  node_command_handler["Command Handler<br/>[main.c]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_app["Dashboard UI<br/>[interface2.py]"]
  node_serial_reader["Serial Reader<br/>[interface2.py]"]
end

subgraph group_network["CAN Network"]
  node_can_bus{{"Shared CAN Bus"}}
  node_other_nodes(("Other STM32 Nodes"))
end

subgraph group_monitoring["Bus Monitoring"]
  node_pcan["PEAK-CAN View"]
  node_saleae["Saleae Logic"]
end

node_user(("Operator"))

node_user -->|"clicks commands"| node_dashboard_app
node_dashboard_app -->|"sends UART commands"| node_node_runtime
node_node_runtime -->|"emits periodically"| node_periodic_tx
node_periodic_tx -->|"transmits frames"| node_can_bus
node_other_nodes -->|"share frames"| node_can_bus
node_can_bus -->|"delivers frames"| node_can_rx
node_can_rx -->|"relays received frames"| node_uart_bridge
node_uart_bridge -->|"sends UART frames"| node_serial_reader
node_serial_reader -.->|"feeds live display"| node_dashboard_app
node_node_runtime -->|"starts byte reception"| node_uart_parser
node_uart_parser -->|"dispatches complete frames"| node_command_handler
node_command_handler -->|"transmits command frames"| node_can_bus
node_can_bus -.->|"monitored by"| node_pcan
node_can_bus -.->|"analyzed by"| node_saleae

click node_dashboard_app "https://github.com/souhaattia/can-bus-stm32/blob/main/Dashboard/interface2.py"
click node_serial_reader "https://github.com/souhaattia/can-bus-stm32/blob/main/Dashboard/interface2.py"
click node_node_runtime "https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c"
click node_periodic_tx "https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c"
click node_can_rx "https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c"
click node_uart_bridge "https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c"
click node_uart_parser "https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c"
click node_command_handler "https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c"

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_node_runtime,node_periodic_tx,node_can_rx,node_uart_bridge,node_uart_parser,node_command_handler toneBlue
class node_dashboard_app,node_serial_reader toneAmber
class node_can_bus,node_other_nodes toneMint
class node_pcan,node_saleae toneRose
class node_user toneIndigo
```

## Components

### STM32 Firmware

- [Node Runtime](https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c): `Core/Src/main.c`
- [Periodic CAN TX](https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c): `Core/Src/main.c`
- [CAN Reception](https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c): `Core/Src/main.c`
- [UART Bridge](https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c): `Core/Src/main.c`
- [UART Parser](https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c): `Core/Src/main.c`
- [Command Handler](https://github.com/souhaattia/can-bus-stm32/blob/main/Core/Src/main.c): `Core/Src/main.c`

### Dashboard

- [Dashboard UI](https://github.com/souhaattia/can-bus-stm32/blob/main/Dashboard/interface2.py): `Dashboard/interface2.py`
- [Serial Reader](https://github.com/souhaattia/can-bus-stm32/blob/main/Dashboard/interface2.py): `Dashboard/interface2.py`

### CAN Network

- **Shared CAN Bus**
- **Other STM32 Nodes**

### Bus Monitoring

- **PEAK-CAN View**
- **Saleae Logic**

### Other components

- **Operator**

## Connections

- Operator → Dashboard UI: clicks commands (evidence: `Dashboard/interface2.py`)
- Dashboard UI → Node Runtime: sends UART commands (evidence: `README.md`)
- Node Runtime → Periodic CAN TX: emits periodically (evidence: `Core/Src/main.c`)
- Periodic CAN TX → Shared CAN Bus: transmits frames (evidence: `README.md`)
- Other STM32 Nodes → Shared CAN Bus: share frames (evidence: `README.md`)
- Shared CAN Bus → CAN Reception: delivers frames (evidence: `README.md`)
- CAN Reception → UART Bridge: relays received frames (evidence: `Core/Src/main.c`)
- UART Bridge → Serial Reader: sends UART frames (evidence: `README.md`)
- Serial Reader → Dashboard UI: feeds live display (evidence: `Dashboard/interface2.py`)
- Node Runtime → UART Parser: starts byte reception (evidence: `Core/Src/main.c`)
- UART Parser → Command Handler: dispatches complete frames (evidence: `Core/Src/main.c`)
- Command Handler → Shared CAN Bus: transmits command frames (evidence: `Core/Src/main.c`)
- Shared CAN Bus → PEAK-CAN View: monitored by (evidence: `README.md`)
- Shared CAN Bus → Saleae Logic: analyzed by (evidence: `README.md`)
