Skip to content

Conversation

@jrpear
Copy link
Contributor

@jrpear jrpear commented Dec 4, 2025

Add Driver for the S Band Radio

Description

This pull request defines an SBand component which wraps the RadioLib driver for the SX1280 LoRa radio (hereafter the "S band radio"). RadioLib is a popular set of drivers for embedded-friendly radios and it has been added as a submodule in lib/RadioLib. The component implements the Svc.Com interface and produces two telemetry channels: LastRssi and LastSnr.

This pull request also adds an instance sband of the SBand component to our main deployment. The driver interfaces with hardware via F Prime primitives, so the pull request instantiates these hardware dependencies (spiDriver, gpioSbandNrst, gpioSbandRxEn, gpioSbandTxEn, gpioSbandIRQ) and makes the requisite connections. Requisite changes to the devicetree have been made as well.

A ComCcsdsSband subtopology has also been defined and instantiated. It connects the S band radio to the master communication stack via the pre-existing ComSplitter components.

CircuitPython code defining a Uart-to-S-band-radio passthrough to validate the driver has been added. It depends on the PySquared flight software like the existing LoRa passthrough code and it can be found in circuit-python-sband-passthrough).

Finally, the name of the RFMx module has been fixed for the existing LoRa passthrough.

The SBand component uses a polling approach to detect incoming packets. An interrupt-driven design on the pattern of the existing LoRa radio was impossible because the IRQ lines for the S band radio are connected via the MCP23017 GPIO expander, whose interrupt lines are not connected to the MCU.

The SBand component is an active component. This design decision was necessary because the polling handler must be very short to prevent rate-group slippage, but when a packet has arrived, expensive handling is required. When SBand is active, the expensive handling can be deferred off the rate group and onto the component’s own thread.

To sidestep the need for complicated mutex code to prevent concurrent access to the SPI driver, all code touching the hardware runs inside async handlers that are called sequentially by the component’s thread. This includes the IRQ polling operation itself, ensuring that all SPI access is serialized.

These async ports are all internal and are triggered by synchronous external ports. This approach is more complicated than making the external ports async themselves, but it is necessary to check for and avoid queuing duplicate events. Otherwise the RX polling event, triggered at 10 Hz, could overflow the task queue when a heavier task like transmit or receive is running.

Related Issues/Tickets

Closes #24

How Has This Been Tested?

The driver has been manually tested by connecting a GDS instance to board flashed to be a Uart-to-S-band-radio passthrough and validating manually that:

  • Commands sent by the GDS instance via the passthrough are received by the board running ReferenceDeployment
  • Events produced by the board running ReferenceDeployment are received by the GDS instance via the passthrough
  • Telemetry produced by the board running ReferenceDeployment are received by the GDS instance via the passthrough

I made these scripts to ease testing, you might find them useful as well (especially the serial/by-id trick and the --gui-port option:

passthrough-gds.sh
#!/usr/bin/env bash

source fprime-venv/bin/activate
fprime-gds --uart-device $(realpath /dev/serial/by-id/usb-*ProvesKit*-if02) --gui-port 5001
direct-gds.sh
#!/usr/bin/env bash

source fprime-venv/bin/activate
fprime-gds --uart-device $(realpath /dev/serial/by-id/usb-Z*)
screen.sh
#!/usr/bin/env bash

screen /dev/serial/by-id/usb-*ProvesKit*-if00 # PySquared Firmware

Checklist

  • Written detailed sdd with requirements, channels, ports, commands, telemetry defined and correctly formatted and spelled
  • Have written relevant integration tests and have documented them in the sdd
  • Have done a code review with
  • Have tested this PR on every supported board with correct board definitions

Further Notes / Considerations

lib/RadioLib/src/BuildOptUser.h has some debug #defines which can be uncommented to enable RadioLib logging. This was very helpful for debugging.

jrpear and others added 25 commits November 29, 2025 19:38
…ion/proves-core-reference into s-band-working
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the S Band radio by implementing a new SBand component that wraps the RadioLib SX1280 driver and integrates it into the F Prime communication stack. The implementation uses a polling-based approach for packet reception due to hardware limitations (IRQ line connected via GPIO expander with no MCU interrupt connection), and employs an active component design with internal async ports to serialize all SPI access.

Key changes:

  • Adds RadioLib as a git submodule and creates the SBand component with RadioLib HAL integration
  • Implements ComCcsdsSband subtopology connecting S band radio to the communication stack
  • Adds CircuitPython passthrough validation code and updates existing LoRa passthrough module references
  • Configures hardware dependencies (SPI driver, GPIO pins) and updates device tree definitions

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/RadioLib New submodule for RadioLib driver library
lib/fprime-zephyr Updated submodule reference
FprimeZephyrReference/Components/SBand/* New SBand component implementation with RadioLib HAL
FprimeZephyrReference/ComCcsdsSband/* New subtopology for S band communication stack
FprimeZephyrReference/ReferenceDeployment/Top/* Integration of SBand component and subtopology into main deployment
circuit-python-sband-passthrough/* New validation passthrough code for S band radio
circuit-python-lora-passthrough/code.py Fixed RFM9x module import path
circuit-python-lora-passthrough-feather/code.py Fixed RFM9x module import path
boards/bronco_space/proves_flight_control_board_v5/proves_flight_control_board_v5.dtsi Added S band GPIO definitions and SPI chip select configuration
FprimeZephyrReference/project/config/* Updated constants and added ComCcsdsSband configuration
Comments suppressed due to low confidence (4)

circuit-python-sband-passthrough/code.py:1

  • The docstring header mentions 'LoRa Radio forwarder' but this file is for S-band radio passthrough. Update the description to reflect S-band functionality.
    circuit-python-sband-passthrough/code.py:1
  • The docstring describes LoRa packet forwarding and neo pixel color cycling, but this code is for S-band radio. Update the description to accurately reflect what this passthrough does.
    circuit-python-sband-passthrough/code.py:1
  • Log message says 'LoRa Receiver' but this is S-band radio code. Change to '[INFO] S-band Receiver receiving packets'.
    FprimeZephyrReference/Components/SBand/docs/sdd.md:1
  • Change Log table row is malformed on line 62. It should have two columns separated by a single pipe, e.g., '| 2024-XX-XX | Initial Draft |'.
# Components::SBand

Comment on lines +26 to +27
|---|---|

Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Parameters section contains duplicate table header rows (lines 25-26). Remove the duplicate header row on line 26.

Suggested change
|---|---|

Copilot uses AI. Check for mistakes.
## Commands
| Name | Description |
|---|---|
|---|---|
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Commands section contains duplicate table header rows (lines 30-31). Remove the duplicate header row on line 31.

Suggested change
|---|---|

Copilot uses AI. Check for mistakes.

| Name | Description | Output | Coverage |
|---|---|---|---|
|---|---|---|---|
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Unit Tests section contains duplicate table header rows (lines 50-51). Remove the duplicate header row on line 51.

Suggested change
|---|---|---|---|

Copilot uses AI. Check for mistakes.
Add requirements in the chart below
| Name | Description | Validation |
|---|---|---|
|---|---|---|
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Requirements section contains duplicate table header rows (lines 56-57). Remove the duplicate header row on line 57.

Suggested change
|---|---|---|

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[TASK] Bring in an Out of Tree SX128x Driver

4 participants