0

I am using an old piece of hardware which uses an RS485 serial interface. I'm trying to simulate slave node data but I don't have any documentation on the protocol and unfortunately the hardware is not supported any more.

I've got numerous examples of master and slave data for which I've tried to reverse engineer the check sequence but I've not found a match for the algorithm.

Master to Slave examples

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A5
04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A9
06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AB
08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AD

Slave to Master examples

80 00 24 F4 67 1E A3 00 00 00 00 3F 00 FB E6 F9 81 BB 17 D1
84 00 00 00 00 00 00 00 00 00 00 00 00 D8 3D 62 FC 6C 7C 84
86 00 00 00 00 00 00 00 00 00 00 00 00 39 7A 9A 05 77 77 6B
88 02 02 02 02 02 02 02 02 00 00 00 00 29 9E EA 45 76 78 21

It's clear the first 15 bytes for Master to Slave and first 19 bytes for Slave to Master is the data and the last byte is used as the check sequence. You can see the protocol uses the first byte as an address with the associated reply setting the most significant bit, though the addressing doesn't determine the error check byte algorithm it is included as part of the calculation.

My approach so far includes using the various online CRC and checksum calculators. I also tried to use reveng but have not managed to find a match. Any help would be much appreciated.

  • 2
    Sum all bytes, add A5. – tkausl Mar 1 at 7:22
  • Excellent that's it! Should have noticed with the first message all set to 00 was starring me in the face. Thank you :) – Moon Waxing Mar 1 at 12:59

Your Answer

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

Browse other questions tagged or ask your own question.