2

I need to reverse a RS485 protocol in order to extract some values for further usage. Unfortunately only these few messages are available at the moment. They repeat continuosly. Only in special situations longer messages (>100 bytes) appear. I assume there must be included some sort of checksum somewhere (column K???) or how would the system detect sending failures?

I could implement the possible checksum in a static way for these simple messages but for "unkown" new messages it would be easier to calculate the checksum live. I tried some online checksum calculators, but without any success.

Any good idea about this protocol? Thanks.

(H gives the actual data length)

 A  B  C  D  E    F  G  H  I  J  K  L 
02 00 01 01 01   8C 8C 8E CC 8C 95 03 (original HEX message)   
02 00 01 01 01   00 00 02 40 00 19 03 (HEX with applied XOR 8C)  

HEX messages to master with already applied XOR:  (messages end with 03)
02 00 01 01 01   00 00 02 40 00 19 03    
02 00 02 06 00   00 00 05 00 00 00 00 00 5F 03  
02 00 03 06 00   00 00 05 00 00 00 00 00 5F 03  
HEX messages to slaves with already applied XOR:  (messages end with 03 03!)
02 03 00 06 00   00 00 07 00 00 40 00 00 00 00 1D 03 03  
02 02 00 06 00   00 00 07 00 00 40 00 00 00 00 1D 03 03   

These are the only simple messages that are available at the moment :-/

A=preamble (not a unique character)  
B=destination  
C=sender  
F=key for XOR  
H=data length  
K=????? (maybe a checksum???)  
L=end of message (messages from master end with 3 3, messages from slave end with 3)  
2

Found the solution:

It is a XOR checksum with an initial key "5A" (not including the first four HEX values).

02 00 01 01 [01 00 00 02 40 00] 19 03 

5A ^ 01 ^ 00 ^ 00 ^ 02 ^ 40 ^ 00 = 19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.