web
You’re offline. This is a read only version of the page.
close
Support Portal

picoScan100: How to check the CRC8 checksum in Cola B?

The article describes how to check the CRC8 checksum in Cola B.
Related Products
picoScan100

Table of Contents

This note shows how a host separates binary Cola B frames from a TCP byte stream, interprets the length, and validates the checksum for picoScan150 and other LiDARs with the same interface. The dummy payload below is an exemplary LMDscandata response containing some beams. It was captured from a picoScan150 with firmware V2.1.0. The focus is on demonstrating frame separation and XOR-based checksum validation.

Transport
Ethernet, Cola B over TCP
Purpose
Parameterization and measurement data
Checksum
1-byte XOR over payload (excluding sync, length and CRC).

Frame layout

Offset  Size  Field
0       4     Sync: 0x02 0x02 0x02 0x02
4       4     Length (LE, total frame size in bytes)
8       N     Payload (incl. Cola B command/flags, length = Length-9)
8+N     1     Checksum (XOR over bytes [8 .. 8+N-1])

Python example using Cola B dummy data


tcpPayload = [0x2, 0x2, 0x2, 0x2, 0x0, 0x0, 0x0, 0x77, 0x73, 0x52, 0x41, 0x20,
              0x4c, 0x4d, 0x44, 0x73, 0x63, 0x61, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x20,
              0x0, 0x1, 0x0, 0x1, 0x1, 0x64, 0x72, 0x18, 0x0, 0x0, 0x59, 0x89, 0x69, 0x97,
              0xbb, 0x9d, 0xc5, 0x2, 0xbb, 0x9e, 0x82, 0xcc, 0x0, 0x0, 0x0, 0x0,
              0x0, 0x0, 0x0, 0x0, 0x5, 0xdc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
              0x44, 0x49, 0x53, 0x54, 0x31, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
              0xd, 0xe2, 0xb0, 0x13, 0x88, 0x0, 0x3, 0x0, 0x0, 0x3a, 0xdb, 0x3a, 0xda,
              0x0, 0x1, 0x52, 0x53, 0x53, 0x49, 0x31, 0x3f, 0x80, 0x0, 0x0, 0x0, 0x0,
              0x0, 0x0, 0x0, 0xd, 0xe2, 0xb0, 0x13, 0x88, 0x0, 0x3, 0x0, 0x35, 0x39,
              0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbb]

xor_sum = 0
for byte in tcpPayload[8:-1]:  # Exclude the first 8 bytes and the last byte (CRC)
    xor_sum ^= byte

if xor_sum == tcpPayload[-1]:
    print("CRC check passed")
else:
    print("CRC check failed")
Keywords:
picoScan, picoScan100, picoScan120, picoScan150, crc8, checksum, colab, cola