This is a very simple change intended to eliminate the unnecessary minor difference between the Cyphal/serial frame format and the new Cyphal/UDP frame format. The current Cyphal/serial frame format is as follows:
uint8 version # Always zero. Discard the frame if not.
uint8 priority # 0 = highest, 7 = lowest; the rest are unused.
uint16 source node ID # 0xFFFF = anonymous.
uint16 destination node ID # 0xFFFF = broadcast.
uint16 data specifier
void64 # Reserved; later may be leveraged for runtime type identification.
uint64 transfer-ID
uint32 frame index EOT # MSB set if last frame of the transfer; i.e., 0x8000_0000 if single-frame transfer.
uint32 header CRC # CRC-32C (Castagnoli) of the header (all fields above).
The new format, shared for Cyphal/serial and Cyphal/UDP, is as follows:
uint4 version # <- 1
void4
@assert _offset_ == {8}
uint3 priority # Duplicates QoS for ease of access; 0 -- highest, 7 -- lowest.
void5
@assert _offset_ == {16}
uint16 source_node_id
uint16 destination_node_id
uint16 data_specifier # Like in Cyphal/serial: subject-ID | (service-ID + request/response discriminator).
@assert _offset_ == {64}
uint64 transfer_id
@assert _offset_ == {128}
uint31 frame_index
bool end_of_transfer
uint16 user_data
# Opaque application-specific data with user-defined semantics. Generic implementations should ignore
@assert _offset_ % 16 == {0}
uint8[2] header_crc_be # Most significant byte first.
@assert _offset_ / 8 == {24} # Fixed-size 24-byte header with natural alignment for each field ensured.
@sealed
The same layout may well be used in other transports in the future, such as Cyphal/TSN.
Changes:
The header CRC is now CRC-16-CCITT (same as used in Cyphal/CAN).
The 64 reserved bits are gone, reducing the header size to 24 bytes.
The version number is set to 1 (stable).
16 bits of opaque user data added (to be set to zero / ignored by generic implementations such as PyCyphal).
This is a very simple change intended to eliminate the unnecessary minor difference between the Cyphal/serial frame format and the new Cyphal/UDP frame format. The current Cyphal/serial frame format is as follows:
The new format, shared for Cyphal/serial and Cyphal/UDP, is as follows:
The same layout may well be used in other transports in the future, such as Cyphal/TSN.
Changes:
Related: #253
FYI @maksimdrachov