docs/reference/system-functional/communication.md
The communication stack provides the data path between the flight software and external systems (ground station, other processors, or other deployments). It handles outgoing data (downlink) by queuing, framing, and transmitting packets, and incoming data (uplink) by accumulating byte streams, extracting frames, and routing packets to their destination components. The stack is modular and composed from interchangeable components that implement defined interfaces, allowing different protocol layers to be swapped in depending on mission requirements.
The following diagram shows the F Prime communication stack using the ComFprime subtopology:
Outgoing data flows through the following stages:
Queuing — ComQueue receives data from multiple sources (telemetry, events, file packets) and prioritizes them for transmission. The queue supports configurable depth and priority levels, sending the highest-priority data first. Flow control is managed through a ready signal from downstream components — the queue only sends the next item when the downstream path signals readiness.
Framing — The framer (e.g. FprimeFramer or a CCSDS framer) wraps each outgoing packet in a protocol-specific frame. The framing interface is pluggable, allowing different protocols to be selected per mission.
Transmission — The framed data is passed to a communication adapter that implements the Communication Adapter Interface for physical transmission. For ground testing, ComStub wraps a byte stream driver to present this interface. For flight, missions replace ComStub with a mission-specific adapter (e.g. a radio driver) of the same interface. The adapter reports success or failure back through the communication status protocol.
Incoming data flows through the following stages:
Accumulation — FrameAccumulator receives a stream of byte buffers from the communication adapter and extracts complete frames.
Deframing — The deframer (e.g. FprimeDeframer or a CCSDS deframer) validates the frame (checking CRC and structure) and extracts the payload.
Routing — FprimeRouter (or PassThroughRouter) examines the extracted packet and forwards it to the appropriate destination. Command packets are sent to the command dispatcher and file packets are sent to file uplink.
The F Prime protocol is a minimal framing protocol consisting of four fields:
This protocol is designed for simplicity and is commonly used for development and testing with the F Prime GDS. Missions select the appropriate protocol (F Prime, CCSDS, or custom) based on their communication requirements.
ComRetry sits in the downlink path before the communication adapter and resends failed transmissions up to a configurable maximum number of retries. After all retries are exhausted, it propagates the failure upstream. This provides resilience against transient communication failures.
ComLogger records all outgoing data to files on the file system, providing a record of transmitted data for debugging and analysis. Log files are rotated based on a configurable size or byte limit.
For missions requiring standards-compliant space communication, the F Prime and CCSDS protocol components can be swapped in the communication stack. CCSDS components provide Space Packet framing, TM/TC Space Data Link framing, and AOS framing at various protocol layers. See the CCSDS Protocol Functionality document for details.