I'm currently looking for on how to determine the CRC produced from the machine to PC (and vice-versa). The devices are communicating using serial communication or RS232 cable.
I do only have data to be able for us to create a program to be used for both devices.
The data given was from my boss and the program was corrupted. So we are trying for it to work out.
I hope everyone can help.
Thanks :)
The sequence to use for the CRC calculation in your protocol is the ASCII string
It's a CRC with the following specs according to our CRC calculator
CRC:16,1021,0000,0000,No,No
which means:
(If 'init value' were FFFF, it would be a "16 bit width CRC as designated by CCITT").
See also the Docklight CRC glossary and the Boost CRC library on what the CRC terms mean plus sample code.
What I did is to write a small script that tries out the popular 16 bit CRCs on varying parts of the first simple "REQ=INI" command, and see if I end up with a sum of 4255. This failed, but instead of going a full brute force with trying all sorts of polynoms, I assumed that it was maybe just an oddball / flawed implementation of the known standards, and indeed succeeded with a variation of the CRC-CCITT.
Heres is some slow & easy C code (not table based!) to calculate all sorts of CRCs:
With this code and the CRCs specs listed above, I have been able to re-calculate the following three sample CRCs:
I failed on the very complex one with the
DEF=
parts - probably didn't understand the character sequence correctly.The Docklight script I used to reverse engineer this:
Hope this helps and I'm happy to provide extra information or clarify details.