Skip to content

CCSDS Bitfield Packet Structure Not Parsed Correctly – No Telemetry Packets Received #1822

@MuhammadRamzy

Description

@MuhammadRamzy

I'm working on integrating CCSDS-compliant packet headers into the Open Cosmos target file for telemetry packet parsing. Despite receiving raw bytes over the interface, the telemetry (TLM) packets are not being parsed or recognized correctly by the system.

I’ve defined the CCSDS primary and secondary headers using bitfields in C as follows:

#pragma pack(1)
typedef struct _PrimaryHeader_
{
    uint16_t ucCcsdsVersion :3;            /**< 3-bit CCSDS version number           */
    uint16_t ucPacketType :1;              /**< 1-bit telemetry or telecommand       */
    uint16_t ucSecondaryHeaderFlag :1;     /**< flag indicating secondary header     */
    uint16_t uhApid :11;                   /**< Apid of packet                       */
    uint16_t ucSequenceFlag :2;            /**< 2-bit packet sequence control        */
    uint16_t uhPacketSequenceCount :14;    /**< Packet sequence count                */
    uint16_t uhPacketLength;               /**< Length of data packet                */
} PrimaryHeader;
#pragma pack()

#pragma pack(1)
typedef struct _SecondaryHeader_
{
    uint16_t uhDay;                        /**< Number of days since mission-defined epoch */
    uint32_t uiMilliSecond;                /**< Number of milliseconds within the day     */
} SecondaryHeader;
#pragma pack()

And I’ve configured the target file as follows:


############################################
## Beacon packet definition
############################################

TELEMETRY <PROJECT_NAME>Beacon LITTLE_ENDIAN 
ARRAY_ITEM Sync 0 8 UINT 24 "Sync word" LITTLE_ENDIAN
ITEM Version 8 3 UINT "" LITTLE_ENDIAN
ITEM Type 11 1 UINT "" LITTLE_ENDIAN
  STATE TLM 0
  STATE CMD 1
ITEM SEC_HDR_FLAG 12 1 UINT "CCSDS secondary header flag" LITTLE_ENDIAN
  STATE FALSE 0
  STATE TRUE 1 
ID_ITEM ApID 13 11 UINT 16 "" LITTLE_ENDIAN
ITEM SEQ_FLGS 24 2 UINT "CCSDS sequence flags" LITTLE_ENDIAN
  STATE FIRST 1
  STATE CONT 0
  STATE LAST 2
  STATE NOGROUP 3
ITEM SRC_SEQ_CTR 26 14 UINT "CCSDS packet sequence count" LITTLE_ENDIAN
  OVERFLOW TRUNCATE
ITEM PKT_LEN 40 16 UINT "CCSDS packet data length" LITTLE_ENDIAN
ITEM Obc_Time_Hdr 56 32 UINT "" LITTLE_ENDIAN

Problem:
While the raw bytes are successfully received (verified via byte-level RX logs), the telemetry packets are not being recognized or displayed in the telemetry monitoring tools. This leads me to suspect the bitfield configuration or alignment in the target file might not be correctly interpreted.

Expected Behavior:
Telemetry packets should be parsed correctly using the CCSDS bitfield structure and appear in the telemetry visualization system.

Environment Details:

CCSDS header bitfield defined in PrimaryHeader and SecondaryHeader

Little-endian byte order

Raw RX confirmed via logs

Request:
Could you please review the current bitfield configuration for CCSDS headers and confirm if the bit alignment and field definitions are supported in the Open Cosmos telemetry parser? If any field boundary or packing needs to be adjusted, guidance would be greatly appreciated.

Raw Byte Sample (First RX):
10 02 2B 00 C8 00 4E 00 CD 0E 00 00 96 00 00 00 97 98 00 99 00 9A 00 9B 00 9C 9D 9E 00 00 00 9F A0 00 00 00 A1 00 00 00 A2 00 00 00 A3 00 00 00 A4 00 00 00 A5 00 00 00 A7 00 00 00 A8 00 00 00 A9 00 00 00 AA 00 00 00 AB 00 AC 00 AD 00 AE 00 AF 00 B2 00 B3 00 B4 00 00 00 B6 00 B7 00 B8 00 B9 00 BA 00 BB 00 BC 00 BD 00 BE 00 BF 00 C0 00 C1 00 C2 00 C3 00 C4 00 C5 00 C6 00 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 00 E1 00 E2 E3 E4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions