Computer Interfacing
Discussions about interfacing and electronics
 

Unknown crc ? anyone an idea

unknown crc ? what is used


 

       Computer Interfacing Forum Index -> Error detection and correction
Author Message
xtrusion
Guest







Nov 28, 2010 1:26 pm

Hi

i'm working on a new project and have some problem with an unknown crc for me

anyone an idea

7F 0E 00 42 02 00 08 00 34 10 00 00 B0 09 00 00 B7 25 7E
7F 0E 00 42 02 00 08 00 29 10 00 00 B0 09 00 00 E7 6E 7E
7F 0E 00 42 02 00 08 00 02 10 00 00 B0 09 00 00 D7 9B 7E
7F 0E 00 42 02 00 08 00 05 10 00 00 B0 09 00 00 A7 89 7E
7F 0E 00 42 02 00 08 00 78 10 00 00 B0 09 00 00 F6 96 7E

the end string of the command is always 7E

the 2 bytes before that are CRC, what crc is used here ?
Gammatester
Guest







Nov 28, 2010 3:53 pm

Your data packets are compatible with two Rocksoft parameter sets:
Code:
===== Result parameter sets =====
CRC=$b725  Poly=$8005  init=$53dd  xorout=$0000  refin=false  refout=false
 *** Second data set verified
 *** Third  data set verified
CRC=$b725  Poly=$8005  init=$795d  xorout=$ffff  refin=false  refout=false
 *** Second data set verified
 *** Third  data set verified
===== done =====
Since your packets always have the same length and differ only at the 9th byte there is no possibility to rule out one of the parameter sets. Do you have data packets with different lengths?
Guest








Nov 28, 2010 4:27 pm

yes in the same system i get also other response codes back..

7F 01 00 42 01 7E

7F 0F 00 42 00 05 09 00 00 00 00 00 30 30 30 30 00 D5 5E 7E

7F 0A 00 42 01 00 04 00 05 10 00 00 37 93 7E

hope this will help...
Guest








Nov 28, 2010 4:37 pm

Also some more info.. same lenght but other bytes changed too compared to first set

7F 0E 00 42 02 00 08 00 34 10 00 00 F0 0F 00 00 37 40 7E
7F 0E 00 42 02 00 08 00 29 10 00 00 F0 0F 00 00 67 0B 7E
7F 0E 00 42 02 00 08 00 02 10 00 00 F0 0F 00 00 57 FE 7E
7F 0E 00 42 02 00 08 00 05 10 00 00 F0 0F 00 00 27 EC 7E
7F 0E 00 42 02 00 08 00 78 10 00 00 F0 0F 00 00 76 F3 7E
Guest








Nov 28, 2010 5:24 pm

super thnx..

i checked the
CRC=$b725 Poly=$8005 init=$53dd xorout=$0000 refin=false refout=false

and this seems to be correct one Smile

now searching how to implement this in vb6 Smile

btw what program / tool you use to compute back the crc.. seems to be very handy..
Gammatester
Guest







Nov 28, 2010 6:46 pm

It is my opensource SRP16 Delphi program, the EXE is included in the archive chksum_bin_2010-03-26.zip. Search the web for these keywords: SRP16 chksum_bin_2010-03-26.
xtrusion
Guest







Nov 28, 2010 6:58 pm

thnx very usefull program

some other question.. any idea how to implement the

CRC=$b725 Poly=$8005 init=$53dd xorout=$0000 refin=false refout=false

in VB6 ? i searched some example codes.. but they all work with table and no option to give in other poly (sorry i'm new into this.. all for learning Smile)
Guest








Nov 28, 2010 8:02 pm

well found a solution... Smile

for anyone who need some in the future.. here is the code..

Code:

Function CRC_Check(ary() As Byte, ary_len As Long)
Dim crc, data, i, j As Long
    crc = &H53DD
    For i = 0 To ary_len - 1
     data = ary(i)
     crc = crc Xor data * 256
     For j = 1 To 8
     If crc And 32768 Then
     crc = crc * 2 Xor &H8005
     Else
     crc = crc * 2
     End If
     crc = crc And 65535
     Next j
    Next i
    CRC_Check = crc Xor 0
End Function

regregex
Preferred Member



Joined: 30 Oct 2007
Posts: 184
Location: London, UK

Nov 30, 2010 5:06 pm

Further to Gammatester's answer, Init = 0x53dd works but only for messages with payload length = 0x0e. The general solution is:
Code:
  Poly=$8005  init=$eaea  xorout=$0000  refin=false  refout=false  check=$877f
The crc applies to the payload only, i.e. excluding the 0x7f, the payload length byte and the 0x7e. However the message with payload length = 0x01 doesn't obey this rule.
Code:
[greg@twiggy greg]$ perl crcbfs.pl 1 16 2 8005 \
004200050900000000003030303000D55E 004201000400051000003793 \
00420200080034100000B0090000B725
Searching for Init values
...........................
Found parameters 16 8005 0 6AE9 8003
................................
Found parameters 16 8005 0 EAEA 0
.....
16 8005 0 6AE9 8003
16 8005 0 EAEA 0
HTH

Greg

       Computer Interfacing Forum Index -> Error detection and correction
Page 1 of 1



Running on php BB © 2001, 2009 php BB Group
   Lammert Bies     Interfacing     Sitemap     Forum