# sincerelystepper/agriguard-res-reconfigurable-edge-sentinel- architecture

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

- Interactive diagram: https://gitdiagram.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-
- Repository: https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-

## Overview

AgriGuard-RES is an offline agricultural edge-intelligence platform: environmental sensing feeds FPGA signal processing, then STM32 firmware orchestrates power and sends results over a LoRa mesh. The README documents the FPGA-to-host interrupt/SPI handshake and telemetry path, but the corresponding HDL and radio-driver sources are not in the supplied tree. Firmware excerpts show sensor and power-management behavior; the main loop excerpt is empty, so no runtime call from it to those services is asserted.

Main entry points: [`Firmware_MCU/AgriGuard_RES/Core/Src/main.c`](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/Core/Src/main.c) (STM32 host), [`Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c`](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c) (Pipeline orchestration), [`Firmware_MCU/AgriGuard_RES/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h`](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h) (STM32 HAL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Field sensing"]
  node_env_sensors["Environmental sensing<br/>[sensor_pipelines.c]"]
  node_spectral["Spectral crop<br/>[sensor_pipelines.c]"]
  node_soil["Soil Modbus<br/>[sensor_pipelines.c]"]
end

subgraph group_compute["Edge compute"]
  node_fpga["FPGA inference"]
end

subgraph group_firmware["MCU firmware"]
  node_host["STM32 host<br/>[main.c]"]
  node_sensor_pipeline["Pipeline orchestration<br/>[sensor_pipelines.c]"]
  node_power["Power management<br/>[power_manager.c]"]
  node_fpga_config["FPGA configuration<br/>[ice40_config.c]"]
  node_flash[("Flash storage<br/>[flash_driver.c]")]
end

subgraph group_connectivity["Mesh telemetry"]
  node_lora["SX1262 LoRa mesh"]
end

subgraph group_platform["Hardware platform"]
  node_config["Board configuration<br/>[agriguard_config.h]"]
  node_hal["STM32 HAL<br/>[stm32h7xx_hal.h]"]
end

node_field(("Farm environment"))
node_mesh(("Remote mesh peers"))

node_field -->|"provides readings"| node_env_sensors
node_field -->|"provides readings"| node_spectral
node_field -->|"provides readings"| node_soil
node_env_sensors -->|"sends raw streams"| node_fpga
node_fpga -->|"signals interrupt"| node_host
node_host -->|"reads registers"| node_fpga
node_fpga -->|"returns results"| node_host
node_host -->|"forwards telemetry"| node_lora
node_lora -->|"transmits telemetry"| node_mesh
node_host -->|"initializes"| node_hal
node_sensor_pipeline -->|"implements sensor reads"| node_env_sensors
node_sensor_pipeline -->|"implements spectral reads"| node_spectral
node_sensor_pipeline -->|"implements Modbus reads"| node_soil

click node_env_sensors "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c"
click node_spectral "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c"
click node_soil "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c"
click node_host "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/Core/Src/main.c"
click node_sensor_pipeline "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c"
click node_power "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/power_manager.c"
click node_fpga_config "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/ice40_config.c"
click node_flash "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/flash_driver.c"
click node_config "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Inc/agriguard_config.h"
click node_hal "https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h"

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_env_sensors,node_spectral,node_soil toneBlue
class node_fpga toneAmber
class node_host,node_sensor_pipeline,node_power,node_fpga_config,node_flash toneMint
class node_lora toneRose
class node_config,node_hal,node_field,node_mesh toneIndigo
```

## Components

### Field sensing

- [Environmental sensing](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c): `Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c`
- [Spectral crop](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c): `Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c`
- [Soil Modbus](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c): `Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c`

### Edge compute

- **FPGA inference**

### MCU firmware

- [STM32 host](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/Core/Src/main.c): `Firmware_MCU/AgriGuard_RES/Core/Src/main.c`
- [Pipeline orchestration](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c): `Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c`
- [Power management](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/power_manager.c): `Firmware_MCU/AgriGuard_RES/App/Src/power_manager.c`
- [FPGA configuration](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/ice40_config.c): `Firmware_MCU/AgriGuard_RES/App/Src/ice40_config.c`
- [Flash storage](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Src/flash_driver.c): `Firmware_MCU/AgriGuard_RES/App/Src/flash_driver.c`

### Mesh telemetry

- **SX1262 LoRa mesh**

### Hardware platform

- [Board configuration](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/App/Inc/agriguard_config.h): `Firmware_MCU/AgriGuard_RES/App/Inc/agriguard_config.h`
- [STM32 HAL](https://github.com/sincerelystepper/agriguard-res-reconfigurable-edge-sentinel-/blob/main/Firmware_MCU/AgriGuard_RES/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h): `Firmware_MCU/AgriGuard_RES/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h`

### Other components

- **Farm environment**
- **Remote mesh peers**

## Connections

- Farm environment → Environmental sensing: provides readings
- Farm environment → Spectral crop: provides readings
- Farm environment → Soil Modbus: provides readings
- Environmental sensing → FPGA inference: sends raw streams
- FPGA inference → STM32 host: signals interrupt
- STM32 host → FPGA inference: reads registers
- FPGA inference → STM32 host: returns results
- STM32 host → SX1262 LoRa mesh: forwards telemetry
- SX1262 LoRa mesh → Remote mesh peers: transmits telemetry
- STM32 host → STM32 HAL: initializes (evidence: `Firmware_MCU/AgriGuard_RES/Core/Src/main.c`)
- Pipeline orchestration → Environmental sensing: implements sensor reads (evidence: `Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c`)
- Pipeline orchestration → Spectral crop: implements spectral reads (evidence: `Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c`)
- Pipeline orchestration → Soil Modbus: implements Modbus reads (evidence: `Firmware_MCU/AgriGuard_RES/App/Src/sensor_pipelines.c`)
