Crc 32 bit
-
Hi I am trying to commucate with a sensor usimg 32 bit crc. I am using pre-built 32bit crc table. How can I implement error detection code? Sensor sends 38bytes of data with a header 0x93.
There is an error if the CRC send with the message is not the same as those calculated for the received message. So you have to
- Receive message
- Calculate CRC for received message
- Compare with CRC which is part of the message
The final implementation depends on the used message format which should be part of the sensor documentation.
-
Hi I am trying to commucate with a sensor usimg 32 bit crc. I am using pre-built 32bit crc table. How can I implement error detection code? Sensor sends 38bytes of data with a header 0x93.
thank you for your answer here is the code part of my project.
for aye=bytePullIdx:(crcIdx-1)
a = bitand(bitxor(byteBufferPtr(aye),bitshift(crc,-24)),hex2dec('FF'));
crc = bitxor(bitshift(crc,8),crcLookupTable2(a));abowe byteBufferPtr is coming message (38bytes) crcLookupTable is pre-built table for crc polynom '04C11DB7'. after calculating crc I check if (crc==byteBufferPtr(crcIdx) condition to get the data. Is there anything wrong here? because I could not get the right if condition here. I could not find the right crc value among the crc table values. Thank you.
-
thank you for your answer here is the code part of my project.
for aye=bytePullIdx:(crcIdx-1)
a = bitand(bitxor(byteBufferPtr(aye),bitshift(crc,-24)),hex2dec('FF'));
crc = bitxor(bitshift(crc,8),crcLookupTable2(a));abowe byteBufferPtr is coming message (38bytes) crcLookupTable is pre-built table for crc polynom '04C11DB7'. after calculating crc I check if (crc==byteBufferPtr(crcIdx) condition to get the data. Is there anything wrong here? because I could not get the right if condition here. I could not find the right crc value among the crc table values. Thank you.
-
Actually I am working on code offline. I took 38byte of data starting with header and put it my code. The sensor is sensonor stim300
-
I do not think anyone here can guess what data the device will produce. You should check the technical documentation for the device, or contact the manufacturer.
-
Actually I am working on code offline. I took 38byte of data starting with header and put it my code. The sensor is sensonor stim300
yagokhan wrote:
he sensor is sensonor stim300
A quick Google search for "stim300 crc" found this: drivers-imu_stim300/src at master · rock-drivers/drivers-imu_stim300 · GitHub[^]. There see the
verifyChecksum
function at drivers-imu_stim300/Stim300RevD.cpp at master · rock-drivers/drivers-imu_stim300 · GitHub[^]. It uses the Boost CRC Library - 1.63.0[^] which is just a header file implementing the CRC calculations.