This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IWR6843LEVM: The header checksum is wrong, and what's the checksum Algo for the header ?

Part Number: IWR6843LEVM
Other Parts Discussed in Thread: AWR6843

My chip is IWR6843LEVM, and the FW in chip is 'radar_toolbox_1_10_00_13\source\ti\examples\InCabin_Sensing\AWR6843_CPD_with_Classification\prebuilt_binaries\occupancy_detection_3d_68xx.bin'

data and control port config is as below, it is implemented in python:

self.schandle = serial.Serial(self.control_port,baudrate=115200, parity= serial.PARITY_NONE,
timeout=1, writeTimeout=1)
self.sdhandle = serial.Serial(self.data_port, baudrate=921600, timeout=15, write_timeout=15)

The checksum validate func is as below

def validate_checksum1(header):
h = np.frombuffer(header, dtype='uint16')
a = np.uint32(np.sum(h))
CS = np.uint16(np.bitwise_not(a))
print(CS)

I found the checksum of header is not 0 sometimes, example:

header = b'\x02\x01\x04\x03\x06\x05\x08\x07\x04\x00\x05\x03D\x05\x00\x00Ch\n\x00\xdf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0E\x00\x00\x00\x00\x00\x00\x86@\x00\x00\x01\x00*\xf8'
header = b'\x02\x01\x04\x03\x06\x05\x08\x07\x04\x00\x05\x03\x94\x05\x00\x00Ch\n\x00\xeb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00H\x00\x00\x00\x00\x00\x00\xe5A\x00\x00\x01\x00/\xf4'
header = b'\x02\x01\x04\x03\x06\x05\x08\x07\x04\x00\x05\x03\xe4\x04\x00\x00Ch\n\x00\x08\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00sD\x00\x00\x00\x00\x00\x00\x83@\x00\x00\x01\x00\xb1\xf9'
header = b'\x02\x01\x04\x03\x06\x05\x08\x07\x04\x00\x05\x03\\\x05\x00\x00Ch\n\x00\xe2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/F\x00\x00\x00\x00\x00\x00\xf3@\x00\x00\x01\x003\xf7'

the CS values are all 1

below is the correct headers with CS value 0:

header = b'\x02\x01\x04\x03\x06\x05\x08\x07\x04\x00\x05\x03\x1c\x03\x00\x00Ch\n\x002\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00L8\x00\x00\x00\x00\x00\x00\xe0$\x00\x00\x01\x00\x1a$'
header = b'\x02\x01\x04\x03\x06\x05\x08\x07\x04\x00\x05\x03|\x03\x00\x00Ch\n\x00;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12;\x00\x00\x00\x00\x00\x00~)\x00\x00\x01\x00M\x1c'
header = b'\x02\x01\x04\x03\x06\x05\x08\x07\x04\x00\x05\x03T\x04\x00\x00Ch\n\x00H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00B?\x00\x00\x00\x00\x00\x00\x99.\x00\x00\x01\x00\x1d\x12'


Can you help me why the CS value is not 0 in some headers?

  • Hi, there:

    I checked the code inside visualizer, and the header structure is listed as below.  The total header length is 48Byte.  Can you check whether it matches yours?

    frameHeaderStructType = struct(...
    'sync', {'uint64', 8}, ... % See syncPatternUINT64 below
    'version', {'uint32', 4}, ...
    'packetLength', {'uint32', 4}, ... % In bytes, including header
    'platform', {'uint32', 4}, ...
    'frameNumber', {'uint32', 4}, ... % Starting from 1
    'subframeNumber', {'uint32', 4}, ...
    'chirpProcessingMargin', {'uint32', 4}, ... % 600MHz clocks
    'frameProcessingTimeInUsec', {'uint32', 4}, ... % 600MHz clocks
    'trackingProcessingTimeInUsec', {'uint32', 4}, ... % 200MHz clocks
    'uartSendingTimeInUsec', {'uint32', 4}, ... % 200MHz clocks
    'numTLVs' , {'uint16', 2}, ... % Number of TLVs in this frame
    'checksum', {'uint16', 2}); % Header checksum
    Best,
    Zigang
  • Hi, zigang,

    Yes, it matches, do you know how to validate the header checksum if it is correct? thanks for you reply.

  • HI, Dave:

    The script we use looks very similar to yours.

    h = typecast(uint8(header),'uint16');
    a = uint32(sum(h));
    b = uint16(sum(typecast(a,'uint16')));
    CheckSum = uint16(bitcmp(b));

    Best,

    Zigang

  • Hi zigang,

    Based on the information you provided, I have modified my checksum value validation function and it should be fine now, thanks for your help.

    def validate_checksum(header):
    h = np.frombuffer(header, dtype='uint16')
    a = np.uint32(np.sum(h))
    b = np.uint16(np.sum(np.frombuffer(a.tobytes(), dtype='uint16')))
    CS = np.uint16(np.invert(b))