Options

# sony a/v receiver checksum

Posts: 9
I am trying to figure out the the checksum for a sony strda2000es A/V receiver. On the protocol Sheet it gives this example command for power on "02 02 A0 20 3D" where 02 is STX, 02 is BC, A0 is product code, 20 is the cmd, and 3D is the checksum but i can not figure out how they are comming up with the checksum byte of 3D. Becuase while this command works the off command of "02 02 A0 21 3D" does not Becaus i can't figure out the check sum byte.

this is the data format:

5. Data Format (Host Controller <-> Amplifier)
STX + BC + PDC + CMD + Data1 +
+ DataN + CS
The terminological definition is as follows.
STX 02 H : Start of text code
BC : Byte Count
(Number of bytes of until before CS from PDC.)
PDC : Product Code
CMD : Command (Opecode)
DataN : Data Block ( 0 < M + FAH )
CS : Check Sum
A value from which 8 bits of low ranks of the sum
from BC to CS are set to 0.

• Options
Posts: 861
easy.

in this example, i use the power off command:
02 02 A0 21 3D
If you look at how the checksum is calculated, you say this:
"CS : Check Sum
A value from which 8 bits of low ranks of the sum
from BC to CS are set to 0."
So, we sum all the hex values excluding the first 0x02 (STX) => 02+A0+21 = C3
We then do a binary not (BNOT in Netlinx) and we get "3C"
So the power off command should be: "\$02,\$02,\$A0,\$21,\$3C"

Let me know if i got it right
• Options
Posts: 9
I will Let you Know, i'll have test it tonight. Thanks
• Options
Posts: 9
No it does not seem to be working here is another example from the manual: (another Power On command)02 04 a0 60 00 01 FB where FB is CS This command is working but this command which is another power off command: 02 04 a0 60 00 00 "CS" can't figure out the CS.
• Options
Posts: 2,159
cbucha,

Are you sure you posted correct examples at the top of this thread? I don’t think you did and that made things difficult to figure out until you posted another example. Back to that in a moment.

To calculate the checksum do what yuri said and then add 1. Doing a BNOT flips all the bits so if you add the sum to the BNOT version you will get \$FF, not \$00. I believe the protocol is asking for the two’s compliment of the sum (What plus the sum = 0?) and one way to do that is to do a BNOT of the sum and then add 1. (Only use the least significant 8 bits for an answer – If you do your calculations with a CHAR, the lopping off will take care of itself.)
cbucha wrote:
On the protocol Sheet it gives this example command for power on "02 02 A0 20 3D" where 02 is STX, 02 is BC, A0 is product code, 20 is the cmd, and 3D is the checksum but i can not figure out how they are comming up with the checksum byte of 3D.
I believe that statement is in error and the correct Power On string is:
“\$02,\$02,\$A0,\$21,\$3D"
cbucha wrote:
Becuase while this command works the off command of "02 02 A0 21 3D" does not Becaus i can't figure out the check sum byte.
That should be correct for Power On, not Power Off.

I believe the correct Power Off string is:
“\$02,\$02,\$A0,\$20,\$3E"
cbucha wrote:
here is another example from the manual: (another Power On command)02 04 a0 60 00 01 FB where FB is CS This command is working but this command which is another power off command: 02 04 a0 60 00 00 "CS" can't figure out the CS..

I believe the other Power Off command string is:
“\$02,\$04,\$A0,\$60,\$00,\$00,\$FC"

Let us know how it turns out.

Edit: Grammar fix.
• Options
Posts: 9
check out this link for the protocol http://www.cbt-ent.com/sony.pdf
• Options
Posts: 2,159
cbucha wrote:
check out this link for the protocol http://www.cbt-ent.com/sony.pdf
I checked out the link and it confirms my theory that the examples you posted at the top of the thread are in error and do not follow what the protocol document states for Power On and Power Off. Try the commands I posted. They should work, assuming the protocol document is correct.
• Options
Posts: 9
yep that worked i have to do a not than +1

thanks.
• Options
Posts: 861
blergh, next time give a good example. i reverse engineerd your example to come up with my solution
• Options
Posts: 2,159
Blergh? Is that a Dutch thing, yuri?

Glad you got things working, cbucha.