Tokens

Packet length

The length of a packet (or a portion of it) can be calculated automatically,

by placing tokens. The length can include or exclude the checksum/CRC.

Data length calculation
Token Function
<data> or [ start of data for length calculation
</data> or ] end of data for length calculation
<length> length byte
<length_BE> length word Big Endian
<length_LE> length word Little Endian

<data> and </data> are symbolic tokens. No bytes will be inserted at these locations.

<length*> are the place holders for the resulting data length.

They will occupy their respective size in the message (i.e. 1 or 2 bytes).

Check Methods (Checksum or CRC)

Check methods
Token Function
<check> or { start of data/select default check method for calculation
</check> or } end of data for CRC or checksum calculation and place holder for result (by default)
<check-value> place holder for result (overrides </check>)

if the <check-value> token is used, the result will be inserted at the current location instead of the end specified by </check>.

Default check method

The check method is selectable by the combo box in the menubar or can be specified when loading a string file.

To specify it at load time, put the specific CRC or checksum from the tables below without the <> and prefix it with %. Protocoltool will read this as a command line and will not load it into the entries. This will update the CRC combobox.

Ex.: for specifying CRC-32 (IEEE 802.3), put somewhere in the file the following line.

% crc-32

CRC

8-bit CRC
Token Name Polynom
<crc-8-atm> CRC-8 ATM x8 + x2 + x + 1 (ATM HEC)
<crc-8-ccitt> CRC-8 CCITT x8 + x7 + x3 + x2 + 1 (1-Wire bus)
<crc-8-maxim> CRC-8 DALLAS/MAXIM x8 + x5 + x4 + 1 (1-Wire bus)
<crc-8> CRC-8 x8 + x7 + x6 + x4 + x2 + 1
<crc-8-j1850> CRC-8 SAE J1850 x8 + x4 + x3 + x2 + 1
<crc-8-wcdma> CRC-8 WCDMA x8 + x7 + x4 + x3 + x + 1
<crc-8-itu> CRC-8 ITU x8 + x2 + x + 1
<crc-8-rohc> CRC-8 ROHC x8 + x2 + x + 1
<crc-8-darc> CRC-8 DARC x8 + x5 + x4 + x3 + 1
<crc-8-icode> CRC-8 I-CODE x8 + x4 + x3 + x2 + 1

16-bit CRC
Token Name Polynom
<crc-16> CRC-16 x16 + x15 + x2 + 1
<crc-sick> CRC-16 (Sick) x16 + x15 + x2 + 1
<crc-dnp> CRC-DNP x16 + x13 + x12 + x11 + x10 + x8 + x6 + x5 + x2 + 1
<crc-modbus> CRC-16 (Modbus) x16 + x15 + x2 + 1
<crc-ccitt-xmodem> CRC-CCITT (XModem) x16 + x12+ x5 + 1
<crc-ccitt-kermit> CRC-CCITT (Kermit) x16 + x12+ x5 + 1
<crc-ccitt-ffff> CRC-CCITT (0xFFFF) x16 + x12+ x5 + 1
<crc-ccitt-1d0f> CRC-CCITT (0x1D0F) x16 + x12+ x5 + 1
<crc-x25> CRC16 X-25 x16 + x12+ x5 + 1
<crc-t10-dif> CRC16 T10-DIF x16 + x15 + x11 + x9 + x8 + x7 + x5 + x4 + x2 + x + 1
<crc-dect-x> CRC16 DECT-X x16 + x10 + x8 + x7 + x3 + 1
<crc-dect-r> CRC16 DECT-R x16 + x10 + x8 + x7 + x3 + 1
<crc-buypass> CRC16 BUYPASS x16 + x15 + x2 + 1
<crc-dds-110> CRC16 DDS-110 x16 + x15 + x2 + 1
<crc-16-maxim> CRC16 Maxim x16 + x15 + x2 + 1
<crc-usb> CRC16 USB x16 + x15 + x2 + 1
<crc-genibus> CRC16 Genibus x16 + x12+ x5 + 1
<crc-mcrf4xx> CRC16 MCRF4XX x16 + x12+ x5 + 1
<crc-riello> CRC16 Riello x16 + x12+ x5 + 1
<crc-en-13757> CRC16 EN-13757 x16 + x13 + x12 + x11 + x10 + x8 + x6 + x5 + x2 + 1
<crc-teledisk> CRC16 Teledisk x16 + x15 + x13 + x7 + x4 + x2 + x1 + 1

24-bit CRC
Token Name Polynom
<crc-24-flexray-a> CRC-24 Flexray-A x24 + x22 + x20 + x19 + x18 + x16 + x14 + x13 + x11 + x10 + x8 + x7 + x6 + x3 + x + 1
<crc-24-flexray-b> CRC-24 Flexray-B

same as above

<crc-24-r64> CRC-24-R64/OpenPGP x24 + x23 + x18 + x17 + x14 + x11 + x10 + x7 + x6 + x5 + x4 + x3 + x + 1

32-bit CRC
Token Name Polynom
<crc-32> CRC-32 (IEEE 802.3) x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
<crc-32-bzip2> CRC32 BZIP2 same as above
<crc-32-mpeg-2> CRC32 MPEG_2 same as above
<crc-32-posix> CRC32 POSIX same as above
<crc-32-jamcrc> CRC32 JAMCRC same as above
<crc-32-xfer> CRC32 XFER x32 + x7 + x5 + x3 + x2 + x + 1
<crc-32-C> CRC-32C (Castagnoli) x32 + x28 + x27 + x26 + x25 + x23 + x22 + x20 + x19 + x18 + x14 + x13 + x11 + x10 + x9 + x8 + x6 + 1
<crc-32-D> CRC-32D

x32 + x31 + x29 + x27 + x21 + x20 + x17 + x16 + x15 + x12 + x11 + x5 + x3 + x + 1

<crc-32-K> CRC-32K (Koopman)

x32 + x30 + x29 + x28 + x26 + x20 + x19 + x17 + x16 + x15 + x11 + x10 + x7 + x6 + x4 + x2 + x + 1

<crc-32-Q> CRC-32Q x32 + x31 + x24 + x22 + x16 + x14 + x8 + x7 + x5 + x3 + x + 1

40-bit CRC
Token Name Polynom
<crc-40-gsm> CRC-40 GSM 0004820009

64-bit CRC
Token Name Polynom
<crc-64> CRC-64 42F0E1EBA9EA3693
<crc-64-we> CRC-64 WE 42F0E1EBA9EA3693
<crc-64-1b> CRC-64 1B 000000000000001B
<crc-64-jones> CRC-64 Jones AD93D23594C935A9

Checksum

Checksum
Token Description
<csum8-2cmp> The checksum result added to the sum modulo 256 of all bytes in the checksum data section will equal zero.
<csum8-1cmp> Same as above but sum will equal FF.
<csum8-sum> The checksum result is the sum modulo 256 of all bytes in the checksum data section.
<csum8-xor> The checksum result is the exclusive or of all bytes in the checksum data section.
<chk-8-fletcher> Fletcher (not a CRC but a form of checksum)
<chk-16-fletcher> Fletcher (not a CRC but a form of checksum)

The checksum result occupy 1 byte for csum8-* and is placed after the data section or elsewhere if specified. A checksum can't be used with the CRC feature above, and vice-versa.

I2C/SMB

I2C
Token Function
<read> or <r> Read message
<write> or <w> Write message

For a Read message, a token <read> or <r> must be placed before characters to besent. When clicking 'Send', the address byte is transmitted with the 'read' flag; after that, the bytes on the send line are transmitted.

For a Write message, a token <write> or <w> must be placed before characters to be sent. When clicking 'Send', the address byte is transmitted with the 'write' flag; after that, the bytes on the send line are transmitted.

By default, protocoltool assumes a write operation.