Add frame format definitions proto file - #48
Conversation
Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
| | BasicFrameNoCrc | 2 | 0 | None | Sync recovery, no CRC | | ||
| | TinyFrame | 1 | 2 | None | Low overhead with CRC | | ||
| | TinyFrameNoCrc | 1 | 0 | None | Minimal overhead | | ||
| | *Len8 variants | +1 | same | 8-bit | Variable length up to 255 bytes | |
There was a problem hiding this comment.
This should be expanded. and so should the Len 16
There was a problem hiding this comment.
Expanded all Len8 and Len16 variants in the table with full columns (Preamble, Header, CRC, Length, Total Overhead). See commit 3fd035f.
|
|
||
| ## Frame Format Overview | ||
|
|
||
| | Format | Header | Footer | Length Field | Use Case | |
There was a problem hiding this comment.
There should be a crc collumn
There was a problem hiding this comment.
We have a preamble which is the number of starting bytes. header should be the number of total header bytes which includes msg id and length as applicable. Another collumn showing total overhead should be listed.
There was a problem hiding this comment.
Added CRC column, separated Preamble from Header, and added Total Overhead column. Also reorganized to show recommended frames (NoFormat, BasicFrame, BasicFrameLen8) first in a separate table. See commit 3fd035f.
|
|
||
| ## Frame Format Overview | ||
|
|
||
| | Format | Header | Footer | Length Field | Use Case | |
There was a problem hiding this comment.
We should have recommended Frame followed by the others that are obscure variations.
The recommended one is the No Format, Basic Frame, and Basic Frame with 1 length byte.
There was a problem hiding this comment.
Added "Recommended Frame Formats" section with NoFormat, BasicFrame, and BasicFrameLen8 at the top, followed by "All Frame Formats" table with all variants. See commit 3fd035f.
| ``` | ||
|
|
||
| ## Custom Frame Formats | ||
| ## Industry Standard Protocols |
There was a problem hiding this comment.
This can say third party protocols
There was a problem hiding this comment.
Changed to "Third Party Protocols" with a separate table showing Preamble/Header/CRC/Length/Total Overhead columns. See commit 3fd035f.
| @@ -0,0 +1,840 @@ | |||
| // Frame Format Definitions for struct-frame | |||
There was a problem hiding this comment.
This file has way too many comments. It should be a lot more succinct.
There was a problem hiding this comment.
Significantly simplified the proto file - reduced from 847 lines to 303 lines. Removed verbose use case descriptions and kept only essential format comments. See commit 3fd035f.
| // ============================================================================ | ||
| // Frame Format Enumeration | ||
| // ============================================================================ | ||
|
|
There was a problem hiding this comment.
Create a BasicMessage message that will be included in every single frame format.
There was a problem hiding this comment.
Created BasicMessage with uint8 msg_id field and included it as a payload field in all frame format messages. See commit 3fd035f.
| // Overhead: 0 bytes | ||
|
|
||
| message NoFormat { | ||
| option msgid = 1; |
There was a problem hiding this comment.
Remove option msgid from all frame formats
There was a problem hiding this comment.
Removed option msgid from all frame format messages. See commit 3fd035f.
| option msgid = 4; | ||
|
|
||
| // Synchronization start byte (default 0x90) | ||
| uint8 start_byte = 1; |
There was a problem hiding this comment.
For any start_bytes add an option that puts allows the byte to be defined in hex.
There was a problem hiding this comment.
Added [(hex) = 0xNN] option to all start_byte fields to define the default value in hex (e.g., [(hex) = 0x90], [(hex) = 0xB5]). See commit 3fd035f.
|
@copilot address comments. |
…format Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
All comments addressed in commit 3fd035f. Changes include: expanded tables with Preamble/Header/CRC/Length/Total Overhead columns, recommended frames section, "Third Party Protocols" rename, simplified proto file (847→303 lines), added BasicMessage, removed msgid options, and added hex options for start bytes. |
Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
|
|
||
| ## Recommended Frame Formats | ||
|
|
||
| | Format | Preamble | Header | CRC | Length | Total Overhead | Use Case | |
There was a problem hiding this comment.
Lets remove the header field completely. So we just have preamble, length field, CRC and then total overhead.
The length field should not be 8-bit or 16-bit but just 1,2. It should be clear that this table is showcasing number of bytes.
There was a problem hiding this comment.
Removed Header column. Changed Preamble to "Start Bytes" with hex values (e.g., 1 (0x90)). Changed Length field to show byte count (0, 1, 2) instead of 8-bit/16-bit. See commit cd3371e.
| |--------|----------|--------|-----|--------|----------------|----------| | ||
| | NoFormat | 0 | 0 | 0 | None | 0 | Trusted links, nested protocols | | ||
| | BasicFrame | 1 | 2 | 2 | None | 4 | Standard reliable communication | | ||
| | BasicFrameLen8 | 1 | 3 | 2 | 8-bit | 5 | Variable length messages | |
There was a problem hiding this comment.
BasicFrameWithLen. The use case is when communicating with components where message definitions may not match. Recommended if all systems are not updated at the same time and unknown messages are sent.
There was a problem hiding this comment.
Renamed to BasicFrameWithLen. Updated use case: "When systems may not have matching message definitions. Recommended if unknown messages may be sent." See commit cd3371e.
| | Format | Preamble | Header | CRC | Length | Total Overhead | Use Case | | ||
| |--------|----------|--------|-----|--------|----------------|----------| | ||
| | NoFormat | 0 | 0 | 0 | None | 0 | Trusted links, nested protocols | | ||
| | BasicFrame | 1 | 2 | 2 | None | 4 | Standard reliable communication | |
There was a problem hiding this comment.
The basic frame only works when all messages are known to both systems.
There was a problem hiding this comment.
Updated BasicFrame use case to: "When all messages are known to both systems". See commit cd3371e.
| | BasicFrame | 1 | 2 | 2 | None | 4 | Standard reliable communication | | ||
| | BasicFrameLen8 | 1 | 3 | 2 | 8-bit | 5 | Variable length messages | | ||
|
|
||
| ## All Frame Formats |
There was a problem hiding this comment.
Additional Formats. Dont repeat the recommended formats.
There was a problem hiding this comment.
Renamed section to "Extended Frame Formats" and removed the recommended formats (BasicFrame, BasicFrameWithLen) from it. See commit cd3371e.
| | Format | Preamble | Header | CRC | Length | Total Overhead | Use Case | | ||
| |--------|----------|--------|-----|--------|----------------|----------| | ||
| | NoFormat | 0 | 0 | 0 | None | 0 | Trusted links, nested protocols | | ||
| | BasicFrame | 1 | 2 | 2 | None | 4 | Standard reliable communication | |
There was a problem hiding this comment.
All Recommended Frame Formats have to include MSG ID. Remove the No Format Frame.
There was a problem hiding this comment.
Removed NoFormat from recommended. Recommended now only includes BasicFrame and BasicFrameWithLen which both have MSG ID. See commit cd3371e.
| | BasicFrame | 1 | 2 | 2 | None | 4 | Standard reliable communication | | ||
| | BasicFrameLen8 | 1 | 3 | 2 | 8-bit | 5 | Variable length messages | | ||
|
|
||
| ## All Frame Formats |
There was a problem hiding this comment.
Lets have Three Frame format sections in total.
Recommended, Additional recommended (Needs better name) and
Parametric Frame Formats.
There was a problem hiding this comment.
Created three sections: "Recommended Frame Formats", "Extended Frame Formats", and "Parametric Frame Formats". See commit cd3371e.
|
|
||
| ## Recommended Frame Formats | ||
|
|
||
| | Format | Preamble | Header | CRC | Length | Total Overhead | Use Case | |
There was a problem hiding this comment.
Instead of Preamble have start bytes and include the value of the start bytes.
There was a problem hiding this comment.
Changed "Preamble" to "Start Bytes" and included the hex values (e.g., 1 (0x90), 2 (0xB5, 0x62)). See commit cd3371e.
…meWithLen Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
| - Enumeration of all frame format types | ||
| - Configuration message for runtime format selection | ||
|
|
||
| ## Recommended Frame Formats |
There was a problem hiding this comment.
Basic Frame should have 2 start bytes.
Tiny Frame should have 1 start byte.
Minimal Frame should have 0 start bytes.
Recommended formats should be BasicFrame, TinyFrame, BasicFrame With length, Tiny Frame with length, Basic Frame with Length 2.
Then Extended Formats should have NoFrame, MSGIDFrame, MSGIDFrameNoCRC, MSGIDFrameLen8.
The rest should be in parametric format.
The first start byte for each basicframe should be 0x90. the second value should be 0x90 + a unique index.
Each tinyFram start byte should be unique start with 0x70 as the basic one.
There was a problem hiding this comment.
The proto file should be updated as well.
There was a problem hiding this comment.
Restructured all frame formats. BasicFrame now has 2 start bytes (0x90, 0x91-0x97 for variants), TinyFrame has 1 start byte (0x70-0x75), MinimalFrame (renamed from MsgIdFrame) has 0 start bytes. Added BasicFrameWithSysComp for multi-system networks. Updated both docs/framing.md and examples/frame_formats.proto. See commit d85f467.
rijesha
left a comment
There was a problem hiding this comment.
More changes to framing defines.
We should also add a basic frame format that includes a sys_id and comp_id that takes up another 2 bytes in total. That should be included in the recommended frame formats.
… add SysComp variant Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
Added BasicFrameWithSysComp with sys_id and comp_id (7 bytes overhead total: 2 start bytes + sys_id + comp_id + msg_id + 2 CRC). Included in recommended formats. See commit d85f467. |
Defines message framing formats in a
.protofile with documented use cases for each format type.Frame Format Structure
Recommended Frame Formats
Extended Frame Formats
Parametric Frame Formats
Third Party Protocols
Files
examples/frame_formats.proto- Protocol Buffer definitions with hex options for start bytesdocs/framing.md- Updated documentation with frame format tables and examplesFixes New framing definition file #47
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.