Data Sheet
Appendix
A.1 CRC validation
When using python, you will find a dedicated module named ‘crcmod’. Please install the
module using ‘pip’ with the following command:
pip install crcmod
A.1.1 How to calculate CRC8 checksum for Evo 64px
After defining this function:
self.crc8 = crcmod.predefined.mkPredefinedCrcFun('crc-8')
You will be able to use the above function on any buffer, as illustrated in the code below. In
this case ‘ack’ variable is a 4-byte buffer containing an ACK response.
crc = self.crc8(ack[:3])
if crc == ord(ack[3]): # Check that CRC’s are matching
...
A.1.2 How to calculate CRC32 checksum for Evo 64px
After defining this function:
self.crc32 = crcmod.predefined.mkPredefinedCrcFun('crc-32-mpeg')
To validate the CRC checksum of a data frame for Evo 64px sensor, please use the
following function.
def crc_check(self, frame):
index = len(frame) - 9 # Start of CRC
crc_value = (ord(frame[index]) & 0x0F) << 28
crc_value |= (ord(frame[index + 1]) & 0x0F) << 24
crc_value |= (ord(frame[index + 2]) & 0x0F) << 20
crc_value |= (ord(frame[index + 3]) & 0x0F) << 16
crc_value |= (ord(frame[index + 4]) & 0x0F) << 12
crc_value |= (ord(frame[index + 5]) & 0x0F) << 8
crc_value |= (ord(frame[index + 6]) & 0x0F) << 4
Copyright © Terabee 2018
Terabee, 90 Rue Henri Fabre
01630, St Genis-Pouilly, France (next to CERN)
18/22