|
1 | 1 | # BeamControl |
2 | 2 |
|
3 | | -BeamControl controls a four-channel RF receiver board from a Raspberry Pi 5 over CAN. |
4 | | -The repository contains the Pi software, STM32 firmware, shared protocol tests, deployment |
5 | | -tooling, and hardware notes. |
6 | | - |
7 | | -## Implemented architecture |
8 | | - |
9 | | -```text |
10 | | -Operator / browser / beamctl |
11 | | - | |
12 | | -Raspberry Pi 5 + CAN HAT CAN controller node 0 |
13 | | - | |
14 | | - CAN 2.0 bus |
15 | | - | |
16 | | -STM32 receiver board CAN receiver node 1..30 |
17 | | - |- RF channel 0 |
18 | | - |- RF channel 1 |
19 | | - |- RF channel 2 |
20 | | - `- RF channel 3 |
21 | | -``` |
22 | | - |
23 | | -One complete STM32 receiver board is one CAN node. Its four RF paths are channels inside |
24 | | -that node. Phase shifters, DVGAs, LNAs, filters, detectors, and antenna elements are not CAN |
25 | | -nodes. The Arduino/Wi-Fi and external ADC path shown in the REV3 design drawing is not part |
26 | | -of the implemented software or CAN protocol. |
| 3 | +BeamControl controls four-channel RF receiver boards from a Raspberry Pi 5 over CAN. |
27 | 4 |
|
28 | | -The protocol uses controller node `0`, receiver-board nodes `1..30`, and broadcast address |
29 | | -`31`. See [`docs/can-protocol.md`](docs/can-protocol.md). |
| 5 | +```mermaid |
| 6 | +flowchart LR |
| 7 | + operator["Operator<br/>beamctl / dashboard"] --> pi["Raspberry Pi 5<br/>CAN node 0"] |
| 8 | + pi -->|"CAN 2.0B<br/>500 kbit/s"| stm32["STM32 receiver board<br/>node 1..30"] |
| 9 | + stm32 --> channels["RF channels 0..3"] |
| 10 | +``` |
30 | 11 |
|
31 | | -For a concise explanation suitable for a walkthrough or presentation—including what was |
32 | | -added beyond the original STM32 prototype—see [`docs/overview.md`](docs/overview.md). |
| 12 | +One board is one CAN node. Phase shifters and DVGAs are board-local devices. |
33 | 13 |
|
34 | | -## Repository layout |
| 14 | +## Layout |
35 | 15 |
|
36 | 16 | | Path | Purpose | |
37 | 17 | |:--|:--| |
38 | | -| `pi/` | Python 3.11 controller package, CLI, FastAPI dashboard, and Raspberry Pi deployment files | |
39 | | -| `stm32/` | STM32F072 firmware for one receiver board | |
40 | | -| `protocol/` | Shared Python/C protocol vectors | |
41 | | -| `simulation/` | Docker Compose, Renode platform, and virtual end-to-end test | |
42 | | -| `tools/` | Reproducible setup, diagnostics, bundle building, and checks | |
43 | | -| `docs/` | Current architecture, operations, and hardware design notes | |
| 18 | +| `pi/` | Python client, CLI, monitor, dashboard, deployment | |
| 19 | +| `stm32/` | STM32F072 firmware | |
| 20 | +| `protocol/` | Shared Python/C vectors | |
| 21 | +| `simulation/` | Docker/SocketCAN/Renode E2E | |
| 22 | +| `tools/` | Setup, checks, bundles | |
| 23 | +| `docs/` | Protocol, RF, operations | |
44 | 24 |
|
45 | | -## Develop and test |
| 25 | +## Develop |
46 | 26 |
|
47 | 27 | ```bash |
48 | 28 | make setup |
49 | 29 | make doctor |
50 | 30 | make test |
51 | 31 | make check |
52 | | -``` |
53 | | - |
54 | | -`make check` runs linting, all host tests, the protocol contract, and one representative |
55 | | -STM32 build. CI does not prebuild firmware for arbitrary receiver addresses. |
56 | | - |
57 | | -Run the real controller and STM32 ELF together over container-local virtual CAN with: |
58 | | - |
59 | | -```bash |
60 | 32 | make simulation-test |
61 | 33 | ``` |
62 | 34 |
|
63 | | -See [`simulation/README.md`](simulation/README.md) for scope and interactive use. |
64 | | - |
65 | | -## Build STM32 firmware |
66 | | - |
67 | | -A node ID is required and must be unique on the physical CAN bus: |
| 35 | +## Firmware |
68 | 36 |
|
69 | 37 | ```bash |
70 | 38 | make firmware NODE=1 |
71 | 39 | make firmware-size NODE=1 |
72 | 40 | ``` |
73 | 41 |
|
74 | | -Valid receiver-board IDs are `1..30`. The build writes `beamcontrol.elf`, |
75 | | -`beamcontrol.bin`, and `beamcontrol.map` under `stm32/app/build/`. |
| 42 | +Node IDs are `1..30` and must be unique. Outputs are under `stm32/app/build/`. |
76 | 43 |
|
77 | | -## Use the Pi controller |
| 44 | +## Controller |
78 | 45 |
|
79 | 46 | ```bash |
80 | 47 | beamctl discover |
81 | 48 | beamctl ping 1 |
82 | | -beamctl set-phase 1 --channel 2 --state 128 |
| 49 | + |
| 50 | +# Individual |
| 51 | +beamctl set-phase 1 --state 128 --channel 2 |
| 52 | +beamctl set-vga 1 --attenuation 8 --channel 2 |
| 53 | +beamctl set-combined 1 --state 128 --attenuation 8 --channel 2 |
| 54 | + |
| 55 | +# Bulk, channel order 0..3 |
| 56 | +beamctl set-phase 1 --states 128 64 32 16 |
| 57 | +beamctl set-vga 1 --attenuations 8 9 10 11 |
| 58 | +beamctl set-combined 1 --states 64 65 66 67 --attenuations 12 13 14 15 |
| 59 | + |
| 60 | +beamctl enter-safe 1 --channel 2 |
83 | 61 | beamd --config /etc/uorocketry/beamcontrol.toml |
84 | 62 | ``` |
85 | 63 |
|
86 | | -The first positional ID is the receiver-board CAN node. `--channel` selects one of that |
87 | | -board's four RF channels (`0..3`). |
88 | | - |
89 | | -`beamd` owns the CAN status monitor and serves a read-only FastAPI/Jinja2/HTMX dashboard on |
90 | | -port `8080`. The dashboard remains available when CAN hardware or receiver boards are offline. |
| 64 | +`beamd` serves a read-only dashboard on port `8080` and stays available when CAN is offline. |
91 | 65 |
|
92 | | -For installation and releases, see: |
| 66 | +## Docs |
93 | 67 |
|
| 68 | +- [Overview](docs/overview.md) |
| 69 | +- [CAN protocol](docs/can-protocol.md) |
| 70 | +- [RF encoding](docs/rf-control.md) |
94 | 71 | - [Developer setup](docs/operations/developer-setup.md) |
95 | | -- [Raspberry Pi 5 deployment](docs/operations/pi-provisioning.md) |
96 | | -- [Release process](docs/operations/releases.md) |
| 72 | +- [Pi deployment](docs/operations/pi-provisioning.md) |
| 73 | +- [Releases](docs/operations/releases.md) |
0 commit comments