CRC calculation
This page explains how to obtain the proper CRC value of the MCB protocol.
CRC description (CRC-CCITT "XMODEM")
Parameter | Value |
---|---|
Width | 16 bits |
Polynomial | 0x1021 |
Initial value (seed) | 0x0000 |
Example
The example consist in a write command to the position set-point parameter and a read command on the velocity actual value.
CRC calculation on SPI based protocols (transfer done in word size)
Simple write example
Write access to register 0x20 (position set-point) with a value of 100000
Header | Config data | CRC | ||
---|---|---|---|---|
Address | Command | Pending frame | ||
0x020 | 0b010 | 0 | 0x186A0 | 0xA2C7 |
0x0204186A0000000000000A2C7 |
Successful reply
Header | Config data | CRC | ||
---|---|---|---|---|
Address | Command | Pending frame | ||
0x020 | 0b011 | 0 | 0x0 | 0xB5D8 |
0x02060000000000000000B5D8 |
Simple read example
Read access to register 0x31 (velocity actual) with a value of 1000.0
Header | Config data | CRC | ||
---|---|---|---|---|
Address | Command | Pending frame | ||
0x010 | 0b001 | 0 | 0 | 0x6758 |
0x031200000000000000006758 |
Successful reply
Header | Config data | CRC | ||
---|---|---|---|---|
Address | Command | Pending frame | ||
0x010 | 0b011 | 0 | 0x447A0000 | 0x919D |
0x03160000447A00000000919D |
CRC calculation on other protocols (transfer done in byte size)
Simple write example
Write access to register 0x20 (position set-point) with a value of 100000
Node ID | Header | Config data | CRC | ||
---|---|---|---|---|---|
Address | Command | Pending frame | |||
0x0001 | 0x020 | 0b010 | 0 | 0x186A0 | 0xA1B2 |
0x01000402A086010000000000B2A1 |
Successful reply
Node ID | Header | Config data | CRC | ||
---|---|---|---|---|---|
Address | Command | Pending frame | |||
0x0001 | 0x020 | 0b011 | 0 | 0x0 | 0xB6AD |
0x010006020000000000000000ADB6 |
Simple read example
Read access to register 0x31 (velocity actual) with a value of 1000.0
Node ID | Header | Config data | CRC | ||
---|---|---|---|---|---|
Address | Command | Pending frame | |||
0x0001 | 0x031 | 0b001 | 0 | 0 | 0x642D |
0x0100120300000000000000002D64 |
Successful reply
Node ID | Header | Config data | CRC | ||
---|---|---|---|---|---|
Address | Command | Pending frame | |||
0x0001 | 0x031 | 0b011 | 0 | 0x44A0000 | 0x92E8 |
0x0100160300007A4400000000E892 |