REV 1.1.1 (Last Modified May 25, 2023)
11 | 29
R E V 1 . 1 . 1
Communication Definitions and Algorithms
KDECAN uses different data types in the messages that are sent between the ESCs and the master. The CRC
algorithm is used to verify that no information is altered within the transmission of the CAN message. The data
type descriptions and algorithm are provided below for reference.
Note: Multiple CAN bus analyzers are available on the market. KDE used the CANalyst 2 during development
for its features and interface.
Data Types
The following data types used in CAN messages are described below:
HA Hexadecimal ASCII
[‘0’... ‘9’, ‘A’... ‘F’]
U8 Unsigned char [0...0xFF]
U16 Unsigned short (High byte
–
byte 0, Low byte
–
byte 1
), [0… 0xFFFF]
U32 Unsigned int (High byte
–
byte 0, Low byte
–
byte 3), [0... 0xFFFFFFFF]
U64 Unsigned long (High byte
–
byte 0, Low byte
–
byte 7), [0... 0xFFFFFFFFFFFFFFFF]
CRC Algorithm
The error management as described in the CAN protocol is handled entirely by hardware using a Transmit
Error Counter (TEC value, in CAN_ESR register) and a Receive Error Counter (REC value, in the CAN_ESR
register), which get incremented or decremented according to the error condition. For detailed information
about TEC and REC management, refer to the CAN standard.
For more information please refer to STM32 AN4187
Endianness
KDECAN uses Big Endian for multi-byte values.
Example:
Decimal Value: 1000
Hex Value in Big Endian: 0x03E8
(Byte)
0
1
2
3
4
5
6
7
(Hex)
[03]
[E8]
[xx]
[xx]
[xx]
[xx]
[xx]
[xx]