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

TMTF_UpdateErrCtrlField strange CRC #5

Open
hartib opened this issue Dec 3, 2018 · 0 comments
Open

TMTF_UpdateErrCtrlField strange CRC #5

hartib opened this issue Dec 3, 2018 · 0 comments

Comments

@hartib
Copy link

hartib commented Dec 3, 2018

I have checked the CRC implementation of the TM with several other implementations and the one in TMTF_UpdateErrCtrlField seems to disagree with the others. If I read CCSDS 132.0-B-2 and http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat-bits.16 correctly the CRC is the CRC-16/IBM-3740 (also CRC-16/CCITT-FALSE). For the test sequence 123456789 this is supposed to produce 0x29b1. So does the algorithm in https://github.com/nasa/channel-emulator/blob/master/lib/TM_Transfer_Frame.cpp and the one in https://github.com/Stefan-Korner/SpacePyLibrary/blob/master/UTIL/CRC.py.

TMTF_UpdateErrCtrlField however produces 0xa69d which corresponds to none of the CRCs with poly 0x1021.

To produce the right result the code in the function should be something like:

                byte = (reg >> 8) & 0xff;
                reg = (reg << 8);
                reg ^= crc_table[byte ^ *ptr];
                ptr++;

So, which of the CRCs is right?

harti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant