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.

IWR1843BOOST: implementation of ValidateChecksum matlab function in python for 2D People Counting Lab

Part Number: IWR1843BOOST

Hi,

I'm working on the 2D People Counting Lab Demo trying to create the python version of the validatechecksum function with respect to the the matlab one released for mmwave Industrial Toolbox 4.0.0.

I'm using the SDK 03.04.00.03 and the binary released with the mmwave IT 4.0.0 for 2D People Counting 68xx.

I tried to convert the matlab validatechecksum function, that is:

function CS = validateChecksum(header)
    h = typecast(uint8(header),'uint16');
    a = uint32(sum(h));
    b = uint16(sum(typecast(a,'uint16')));
    CS = uint16(bitcmp(b));
end

in a python equivalent, that I hope could be, as follows:

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

I did a few experiment, and it seemed to make sense, and the same of the matlab one, but to be secure, I ask you to give me your opinion about it.

Also, I saw that exists a python script from mmwave Industrial Toolbox 4.4.1 and on, that could be used for different demo, including the 2D People Counting. Unfortunately, I didn't find the validation of the checksum function in the python scripts given. Was there a particular choice to not check the checksum value as it was done for the matlab script ?

Finally, Why in the data of the header of the packets received from the mmwave device there is the checksum field ? You 'd like to implement this validation directly in the code the runs on the processor of the device, wouldn't you ? I ask you this question because for what concern the value returned, they are not the same values returned by applying the validation function.

Best Regards

Angelo Claudio Re

  • Hello Angelo,

    The checksum is used in the header to validate the data received FROM the device, so it can be used by an external host (PC or other) to know they received the correct amount of data. The python demo does not include the checksum validation as it simply wasn't implemented. You are free to include this yourself. The implementation you have seems fine, there are many ways to implement this. You can see how the checksum is created in the UART task of the source code to check against your python code. If the matlab and python checksum calculations match then it should be good.

    Regards,

    Jackson

  • Ok, crystal clear.

    Thanks Jackson