Docs say that the response to AT+QFUPL is:
+QFUPL: <upload_size>,<checksum>
I’m uploading successfully, but can’t figure out how the module is calculating the checksum.
For example, if I upload my 1187 byte cert, the module reports:
+QFUPL: 1187,2d19
but I can’t figure out how it’s calculating 2d19.
I read this post:
https://forums.quectel.com/t/bg96-checksum-for-file-after-uploaded-c-code/5297
but neither algorithm produces the 2d19
checksum that’s reported with the +QFUPL:
Could you provide some insight? Maybe the crc-calc code snippet from the module itself?
Thanks,
-Dave
knodi
July 25, 2023, 9:04pm
2
@dlchambers_aperia Did you ever figure this out?
@knodi Nope
You’d think Quectel could just post the source to their function. CRC-calc is pretty simple…
Try this python code, provide the input file via stdin:
import sys
checksum = 0
buff = sys.stdin.buffer.read(2)
while len(buff) != 0:
if len(buff) == 1:
buff += b"\x00"
checksum ^= int.from_bytes(buff)
buff = sys.stdin.buffer.read(2)
print(hex(checksum))
See my reply to the other thread, here:
In case anyone else is looking for this information (I’ve looked in the past too), the CRCs are calculated using the following configurations.
I’m using the BG95-M3, which has three CRCs in the response from AT+QFCRC:
+QFCRC:<crc32>,<crc16>,<crc16_ccitt>
Hat-tip to delsum !
CRC-32
crc width=32 poly=0x4c11db7 init=0x0 xorout=0x0 refin=false refout=false out_endian=big
CRC-16
crc width=16 poly=0x1021 init=0xffff xorout=0xffff refin=false refout=false out_endian=big
CRC-16 / CCITT
crc width…