Skip to content

Verify RF encoding and support individual/bulk CAN updates - #2

Merged
seofernando25 merged 10 commits into
mainfrom
fix/rf-serial-command-contract
Aug 4, 2026
Merged

Verify RF encoding and support individual/bulk CAN updates#2
seofernando25 merged 10 commits into
mainfrom
fix/rf-serial-command-contract

Conversation

@seofernando25

@seofernando25 seofernando25 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Verify PE44820 and F0480 serial encoding against the datasheets.
  • Use the calibrated 2.4 GHz PE44820 enum and familiar CANDev RF helper names.
  • Support individual and four-channel RF updates.
  • Keep safe transitions, replay protection, SPI timeouts, and ACK limits.
  • Organize firmware by CAN, RF, and platform responsibility.
  • Consolidate the former PR Align RF helpers with CANDev API #4 work here.

Protocol 2.1

DLC selects individual or bulk mode:

SET_PHASE     [state, channel] | [PS1, PS2, PS3, PS4]
SET_VGA       [atten, channel] | [VGA1, VGA2, VGA3, VGA4]
SET_COMBINED  [state, channel, atten] | [PS1..PS4, VGA1..VGA4]
ENTER_SAFE    [channel]
PING          []

Command DLCs are exact. Channels are 0..3; PE44820 addresses are 1..4.

PING returns:

[major, minor, patch, node, health, rx_dropped, tx_dropped, invalid_commands]

Version matching is exact. There are no legacy formats, fallbacks, padding compatibility, capability negotiation, or deprecated APIs.

API

Bulk:

  • set_phase()
  • set_vga()
  • set_combined()

Individual:

  • set_phase_channel()
  • set_vga_channel()
  • set_combined_channel()

beamctl accepts either --state/--attenuation/--channel or --states/--attenuations.

RF encoding

  • Phase state is a logical index into the calibrated enum.
  • Enum values are nine-bit C2x literals: OPT + D7:D0.
  • MakePSCommand() packs the calibrated word and PE44820 address into 13 bits.
  • F0480 attenuation 0..23 dB is attenuation_db << 2.
  • ACK confirms STM32 validation and SPI completion, not RF-device readback.

The software preserves each F0480 channel. The checked-in board map identifies SPI1 and PA4 CS but not the final four-device selector nets; no GPIOs are guessed.

Firmware layout

stm32/app/src/
├── can/       bxCAN transport, filters, codec, queues, runtime
├── rf/        serial commands, safe planner, executor, RF drivers
├── platform/  board map, clock, time, watchdog, faults, diagnostics
└── main.c     startup and service loop
  • Startup and CAN commands share the RF planner/executor.
  • Board pins are centralized in platform/board.h.
  • RF limits are separate from the generated 2.4 GHz phase table.
  • CAN filter internals are private to the CAN module.
  • Bench code and captured media are under stm32/bringup/.
  • Generated native-test binaries are no longer tracked.
  • Native test names mirror the production modules.

Five small Mermaid diagrams cover system topology, command flow, RF execution, simulation, and firmware modules. Exact payloads and validation procedures remain text or tables.

Issues

Closes #1
Closes #3

Validation

  • make check
  • 91 Python tests
  • all native STM32 tests
  • 11 shared command vectors
  • strict C2x ARM firmware build
  • CAN smoke-tool tests
  • Docker + SocketCAN + Renode E2E
  • individual and bulk RF writes verified
  • five Mermaid diagrams parsed with Mermaid CLI
  • Markdown links and git diff --check

@seofernando25 seofernando25 changed the title Verify RF serial command encoding and ACK semantics Verify calibrated RF serial command encoding Aug 3, 2026
@seofernando25
seofernando25 requested a review from etarabey August 3, 2026 19:23
@seofernando25 seofernando25 changed the title Verify calibrated RF serial command encoding Verify RF serial encoding and add bulk CAN API Aug 4, 2026
@seofernando25 seofernando25 changed the title Verify RF serial encoding and add bulk CAN API Verify RF encoding and support individual/bulk CAN updates Aug 4, 2026
@seofernando25
seofernando25 merged commit 8c9c882 into main Aug 4, 2026
5 checks passed
@seofernando25
seofernando25 deleted the fix/rf-serial-command-contract branch August 4, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correct enum to be 9-bit phase words instead of 8-bit Modify CAN Payload to match what we have in stm32-beamforming repo

1 participant