CRC16 calculation options
Opened this issue · 0 comments
THQ-WIFA commented
The CRC16 calculation options are insufficient and hard to understand:
- There is no explicit option to control the initial value. There is an implicit way to control it by selecting the named option -CCITT or -XMODEM and then override the polynomial with -POLY.
- The implementation comments in crc16.cc refer to the CRC16 algorithm descriptions as proposed in the famous painless giude to CRC: Name, Width, Poly, Init, RefIn, RefOut, XOrOut, Check. But apparently, you can't control all of them, and/or the naming is inconsistent.
- In fact, it seems you can't find a combination that creates MODBUS-style CRCs. I tried all 12 combinations of the Parameters {-CCITT|-XMODEM|-BROKEN}, {-AUGment|-No-AUGment}, {-Most_To_Least|-Least_To_Most} with -POLY ibm as indicated in srec_input.1.html, but none of the combinations got the correct result.
Proposal: Add options that control the parameters as named in the painless guide.
Useful resources:
- A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS (Note: URL changed; no longer available at the location mentioned in the source)
- CRC16 algorithm catalogue, with parameters listed in the format from the painless guide
- CRCcalc online multi-algorithm CRC calculator, with parameters listed in the format from the painless guide
- CRC calculation tool suite, including code generator for CRC implementations in C (by checksum expert Mark Adler)