|
| 1 | +# ComCcsds (CCSDS Framing) Subtopology — Software Design Document (SDD) |
| 2 | + |
| 3 | +The **ComCcsds subtopologies** implement F´’s **CCSDS** communications stack for framing/deframing on the flight side. There are **two variants** in the same module: |
| 4 | + |
| 5 | +1. A variant that **supplies a `Svc::ComStub`** implementation of `Svc.ComInterface` and expects to be wired to a **`Drv::ByteStreamDriverModel`** (TCP/UDP/UART, etc.), and |
| 6 | +2. A variant that **expects an external implementation of [`Svc.ComInterface`](https://fprime.jpl.nasa.gov/latest/docs/reference/communication-adapter-interface/)** provided by the deployment. |
| 7 | + |
| 8 | +Both variants provide the standard **router + ComQueue + CCSDS framers/deframers** path and are tuned through **ComCcsdsConfig** instance properties. |
| 9 | + |
| 10 | +> [!IMPORTANT] |
| 11 | +> `ComCcsds` provides framing/deframing for CCSDS SpacePackets inside TM/TC data transfer frames. |
| 12 | +
|
| 13 | +--- |
| 14 | + |
| 15 | +## 1. Requirements |
| 16 | + |
| 17 | +| ID | Description | Validation | |
| 18 | +| ---------------- | -------------------------------------------------------------------------------------------------------------- | ---------- | |
| 19 | +| SVC-COMCCSDS-001 | Provide a **CCSDS framer** to convert COM buffers into CCSDS frames for downlink. | Inspection | |
| 20 | +| SVC-COMCCSDS-002 | Provide a **CCSDS deframing path** to parse incoming CCSDS frames into COM buffers for uplink. | Inspection | |
| 21 | +| SVC-COMCCSDS-003 | Provide an F´ **router** to route deframed packets (e.g., commands/files) into the flight software. | Inspection | |
| 22 | +| SVC-COMCCSDS-004 | Provide a **subtopology variant that supplies `Svc::ComStub`** designed to connect to a ByteStream driver. | Inspection | |
| 23 | +| SVC-COMCCSDS-005 | Provide a **subtopology variant that expects an external `Svc::ComInterface`** supplied by the deployment. | Inspection | |
| 24 | +| SVC-COMCCSDS-006 | Support **configurable instance properties** (IDs, queue sizes, stack sizes, priorities) via `ComCcsdsConfig`. | Inspection | |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## 2. Design & Core Functions |
| 29 | + |
| 30 | +### 2.1 Instance Summary |
| 31 | + |
| 32 | +| Instance name | Type (Svc/Drv) | Kind | Purpose (core function) | |
| 33 | +| --------------------- | ------------------------------- | ------- | ----------------------------------------------------------------------------------------------- | |
| 34 | +| `fprimeRouter` | `Svc.FprimeRouter` | Passive | Routes deframed packets (e.g., commands/files) into the flight software. | |
| 35 | +| `comQueue` | `Svc.ComQueue` | Active | Queues categorized COM data for framing (telemetry, events, file, etc.); exposes `run`. | |
| 36 | +| `spacePacketFramer` | `Svc.Ccsds.SpacePacketFramer` | Passive | Builds **CCSDS Space Packets** from COM buffers (downlink step 1). | |
| 37 | +| `framer` | `Svc.Ccsds.TmFramer` | Passive | Builds **CCSDS TM Transfer Frames** from space packets and sends to the link (downlink step 2). | |
| 38 | +| `spacePacketDeframer` | `Svc.Ccsds.SpacePacketDeframer` | Passive | Deframes F Prime data from **CCSDS Space Packets** (uplink step 2). | |
| 39 | +| `tcDeframer` | `Svc.Ccsds.tcFramer` | Passive | Deframes **CCSDS Space Packets** from **CCSDS TM Transfer Frames** (uplink step 1). | |
| 40 | +| `frameAccumulator` | `Svc.FrameAccumulator` | Passive | Collects bytes from the link and emits complete frames/packets for deframing (uplink path). | |
| 41 | +| `comStub` | `Svc.ComStub` | Passive | (Variant A only) Implementation of `Svc.ComInterface`, adapting a `Drv::ByteStreamDriverModel`. | |
| 42 | + |
| 43 | +> **Two variants:** |
| 44 | +> **A. “With ComStub”:** Subtopology **includes** `Svc::ComStub` and exposes **ByteStream** ports to your driver. |
| 45 | +> **B. “With External ComInterface”:** Subtopology **does not include** `Svc::ComStub`; you **provide** one in the deployment. |
| 46 | +
|
| 47 | +### 2.2 Required Inputs for Operation |
| 48 | + |
| 49 | +* **Rate Groups:** Connect a rate group to **`comQueue.run`**. This is not required for the subtopology to function, but defines the rate at which ComQueue will send telemetry. |
| 50 | +* **Transport Endpoint:** |
| 51 | + |
| 52 | + * **Variant A:** Wire **ByteStream send/recv** between your **`Drv::ByteStreamDriverModel`** and the subtopology’s **`ComStub`**. |
| 53 | + * **Variant B:** Provide your own **`Svc::ComInterface`** and wire it to the **CCSDS framer/deframer ports** in the subtopology. |
| 54 | +* **Flight-side hookups:** Wire the **router** outputs (commands/files) into your CDH stack (e.g., command dispatcher, file uplink), and feed **packet sources** (telemetry/events/file downlink) into **`comQueue`**. |
| 55 | + |
| 56 | +### 2.3 Limitations |
| 57 | + |
| 58 | +These subtopologies focus on the **CCSDS framing and deframing setup** and does not provide wider CDH. |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## 3. Usage |
| 63 | + |
| 64 | +Below are **two usage patterns**, one for each variant. Replace identifiers/ports with the **exact names in `ComCcsds.fpp`**. |
| 65 | + |
| 66 | +### 3.1 Variant A — ComCcsds **with** `Svc::ComStub` (expects a ByteStream driver) |
| 67 | + |
| 68 | +```fpp |
| 69 | +topology Flight { |
| 70 | + import ComCcsds.Subtopology |
| 71 | +
|
| 72 | +instance comDriver: <ByteStreamDriverInterface> |
| 73 | +
|
| 74 | +# (A1) Schedule ComQueue telemetry downlink (optional) |
| 75 | + connections RateGroups { |
| 76 | + rg.RateGroupMemberOut[0] -> ComCcsds.comQueue.run |
| 77 | + } |
| 78 | +
|
| 79 | + # (A2) Wire ByteStream driver <-> ComStub supplied by the subtopology |
| 80 | + connections Link { |
| 81 | + comDriver.$recv -> ComCcsds.comStub.drvReceiveIn |
| 82 | + ComCcsds.comStub.drvReceiveReturnOut -> comDriver.recvReturnIn |
| 83 | + ComCcsds.comStub.drvSendOut -> comDriver.$send |
| 84 | + comDriver.ready -> ComCcsds.comStub.drvConnected |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +> [!TIP] |
| 90 | +> `ComCcsds.commsBufferManager` can be reused if the `ByteStreamDriver` requires buffer management. |
| 91 | +
|
| 92 | +### 3.2 Variant B — ComCcsds **without** `Svc::ComStub` |
| 93 | + |
| 94 | +```fpp |
| 95 | +topology Flight { |
| 96 | + import ComCcsds.FramingSubtopology |
| 97 | +
|
| 98 | + # (B1) Provide your own ComInterface |
| 99 | + instance radio: <YourComInterface> |
| 100 | +
|
| 101 | + # (B2) Schedule ComQueue |
| 102 | + connections RateGroups { |
| 103 | + rg.RateGroupMemberOut[0] -> ComCcsds.comQueue.run |
| 104 | + } |
| 105 | +
|
| 106 | + # (B3) Wire your ComInterface between the driver and the ComCcsds framer/deframer |
| 107 | + connections Link { |
| 108 | + # Downlink: TM framer -> your ComInterface |
| 109 | + ComCcsds.framer.dataOut -> radio.dataIn |
| 110 | + radio.dataReturnOut -> ComCcsds.framer.dataReturnIn |
| 111 | + radio.comStatusOut -> ComCcsds.framer.comStatusIn |
| 112 | +
|
| 113 | + # Uplink: your ComInterface -> frame accumulator |
| 114 | + radio.dataOut -> ComCcsds.frameAccumulator.dataIn |
| 115 | + ComCcsds.frameAccumulator.dataReturnOut -> radio.dataReturnIn |
| 116 | + } |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## 4. Configuration |
| 123 | + |
| 124 | +> Configure **only the instance properties** owned by the ComCcsds subtopologies. All knobs live under: |
| 125 | +> `Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp` |
| 126 | +
|
| 127 | +### 4.1 Component properties (`ComCcsdsConfig.fpp`) |
| 128 | + |
| 129 | +* **Base ID** — Base identifier for the subtopologies; instance IDs are offset from this base. |
| 130 | +* **Queue sizes** — Depths for **`ComQueue`** and any other active/queued elements defined by the subtopology. |
| 131 | +* **Stack sizes** — Task stack allocations for active components (if any beyond `ComQueue`). |
| 132 | +* **Priorities** — RTOS priorities for active/queued components as applicable. |
| 133 | + |
| 134 | +### 4.2 Buffer Manager Bin Configuration |
| 135 | + |
| 136 | +`module BuffMgr` provides constants for the bins configured for `commsBufferManager`. |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## 5. Traceability Matrix |
| 141 | + |
| 142 | +| Requirement ID | Satisfied by (instance/type) | |
| 143 | +| ---------------- | -------------------------------------------------------------------------------------- | |
| 144 | +| SVC-COMCCSDS-001 | `spacePacketFramer` — `Svc.Ccsds.SpacePacketFramer`, `tmFramer` — `Svc.Ccsds.TmFramer` | |
| 145 | +| SVC-COMCCSDS-002 | `frameAccumulator` — `Svc.FrameAccumulator` | |
| 146 | +| SVC-COMCCSDS-003 | `fprimeRouter` — `Svc.FprimeRouter` | |
| 147 | +| SVC-COMCCSDS-004 | `Subtopology` (variant including `Svc.ComStub`) | |
| 148 | +| SVC-COMCCSDS-005 | `FramingSubtopology` (variant expecting external `Svc.ComInterface`) | |
| 149 | +| SVC-COMCCSDS-006 | `ComCcsdsConfig` module | |
| 150 | + |
0 commit comments