|
F439_CPP_TX-RX_LoRa_Project
|
This page describes the high-level firmware architecture of the Nucleo-F439 LoRa TX/RX weather station system.
The firmware is intentionally organized into layered subsystems so that radio transport, protocol framing, application behavior, and hardware interfaces remain cleanly separated.
The architecture emphasizes:
This document serves as the primary architectural reference for the firmware.
The firmware is organized into the following layers:
Application Layer RadioLink Protocol Layer Radio Driver Layer Persistence Layer Hardware Abstraction Layer
Each layer has a clearly defined responsibility and interacts only with the layer immediately below it.
Module:
radioApp
Responsibilities:
The application layer does not construct wire frames directly. Instead it submits messages to the RadioLink protocol layer which handles framing, counters, and replay protection.
This separation ensures that application code remains independent of the specific wire format used on the radio.
Module:
radioLink
Responsibilities:
RadioLink defines the protocol structures used on the wire.
The core structures representing the wire protocol are:
These structures represent the logical model of a transmitted message and are intentionally maintained even when parts of the protocol evolve.
The RadioLink layer is designed to be transport-agnostic.
Although the current system uses LoRa via the SX1262 modem, the protocol layer itself does not depend on that transport. Future transports such as USB or Ethernet could reuse the same framing logic.
Module:
SX1262 driver
Responsibilities:
This layer exposes a hardware-oriented interface for interacting with the radio modem while hiding the details of the SX1262 command set.
The driver does not implement protocol logic and is unaware of RadioLink framing structures.
Module:
MB85RS64B SPI FRAM
Responsibilities:
The firmware uses a minimal write strategy to protect non-volatile memory from excessive wear.
The FRAM device supports multi-byte sequential writes which are used by the firmware through the FRAM_WriteBytes() interface.
Replay protection state is written only when required by the epoch-per-boot replay protection model.
The firmware implements replay protection using a design referred to as the epoch-per-boot model.
TX Node
RX Node
This design minimizes persistent writes while still providing effective replay protection.
The firmware supports both TX and RX roles using the same binary.
The role is determined at runtime using the STM32 unique device ID (UID). The UID is read during startup and used to determine whether the device behaves as a transmitter or receiver.
Compile-time role switching using preprocessor directives is intentionally avoided.
This approach ensures:
The lowest layer of the firmware consists of the STM32 HAL components generated by STM32CubeIDE.
These files provide:
The HAL layer is intentionally excluded from most documentation pages because it is generated code rather than project-specific logic.
The firmware layers interact as follows:
radioApp ↓ radioLink ↓ SX1262 Driver ↓ STM32 HAL
Persistent replay state is stored through the FRAM persistence layer, which is used by the RadioLink protocol implementation.
This layered design ensures that protocol logic, radio hardware control, and application behavior remain cleanly separated and easier to maintain.