# erikkaashoek/tinysa architecture

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

- Interactive diagram: https://gitdiagram.com/erikkaashoek/tinysa
- Repository: https://github.com/erikkaashoek/tinysa

## Overview

tinySA is standalone handheld spectrum-analyzer firmware. Its central workflow is configuring a sweep, acquiring RF measurements, and presenting results through the device UI and plots. The repository also contains storage/USB support, firmware updating, and MCU-specific ADC implementations. The source index confirms several module references, but many implementation files were not sampled; uncertain runtime wiring is therefore omitted. SD-card updating and the instrument’s standalone LCD workflow are documented in the README.

Main entry points: [`FatFs/ff.c`](https://github.com/erikkaashoek/tinysa/blob/main/FatFs/ff.c) (FAT filesystem), [`sa_core.c`](https://github.com/erikkaashoek/tinysa/blob/main/sa_core.c) (Sweep engine), [`main.c`](https://github.com/erikkaashoek/tinysa/blob/main/main.c) (Firmware entry), [`fw_update.c`](https://github.com/erikkaashoek/tinysa/blob/main/fw_update.c) (Firmware updater)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control and UI"]
  node_main["Firmware entry<br/>[main.c]"]
  node_commands["Shell commands<br/>[sa_cmd.c]"]
  node_ui["Menus and input<br/>[ui.c]"]
  node_browser["VNA browser<br/>[vna_browser.c]"]
  node_plot["Spectrum plots<br/>[plot.c]"]
  node_waterfall["Waterfall view<br/>[waterfall.c]"]
end

subgraph group_measurement["RF Measurement"]
  node_sweep["Sweep engine<br/>[sa_core.c]"]
  node_radio["RF transceiver<br/>[si4468.c]"]
  node_radio_cmd["Radio command definitions<br/>[si446x_cmd.h]"]
end

subgraph group_hardware["Device Hardware"]
  node_adc_f072["F072 ADC<br/>[adc.c]"]
  node_adc_f303["F303 ADC<br/>[adc.c]"]
end

subgraph group_storage["Storage and Updates"]
  node_filesystem["FAT filesystem<br/>[ff.c]"]
  node_disk["Disk interface<br/>[diskio.c]"]
  node_usb_storage["USB mass storage<br/>[usb_msc.c]"]
  node_updater["Firmware updater<br/>[fw_update.c]"]
end

subgraph group_companions["Companion Software"]
  node_python_tool["Python companion<br/>[nanovna.py]"]
end

node_operator(("Instrument operator"))
node_sd_card[("SD card")]
node_display["LCD display"]
node_pc_user(("PC user"))

node_main -->|"references"| node_sweep
node_main -->|"references"| node_commands
node_ui -->|"names"| node_browser
node_sweep -->|"uses driver"| node_radio
node_radio -->|"uses definitions"| node_radio_cmd
node_filesystem -->|"issues disk I/O"| node_disk
node_operator -->|"views instrument"| node_display
node_operator -.->|"operates menus"| node_ui
node_sweep -.->|"presents sweep"| node_plot
node_plot -->|"references"| node_waterfall
node_filesystem -.->|"reads and writes"| node_sd_card
node_usb_storage -.->|"exposes files"| node_filesystem
node_updater -.->|"loads update file"| node_filesystem
node_updater -->|"installs from"| node_sd_card
node_pc_user -.->|"uses"| node_python_tool

click node_main "https://github.com/erikkaashoek/tinysa/blob/main/main.c"
click node_commands "https://github.com/erikkaashoek/tinysa/blob/main/sa_cmd.c"
click node_ui "https://github.com/erikkaashoek/tinysa/blob/main/ui.c"
click node_browser "https://github.com/erikkaashoek/tinysa/blob/main/vna_browser.c"
click node_plot "https://github.com/erikkaashoek/tinysa/blob/main/plot.c"
click node_waterfall "https://github.com/erikkaashoek/tinysa/blob/main/waterfall.c"
click node_sweep "https://github.com/erikkaashoek/tinysa/blob/main/sa_core.c"
click node_radio "https://github.com/erikkaashoek/tinysa/blob/main/si4468.c"
click node_radio_cmd "https://github.com/erikkaashoek/tinysa/blob/main/si446x_cmd.h"
click node_adc_f072 "https://github.com/erikkaashoek/tinysa/blob/main/NANOVNA_STM32_F072/adc.c"
click node_adc_f303 "https://github.com/erikkaashoek/tinysa/blob/main/NANOVNA_STM32_F303/adc.c"
click node_filesystem "https://github.com/erikkaashoek/tinysa/blob/main/FatFs/ff.c"
click node_disk "https://github.com/erikkaashoek/tinysa/blob/main/FatFs/diskio.c"
click node_usb_storage "https://github.com/erikkaashoek/tinysa/blob/main/usb_msc.c"
click node_updater "https://github.com/erikkaashoek/tinysa/blob/main/fw_update.c"
click node_python_tool "https://github.com/erikkaashoek/tinysa/blob/main/python/nanovna.py"

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_commands,node_ui,node_browser,node_plot,node_waterfall,node_pc_user toneBlue
class node_sweep,node_radio,node_radio_cmd,node_sd_card toneAmber
class node_adc_f072,node_adc_f303 toneMint
class node_filesystem,node_disk,node_usb_storage,node_updater toneRose
class node_python_tool,node_operator,node_display toneIndigo
```

## Components

### Control and UI

- [Firmware entry](https://github.com/erikkaashoek/tinysa/blob/main/main.c): `main.c`
- [Shell commands](https://github.com/erikkaashoek/tinysa/blob/main/sa_cmd.c): `sa_cmd.c`
- [Menus and input](https://github.com/erikkaashoek/tinysa/blob/main/ui.c): `ui.c`
- [VNA browser](https://github.com/erikkaashoek/tinysa/blob/main/vna_browser.c): `vna_browser.c`
- [Spectrum plots](https://github.com/erikkaashoek/tinysa/blob/main/plot.c): `plot.c`
- [Waterfall view](https://github.com/erikkaashoek/tinysa/blob/main/waterfall.c): `waterfall.c`

### RF Measurement

- [Sweep engine](https://github.com/erikkaashoek/tinysa/blob/main/sa_core.c): `sa_core.c`
- [RF transceiver](https://github.com/erikkaashoek/tinysa/blob/main/si4468.c): `si4468.c`
- [Radio command definitions](https://github.com/erikkaashoek/tinysa/blob/main/si446x_cmd.h): `si446x_cmd.h`

### Device Hardware

- [F072 ADC](https://github.com/erikkaashoek/tinysa/blob/main/NANOVNA_STM32_F072/adc.c): `NANOVNA_STM32_F072/adc.c`
- [F303 ADC](https://github.com/erikkaashoek/tinysa/blob/main/NANOVNA_STM32_F303/adc.c): `NANOVNA_STM32_F303/adc.c`

### Storage and Updates

- [FAT filesystem](https://github.com/erikkaashoek/tinysa/blob/main/FatFs/ff.c): `FatFs/ff.c`
- [Disk interface](https://github.com/erikkaashoek/tinysa/blob/main/FatFs/diskio.c): `FatFs/diskio.c`
- [USB mass storage](https://github.com/erikkaashoek/tinysa/blob/main/usb_msc.c): `usb_msc.c`
- [Firmware updater](https://github.com/erikkaashoek/tinysa/blob/main/fw_update.c): `fw_update.c`

### Companion Software

- [Python companion](https://github.com/erikkaashoek/tinysa/blob/main/python/nanovna.py): `python/nanovna.py`

### Other components

- **Instrument operator**
- **SD card**
- **LCD display**
- **PC user**

## Connections

- Firmware entry → Sweep engine: references (evidence: `main.c`)
- Firmware entry → Shell commands: references (evidence: `main.c`)
- Menus and input → VNA browser: names (evidence: `ui.c`)
- Sweep engine → RF transceiver: uses driver (evidence: `sa_core.c`)
- RF transceiver → Radio command definitions: uses definitions (evidence: `si4468.c`)
- FAT filesystem → Disk interface: issues disk I/O (evidence: `FatFs/ff.c`)
- Instrument operator → LCD display: views instrument
- Instrument operator → Menus and input: operates menus
- Sweep engine → Spectrum plots: presents sweep
- Spectrum plots → Waterfall view: references (evidence: `plot.c`)
- FAT filesystem → SD card: reads and writes
- USB mass storage → FAT filesystem: exposes files
- Firmware updater → FAT filesystem: loads update file
- Firmware updater → SD card: installs from
- PC user → Python companion: uses
