Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCSDSv2 MsgId construction not 16 bits as described in cfe_sb_msg_id_util.h #781

Closed
johnphamngc opened this issue Jul 23, 2020 · 1 comment · Fixed by #726 or #833
Closed

CCSDSv2 MsgId construction not 16 bits as described in cfe_sb_msg_id_util.h #781

johnphamngc opened this issue Jul 23, 2020 · 1 comment · Fixed by #726 or #833
Milestone

Comments

@johnphamngc
Copy link

Describe the bug
CCSDSv2 MsgId construction not 16 bits as described in cfe_sb_msg_id_util.h. It looks like the 8th bit of the APID qualifier subsystem ID is included, making the MsgID 17 bits.

To Reproduce
N/A, code inspection

Expected behavior
MsgId should mask off bit 8 in subsystem ID

Code snips

/**
** For MESSAGE_FORMAT_IS_CCSDS_VER_2 the default layout of the message id is:
** 7 bits from the primary header APID
** 1 bit for the command/telemetry flag
** 0 bits from the Playback flag
** 8 bits from the secondary header APID qualifier (Subsystem)
** 0 bits from the secondary header APID qualifier as the System
** = 16 bits total
**
** Byte 1 Byte 0
** 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
** +-+-+-+-+-+-+-+-+|--------|+-+-+-+-+-+-+-+
** | APID Qualifier |C/T flg | Pri Hdr APID |
** +-+-+-+-+-+-+-+-+|--------|+-+-+-+-+-+-+-+
** This layout may be modified via the 4 macros
** CFE_SB_CMD_MESSAGE_TYPE, CFE_SB_RD_APID_FROM_MSGID
** CFE_SB_RD_SUBSYS_ID_FROM_MSGID and CFE_SB_RD_TYPE_FROM_MSGID
**
*/

#define CCSDS_RD_SUBSYSTEM_ID(shdr) ( (((shdr).APIDQSubsystem[0] & 0x01) << 8) + ((shdr).APIDQSubsystem[1]))

SubSystemId = CCSDS_RD_SUBSYSTEM_ID(MsgPtr->SpacePacket.ApidQ);
MsgIdVal = (MsgIdVal | (SubSystemId << 8));

System observed on:
N/A

Additional context
N/A

Reporter Info
John N Pham, Northrop Grumman

@skliper
Copy link
Contributor

skliper commented Jul 24, 2020

Note that code has a pending PR to fix (#726)... there's also a problem in the APID not being masked, so it could overload the cmd/tlm bit.

@skliper skliper linked a pull request Jul 27, 2020 that will close this issue
@skliper skliper added this to the 7.0.0 milestone Jul 27, 2020
skliper added a commit to skliper/cFE that referenced this issue Aug 14, 2020
Implements message header module such that users
can customize or extend as needed.
 - Separates code for easier selection
 - Implements consistent getter/setter APIs
 - Fix nasa#736/nasa#781: MsgId logic no longer overrides bits in init
 - Fix nasa#529: Get size supports max size
 - Adds single big endian time implementation, but not selected
 - Adds msg module to module list
 - Adds msg module to cppcheck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants