Hi all!
been dealing for a couple of days with this and I’m pretty much stuck. Wrote a simple function on a Python script to interact with an electronic device, this device uses a CRC32 check as part of its serial communication protocol. My current Python function looks like this:
def calculate_crc(payload):
crc = binascii.crc32(binascii.unhexlify(str(payload)))
return hex(crc % (1<<32))
So for a desired payload I got the CRC32:
>>> calculate_crc('620004')
'0xb37f0245'
Which is OK as I tested against the device. Now, porting the code to Arduino, I hit a wall when trying to replicate this same behavior.
I’ve tried to use:
Without any luck, no matter what I do, I cannot replicate the same CRC32 I got from the Python script. Aside from that I receive different values, which leads me to think I’m not handling it very well.
The implementation hardware guide says:
CRC32: This is the big-endian 32 bit CRC or all payload bytes i.e. excluding size and CRC. The CRC32 is
implemented as per public domain ‘crc32.c’ (http://www.csbruce.com/software/crc32.c)
Can anyone help me point the right direction?
Thanks in advance