Skip to content

Instantly share code, notes, and snippets.

@scy
Last active January 11, 2020 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scy/8e6c10c1fe54bb11b0239e78bae7eede to your computer and use it in GitHub Desktop.
Save scy/8e6c10c1fe54bb11b0239e78bae7eede to your computer and use it in GitHub Desktop.
Checksum of a proprietary RS485 protocol
Packets with “?” may have a wrong checksum, I’m not sure about those.
Format of a packet seems to be:
1 start byte
3 bytes header (I don’t understand it yet)
1 byte payload length
n bytes payload
1 byte checksum
Interested in what else I found out? Check the project page:
https://github.com/scy/votonic
My question was: How is the checksum calculated?
But @Manawyrm found it out: simple XOR of all the bytes on top of 0x55.
Here’s the implementation:
https://github.com/scy/votonic/commit/cc3e74565384ab6cd068f9350a35398dcf845240
_ start byte
/ _ payload length
/ / _ checksum
/ / /
aa 22 04 f4 03 00 00 00 2e
aa 22 08 f4 03 0f 00 00 2d
aa 22 0c f4 03 03 00 00 25
aa 22 10 f4 03 02 00 00 38 ?
aa 22 10 f4 03 05 00 00 3f
aa 22 10 f4 03 07 00 00 3d ?
aa 22 10 f4 03 08 00 00 32 ?
aa 22 11 f4 03 0b 00 00 30
aa 22 34 f4 03 00 00 00 1e
aa 22 38 f4 03 00 00 00 12
aa 22 40 f4 03 00 00 00 6a
aa 22 74 f4 03 02 00 00 5c
aa 22 c4 f4 03 00 00 00 ee
aa 62 f4 04 03 00 c0 00 ae
aa 62 f4 08 03 0f 00 03 6e
aa 62 f4 0c 03 02 eb ff 70
aa 62 f4 0c 03 03 1e 05 7e
aa 62 f4 0c 03 03 21 05 41
aa 62 f4 0c 03 06 50 45 75
aa 62 f4 0c 03 06 50 46 76
aa 62 f4 0c 03 06 50 47 77
aa 62 f4 0c 03 06 50 48 78
aa 62 f4 0c 03 06 50 49 79
aa 62 f4 0c 03 06 50 4a 7a
aa 62 f4 0c 03 06 50 4b 7b
aa 62 f4 0c 03 06 50 4c 7c
aa 62 f4 0c 03 06 50 4d 7d
aa 62 f4 10 03 02 00 00 78 ?
aa 62 f4 10 03 05 fe ff 7e
aa 62 f4 10 03 07 00 00 7d ?
aa 62 f4 10 03 08 fe ff 73 ?
aa 62 f4 34 03 00 e5 04 bf
aa 62 f4 38 03 00 e0 00 b2
aa 62 f4 40 03 00 c0 00 ea
aa 62 f4 74 03 02 00 00 1c
aa 62 f4 c4 03 00 00 00 ae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment