Computer Interfacing
Discussions about interfacing and electronics
 

Which CRC calculation?

Trying to figure out the CRC algorithm used


 

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







Mar 06, 2015 7:11 pm

Hi Folks, I'm trying to re-implement a serial communications protocol and am stuck on the CRC calculation. An earlier implementation of this protocol used a simple one-byte checksum, but it doesn't look like its going to be quite that easy here with the newer implementation.

Here is a dump of the serial messages sent from the host software to the end device (responses omitted). Its a modbus-y type protocol (but definitely not modbus). This is what I've deciphered so far.

Code:

Example message: .00110050050E4BE.

|   .  |   001|  10|  050| 050 |    E4BE|   .   |
|Header|Device|Func|Start| reg |Checksum|trailer|
| Char | Addr |code|Addr |count|   ???  | Char  |

I haven't figured out the longer messages, but they have non-hex ascii characters which is probably a clue to the checksum. These are the messages sent from the host to the device.

Code:

.00110050050E4BE.          
.001100A0050DC5D.          
.001100F0050EC81.          
.00110SF3F3000000501945.   
.00110050050E4BE.          
.001100A0050DC5D.          
.001100F0050EC81.          
.00110NPF3000000501BA8.   
.00110050050E4BE.          
.001100A0050DC5D.          
.001100F0050EC81.          
.00110140050EBD1.          
.0011019005097A5.          
.001101E0050F566.          
.00110230050D770.          
.00110NF3F3000000507DE4.   
.00110050050E4BE.          
.001100A0050DC5D.          
.001100F0050EC81.          
.00110140050EBD1.          
.0011019005097A5.          
.001101E0050F566.          
.00110230050D770.          
.0010900103F5CB6.          
.0010904003E5F86.          
.001090800404194.          
.001090C003F4832.          
.0010910403C6167.          
.00109140039E246.          
.0010918603A2123.          
.001091C003E7E82.          
.00109203039E6E6.          
.00109259027ECBA.          
.0010928001E1350.        
.00110PPF3000000500351.   
.00110PF3F30000005017B2.   
.00110SPF30000005084BF.   




Any thoughts would be greatly appreciated.

Thanks!
spanky
Guest







Mar 07, 2015 1:31 am

I was able to change the address in the host software, so I can generate some messages that only differ by one character. I'm pretty sure the last 4 characters are the CRC, but I'm still having trouble figuring out the algorithm.

Code:
.00110PPF3000000500351.
.00210PPF300000050DB2F.
.00310PPF3000000509305.
.00410PPF30000005063C2.
.00510PPF3000000502BE8.
.00610PPF300000050F396.
.00710PPF300000050BBBC.
.00810PPF3000000501A09.
.00910PPF3000000505223.
.00A10PPF30000005077DE.
.00B10PPF300000050AFA0.
.00C10PPF300000050E78A.
.00D10PPF300000050174D.
.00E10PPF3000000505F67.
.00F10PPF3000000508719.
.01010PPF300000050C56B.
.01110PPF3000000508D41.
.01210PPF300000050553F.
.01310PPF3000000501D15.
.10010PPF3000000505B74.

.00110PF3F30000005017B2.
.00210PF3F3000000508D93.
.00310PF3F3000000500383.
.00410PF3F300000050B1C0.
.00510PF3F3000000503FD0.
.00610PF3F300000050A5F1.
.00710PF3F3000000502BE1.
.00810PF3F300000050C966.
.00910PF3F3000000504776.
.00A10PF3F3000000506B39.
.00B10PF3F300000050F118.
.00C10PF3F3000000507F08.
.00D10PF3F300000050CD4B.
.00E10PF3F300000050435B.
.00F10PF3F300000050D97A.
.01010PF3F30000005089AD.
.01110PF3F30000005007BD.
.01210PF3F3000000509D9C.
.01310PF3F300000050138C.
.10010PF3F3000000506145.

.00110SPF30000005084BF.
.00210SPF3000000505CC1.
.00310SPF30000005014EB.
.00410SPF300000050E42C.
.00510SPF300000050AC06.
.00610SPF3000000507478.
.00710SPF3000000503C52.
.00810SPF3000000509DE7.
.00910SPF300000050D5CD.
.00A10SPF300000050F030.
.00B10SPF300000050284E.
.00C10SPF3000000506064.
.00D10SPF30000005090A3.
.00E10SPF300000050D889.
.00F10SPF30000005000F7.
.01010SPF3000000504285.
.01110SPF3000000500AAF.
.01210SPF300000050D2D1.
.01310SPF3000000509AFB.
.10010SPF300000050DC9A.

.0010900103F5CB6.
.0020900103F8AB1.
.0030900103FC74C.
.0040900103F2EAE.
.0050900103F6353.
.0060900103FB554.
.0070900103FF8A9.
.0080900103F6E81.
.0090900103F237C.
.00A0900103FB278.
.00B0900103F647F.
.00C0900103F2982.
.00D0900103FC060.
.00E0900103F8D9D.
.00F0900103F5B9A.
.0100900103F3D6C.
.0110900103F7091.
.0120900103FA696.
.0130900103FEB6B.
.1000900103F44DA.

.0010904003E5F86.
.0020904003E8981.
.0030904003EC47C.
.0040904003E2D9E.
.0050904003E6063.
.0060904003EB664.
.0070904003EFB99.
.0080904003E6DB1.
.0090904003E204C.
.00A0904003EB148.
.00B0904003E674F.
.00C0904003E2AB2.
.00D0904003EC350.
.00E0904003E8EAD.
.00F0904003E58AA.
.0100904003E3E5C.
.0110904003E73A1.
.0120904003EA5A6.
.0130904003EE85B.
.1000904003E47EA.
[/code]
Guest








Mar 17, 2015 1:53 am

Answer is posted at stackoverflow. I cant post it here. Search for unknown-crc-calculation question #28919221

       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