Documenting FPrime packet structure #1601
Replies: 6 comments 2 replies
-
This is definitely an open topic, and one that deserves attention. In my lab, we have reverse engineered some of the packet handling components to create alternate frame formats for our systems. Some of this work influenced the core development team to separate out Framer and DeFramer components, which has made this type of work easier. I would also be interested in contributing if I can, but that may be limited to comments and suggestions for how to go about it. |
Beta Was this translation helpful? Give feedback.
-
If you are interested, it is actually easier than it looks to follow TM data from an arbitrary component to the output (down)stream, and TCs from the input (up)stream to the destination component. Disregarding file transfer and, possibly, other non-core cases, there are TCs coming up, and two forms of TM. Based on the Ref demo application (and bearing in mind we're still on F' 2.1.0): Channel telemetry (most people's housekeeping) goes through these components: Through ports (per link above): Event telemetry: Telecommands: Following these chains will give you the packet formats. For TM each component, some data or metadata is serialised and appended or prepended to the existing serial. For TC, it's the opposite (although the initial decoding process is a little more involved). For example, for event telemetry, which is the easiest to follow: In component ArbitraryComponent, you have an event with three parameters. Upon invocation of the Log port, the three arguments are serialised, and sent along with the Event ID, send timestamp, and severity, to the LogRecv port of the ActiveLogger component. Serialised: Arg1, Arg2, Arg3 Here, this package of data is queued until the cyclic activity is called. It is then popped and the packet type, event ID, timestamp and severity are serialised. The prior serial buffer is appended: Serialised: This buffer is then sent, along with a context number (which AFAIK is always 0), through the PktSend port to the comIn port of the Framer component. Framer passes the data to an object derived from FramingProtocol (FprimeFraming by default), where this data has any packet prefixes and suffixes attached. In F', this is the packet starting word 0xDEADBEEF, the size of the data, then the prior serialised data, and finally a checksum. Serialised: At this point the packet is done and sent through the framedOut port to the send port of the ByteStreamDriverModel. Perhaps there's an additional checksum after that, I don't know. |
Beta Was this translation helpful? Give feedback.
-
I'd love help with this documentation, although I am at a loss how to get you the information you need without just doing the documentation. Below is an attempt: We have a packet representing data using the above types, and a frame which frames those packets with a start word, size, and checksum. Packets are described in the module comments in these files: https://github.com/fprime-community/fprime-gds/tree/devel/src/fprime_gds/common/decoders The framing protocol is described here: https://github.com/nasa/fprime/blob/master/Svc/FramingProtocol/docs/sdd.md @JackNWhite's above comments show the startword (0xdeadbeef), size, and checksum from the framing layer, as well as the serialized packet format: Frame: Inner Packet Format: Packet type (Event/command/event), ID (opcode, channel id, event id), Timestamp, (packet specific data) |
Beta Was this translation helpful? Give feedback.
-
I think both of these are really helpful, and give me some stuff to go on. I'd like to write this up into a page that lives in the user guide somewhere. I'm thinking it will explain the structure, clarifying which parts come from FPrime (e.x. the Where would you suggest this documentation file live? |
Beta Was this translation helpful? Give feedback.
-
I have started work on documenting this (draft PR in my forked repo here https://github.com/rmelick-muon/fprime/pull/1/files), but I have gotten stuck on the more complicated ones, and run into a few questions:
|
Beta Was this translation helpful? Give feedback.
-
Hi @rmelick-muon I have been stuck developing something that can ingest F' Packets, specifically when the Telemetry is sent using TlmPacketizer. It was really hard to find any documentation, and after a day of digging and manually analyzing packets, I think I have a complete idea of how TlmPacketizer does things. I figured I'd let you know since you have a PR that's trying to document everything.
I was not able to figure out why there were 2 extra bytes in front of the ID when theyre not supposed to be there, so if someone can help me figure that out, it would be great. For example, this is what I received
Where I should have 4(FW_PACKET_PACKETIZED_TLM) when I use bytes 9 and 10, but instead it is at bytes 11 and 12. There is also an extra 2 bytes of packet type field, which isnt documented anywhere??? Here take note that each packet will be sent according to the definition in Packets.xml in the topology directory, and needs to be processed accordingly. I hope one of the maintainers is able to get this into the documentation. It feels really incomplete for our use case |
Beta Was this translation helpful? Give feedback.
-
As someone new to FPrime, I am struggling to understand the structure of packets that are sent between the flight system and ground system.
First, I have a basic question: How much of this packet structure depends on my custom application components, and their ports , events, and telemetry channels as defined in the xml file?
Mostly though, I am interested in how these different packets look as bytes. I see some amount of this documented in code comments in the
fprime-gds
repository, but would love to see it in the official FPrime documentation. It looks like by default there are 8 different kinds of packets?E.x. pkt_decoder.py shows a structure that looks like
I would love to fully document each of these 8 types, as well as the FPrime framing protocol that lives on top of them too.
I see a decent number of open questions and discussions about packet structure, if we can clarify the structure here I'm happy to add this documentation to the User guide in the appropriate location. Some examples include #1228, #1436.
Beta Was this translation helpful? Give feedback.
All reactions