# squadracorsepolito/scanner architecture

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

- Interactive diagram: https://gitdiagram.com/squadracorsepolito/scanner
- Repository: https://github.com/squadracorsepolito/scanner

## Overview

SCanner is STM32H743 firmware for capturing vehicle CAN traffic, providing live telemetry, and retaining logs for later analysis. The documented user flow is to connect the device to the vehicle bus, power it on, then access live data with Cannelloni or retrieve stored logs. The main source excerpt confirms peripheral initialization and scheduler startup; README statements support the product-level data flows. Task-level CAN handling and logging details are not shown, so those internal connections are left unverified.

Main entry points: [`Core/Src/main.c`](https://github.com/squadracorsepolito/scanner/blob/master/Core/Src/main.c) (Firmware startup), [`Core/Src`](https://github.com/squadracorsepolito/scanner/tree/master/Core/Src) (CAN acquisition), [`LWIP/App/lwip.c`](https://github.com/squadracorsepolito/scanner/blob/master/LWIP/App/lwip.c) (Network stack), [`FATFS/App/fatfs.c`](https://github.com/squadracorsepolito/scanner/blob/master/FATFS/App/fatfs.c) (Filesystem)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Firmware runtime"]
  node_main["Firmware startup<br/>[main.c]"]
  node_rtos["RTOS tasks<br/>[freertos.c]"]
end

subgraph group_capture["CAN capture"]
  node_can["FDCAN interface<br/>[fdcan.c]"]
  node_can_ingest["CAN acquisition"]
end

subgraph group_network["Live telemetry"]
  node_telemetry["Live telemetry"]
  node_lwip_init["Network stack<br/>[lwip.c]"]
  node_eth_if["Ethernet interface<br/>[ethernetif.c]"]
  node_phy["LAN8742 PHY<br/>[lan8742.c]"]
end

subgraph group_storage["Blackbox storage"]
  node_logger["CAN logger"]
  node_fatfs["Filesystem<br/>[fatfs.c]"]
  node_sdio["SD card I/O<br/>[sd_diskio.c]"]
  node_sd[("SD-card storage")]
end

node_vehicle(("Vehicle CAN bus"))
node_operator(("Telemetry client"))

node_main -->|"initializes"| node_can
node_main -->|"starts scheduler"| node_rtos
node_main -->|"initializes"| node_lwip_init
node_main -->|"initializes"| node_fatfs
node_vehicle -.->|"supplies CAN traffic"| node_can_ingest
node_can_ingest -.->|"reads frames"| node_can
node_can_ingest -.->|"records traffic"| node_logger
node_can_ingest -.->|"provides live data"| node_telemetry
node_telemetry -.->|"uses network stack"| node_lwip_init
node_lwip_init -->|"configures interface"| node_eth_if
node_eth_if -->|"controls PHY"| node_phy
node_telemetry -.->|"serves live data"| node_operator
node_logger -.->|"writes logs"| node_fatfs
node_fatfs -->|"uses disk I/O"| node_sdio
node_sdio -.->|"writes files"| node_sd

click node_main "https://github.com/squadracorsepolito/scanner/blob/master/Core/Src/main.c"
click node_rtos "https://github.com/squadracorsepolito/scanner/blob/master/Core/Src/freertos.c"
click node_can "https://github.com/squadracorsepolito/scanner/blob/master/Core/Src/fdcan.c"
click node_can_ingest "https://github.com/squadracorsepolito/scanner/tree/master/Core/Src"
click node_telemetry "https://github.com/squadracorsepolito/scanner/tree/master/Core/Src"
click node_lwip_init "https://github.com/squadracorsepolito/scanner/blob/master/LWIP/App/lwip.c"
click node_eth_if "https://github.com/squadracorsepolito/scanner/blob/master/LWIP/Target/ethernetif.c"
click node_phy "https://github.com/squadracorsepolito/scanner/blob/master/Drivers/BSP/Components/lan8742/lan8742.c"
click node_logger "https://github.com/squadracorsepolito/scanner/tree/master/Core/Src"
click node_fatfs "https://github.com/squadracorsepolito/scanner/blob/master/FATFS/App/fatfs.c"
click node_sdio "https://github.com/squadracorsepolito/scanner/blob/master/FATFS/Target/sd_diskio.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_main,node_rtos,node_operator toneBlue
class node_can,node_can_ingest toneAmber
class node_telemetry,node_lwip_init,node_eth_if,node_phy toneMint
class node_logger,node_fatfs,node_sdio,node_sd toneRose
class node_vehicle toneIndigo
```

## Components

### Firmware runtime

- [Firmware startup](https://github.com/squadracorsepolito/scanner/blob/master/Core/Src/main.c): `Core/Src/main.c`
- [RTOS tasks](https://github.com/squadracorsepolito/scanner/blob/master/Core/Src/freertos.c): `Core/Src/freertos.c`

### CAN capture

- [FDCAN interface](https://github.com/squadracorsepolito/scanner/blob/master/Core/Src/fdcan.c): `Core/Src/fdcan.c`
- [CAN acquisition](https://github.com/squadracorsepolito/scanner/tree/master/Core/Src): `Core/Src`

### Live telemetry

- [Live telemetry](https://github.com/squadracorsepolito/scanner/tree/master/Core/Src): `Core/Src`
- [Network stack](https://github.com/squadracorsepolito/scanner/blob/master/LWIP/App/lwip.c): `LWIP/App/lwip.c`
- [Ethernet interface](https://github.com/squadracorsepolito/scanner/blob/master/LWIP/Target/ethernetif.c): `LWIP/Target/ethernetif.c`
- [LAN8742 PHY](https://github.com/squadracorsepolito/scanner/blob/master/Drivers/BSP/Components/lan8742/lan8742.c): `Drivers/BSP/Components/lan8742/lan8742.c`

### Blackbox storage

- [CAN logger](https://github.com/squadracorsepolito/scanner/tree/master/Core/Src): `Core/Src`
- [Filesystem](https://github.com/squadracorsepolito/scanner/blob/master/FATFS/App/fatfs.c): `FATFS/App/fatfs.c`
- [SD card I/O](https://github.com/squadracorsepolito/scanner/blob/master/FATFS/Target/sd_diskio.c): `FATFS/Target/sd_diskio.c`
- **SD-card storage**

### Other components

- **Vehicle CAN bus**
- **Telemetry client**

## Connections

- Firmware startup → FDCAN interface: initializes (evidence: `Core/Src/main.c`)
- Firmware startup → RTOS tasks: starts scheduler (evidence: `Core/Src/main.c`)
- Firmware startup → Network stack: initializes
- Firmware startup → Filesystem: initializes
- Vehicle CAN bus → CAN acquisition: supplies CAN traffic
- CAN acquisition → FDCAN interface: reads frames
- CAN acquisition → CAN logger: records traffic
- CAN acquisition → Live telemetry: provides live data
- Live telemetry → Network stack: uses network stack
- Network stack → Ethernet interface: configures interface (evidence: `LWIP/App/lwip.c`)
- Ethernet interface → LAN8742 PHY: controls PHY (evidence: `LWIP/Target/ethernetif.c`)
- Live telemetry → Telemetry client: serves live data
- CAN logger → Filesystem: writes logs
- Filesystem → SD card I/O: uses disk I/O
- SD card I/O → SD-card storage: writes files
