# sp5wwp/m17_anl architecture

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

- Interactive diagram: https://gitdiagram.com/sp5wwp/m17_anl
- Repository: https://github.com/sp5wwp/m17_anl

## Overview

M17_ANL is a half-duplex M17 radio analyser: a host sends AT commands over UART, firmware configures the radio and sends or receives 93-byte frames, and Linux software reads received frames for display or optional voice playback. The Linux entry point initializes Codec2; the repository also contains Codec2, OFDM, and quantization modules. Firmware and Linux source excerpts are partial, so links between unsampled signal-processing modules are not asserted.

Main entry points: [`firmware/Src/main.c`](https://github.com/sp5wwp/m17_anl/blob/master/firmware/Src/main.c) (Radio application), [`linux/main.c`](https://github.com/sp5wwp/m17_anl/blob/master/linux/main.c) (Serial analyser), [`firmware/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c`](https://github.com/sp5wwp/m17_anl/blob/master/firmware/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c) (STM32 HAL), [`firmware/Inc/radio_config.h`](https://github.com/sp5wwp/m17_anl/blob/master/firmware/Inc/radio_config.h) (Radio settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Radio firmware"]
  node_firmware_app["Radio application<br/>[main.c]"]
  node_radio_config["Radio settings<br/>[radio_config.h]"]
end

subgraph group_hal["MCU hardware layer"]
  node_stm32_hal["STM32 HAL<br/>[stm32l0xx_hal.c]"]
  node_device_layer["STM32 device layer<br/>[stm32l011xx.h]"]
end

subgraph group_linux["Linux analyser"]
  node_linux_cli["Serial analyser<br/>[main.c]"]
end

subgraph group_codec["Signal processing"]
  node_codec2["Codec2 codec<br/>[codec2.c]"]
  node_ofdm["OFDM processing<br/>[ofdm.c]"]
  node_quantise["Audio quantization<br/>[quantise.c]"]
  node_codec_data["Codec codebooks"]
end

node_host(("Serial host"))
node_rf(("Radio link"))

node_host -->|"sends AT commands"| node_firmware_app
node_firmware_app -->|"returns frames"| node_host
node_firmware_app -->|"uses settings"| node_radio_config
node_firmware_app -->|"calls HAL"| node_stm32_hal
node_stm32_hal -.->|"accesses registers"| node_device_layer
node_firmware_app -->|"sends and receives"| node_rf
node_linux_cli -->|"reads UART frames"| node_host
node_linux_cli -->|"initializes codec"| node_codec2

click node_firmware_app "https://github.com/sp5wwp/m17_anl/blob/master/firmware/Src/main.c"
click node_radio_config "https://github.com/sp5wwp/m17_anl/blob/master/firmware/Inc/radio_config.h"
click node_stm32_hal "https://github.com/sp5wwp/m17_anl/blob/master/firmware/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c"
click node_device_layer "https://github.com/sp5wwp/m17_anl/blob/master/firmware/Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h"
click node_linux_cli "https://github.com/sp5wwp/m17_anl/blob/master/linux/main.c"
click node_codec2 "https://github.com/sp5wwp/m17_anl/blob/master/linux/codec2.c"
click node_ofdm "https://github.com/sp5wwp/m17_anl/blob/master/linux/ofdm.c"
click node_quantise "https://github.com/sp5wwp/m17_anl/blob/master/linux/quantise.c"
click node_codec_data "https://github.com/sp5wwp/m17_anl/tree/master/linux"

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_app,node_radio_config toneBlue
class node_stm32_hal,node_device_layer toneAmber
class node_linux_cli toneMint
class node_codec2,node_ofdm,node_quantise,node_codec_data toneRose
class node_host,node_rf toneIndigo
```

## Components

### Radio firmware

- [Radio application](https://github.com/sp5wwp/m17_anl/blob/master/firmware/Src/main.c): `firmware/Src/main.c`
- [Radio settings](https://github.com/sp5wwp/m17_anl/blob/master/firmware/Inc/radio_config.h): `firmware/Inc/radio_config.h`

### MCU hardware layer

- [STM32 HAL](https://github.com/sp5wwp/m17_anl/blob/master/firmware/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c): `firmware/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c`
- [STM32 device layer](https://github.com/sp5wwp/m17_anl/blob/master/firmware/Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h): `firmware/Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h`

### Linux analyser

- [Serial analyser](https://github.com/sp5wwp/m17_anl/blob/master/linux/main.c): `linux/main.c`

### Signal processing

- [Codec2 codec](https://github.com/sp5wwp/m17_anl/blob/master/linux/codec2.c): `linux/codec2.c`
- [OFDM processing](https://github.com/sp5wwp/m17_anl/blob/master/linux/ofdm.c): `linux/ofdm.c`
- [Audio quantization](https://github.com/sp5wwp/m17_anl/blob/master/linux/quantise.c): `linux/quantise.c`
- [Codec codebooks](https://github.com/sp5wwp/m17_anl/tree/master/linux): `linux`

### Other components

- **Serial host**
- **Radio link**

## Connections

- Serial host → Radio application: sends AT commands
- Radio application → Serial host: returns frames
- Radio application → Radio settings: uses settings (evidence: `firmware/Src/main.c`)
- Radio application → STM32 HAL: calls HAL (evidence: `firmware/Src/main.c`)
- STM32 HAL → STM32 device layer: accesses registers
- Radio application → Radio link: sends and receives
- Serial analyser → Serial host: reads UART frames
- Serial analyser → Codec2 codec: initializes codec (evidence: `linux/main.c`)
